Skip to content

Small optimisations and tidying related to MyAvatar #1047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2021

Conversation

Phil-Palmer
Copy link
Contributor

@Phil-Palmer Phil-Palmer commented Feb 20, 2021

This PR consists of small optimisations and tidying of things that were noticed in passing, related to MyAvatar. No behaviour should change.

  1. Removed the "Toggle Hips Following" option from the Developer menu. It had no effect on any code.
  2. The deprecated MyAvatar.setToggleHips script function, which had no effect on any code, now ouptuts a log warning indicating that it's deprecated.
  3. In CharacterController::applyMotor, prevented unnecessary calls to btVector3::rotate() when the motor has no rotation. This change also improves readability through the use of clearly-named lambdas.
  4. In AvatarData::getFauxJointIndex, prevented unnecessary string comparisons when the named joint is a real joint rather than a faux one.
  5. In Avatar::getJointIndex, removed an unnecessary call to QHash<QString, int>::contains(), by supplying a default index for QHash<QString, int>::value().
  6. Removed unnecessary condition "forwardLeanAmount < 0" in MyAvatar::FollowHelper::shouldActivateHorizontal_userSitting.
  7. Corrected the return type of MyAvatar::getSitStandStateChange from float to bool.
  8. Added a missing 'f' suffix to a float literal in PreferencesDialog.cpp (fixes warning C4305: "'argument': truncation from 'double' to 'float'").

…g. No behaviour should change.

* Removed the deprecated MyAvatar.setToggleHips script function and the "Toggle Hips Following" option from the Developer menu.  They had no effect on any code.
* In CharacterController::applyMotor, prevented unnecessary calls to btVector3::rotate() when the motor has no rotation.  This change also improves readability through the use of clearly-named lambdas.
* In AvatarData::getFauxJointIndex, prevented unnecessary string comparisons when the named joint is a real joint rather than a faux one.
* In Avatar::getJointIndex, removed an unnecessary call to QHash<QString, int>::contains(), by supplying a default index for QHash<QString, int>::value().
* Removed unnecessary condition "forwardLeanAmount < 0" in MyAvatar::FollowHelper::shouldActivateHorizontal_userSitting.
* Corrected the return type of MyAvatar::getSitStandStateChange from float to bool.
* Added a missing 'f' suffix to a float literal in PreferencesDialog.cpp.
@digisomni digisomni added allow-build-upload Allows the upload of a build for non white-listed users enhancement New feature or request labels Feb 20, 2021
@digisomni digisomni added this to the 2021.1.1 Eos Release milestone Feb 20, 2021
@ctrlaltdavid
Copy link
Collaborator

We should follow a deprecation process for API items such as MyAvatar.setToggleHips(). Though it is marked in the API docs as "deprecated" we shouldn't remove it without warning, just in case someone's script is still using it.

Suggestion: Over the course of three releases ...

  1. Mark the method in the API docs as "deprecated". And notify in Discord.
  2. Make the method a no-op - remove code from method body and add a program log warning, "this function is deprecated; it no longer does anything; it will soon be removed from the API; please update your script". And notify in Discord.
  3. Remove the method.

For MyAvatar.setToggleHips(), we're up to stage 2. I.e., keep the method in the API but make it just log a warning.

The process could be tracked in an issue. E.g., for this method I've created: #1061

Re-add deprecated MyAvatar.setToggleHips and have it do nothing but output a log warning.
@ctrlaltdavid ctrlaltdavid added CR Approved At least one code reviewer has approved the PR. needs testing (QA) The PR is ready for testing and removed needs CR (code review) labels Mar 6, 2021
@digisomni digisomni added the rebuild rebuild through the GithubActions label Mar 20, 2021
@daleglass
Copy link
Contributor

Android build failed with the qt not having been entirely downloaded for some reason. I checked the CDN and everything looks good on there, so I just made it do another build.

Copy link
Member

@digisomni digisomni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to work alright on desktop. :)

@SilverfishVR
Copy link
Contributor

Testing PR1047-4360ceb in VR

Assuming that that is not supposed to be any functional change it seems to work 👍 no new bugs detected.

@digisomni digisomni added QA Approved The PR has been tested successfully. and removed needs testing (QA) The PR is ready for testing labels Mar 27, 2021
@digisomni digisomni merged commit 4cb9459 into vircadia:master Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allow-build-upload Allows the upload of a build for non white-listed users CR Approved At least one code reviewer has approved the PR. enhancement New feature or request QA Approved The PR has been tested successfully. rebuild rebuild through the GithubActions scripting api change Change is made in the scripting API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants