mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-14 02:27:10 +02:00
Re-added API features that are no longer used internally; marked them as deprecated.
As suggested in the review here: https://github.com/vircadia/vircadia/pull/928/files#r549821976
Re-added and deprecated MyAvatar.userRecenterModel. Retained the functionality of setUserRecenterModel, and approximated that of getUserRecenterModel (some stand+lean preference pairs had no equivalent before).
Re-added and deprecated MyAvatar.isSitStandStateLocked. Approximated the functionality of getIsSitStandStateLocked.
Didn't retain that of setIsSitStandStateLocked, because it wouldn't be useful on its own; someone using it would probably want setUserRecenterModel instead (or new functions to set the standing and leaning preferences).
isSitStandStateLocked's reason to exist was that we could stop keeping track of the user's real-world sit/stand state (in updateSitStandState), and instead pretend the user was always standing (for SitStandModelType::ForceStand) or always sitting (for SitStandModelType::ForceSit).
That determined whether the avatar was allowed to lean (wouldn't lean if the user was sitting or in ForceSit).
Now though, the user explicitly chooses when the avatar may lean: never / just when the user is standing / even when the user is sitting.
These API features were removed in 2179c153de
("VR fixes for: couldn't sit on the floor, wrong walk directions").
This commit is contained in:
parent
8c7c91ed6f
commit
cba79c72f5
2 changed files with 86 additions and 0 deletions
|
@ -5273,6 +5273,33 @@ bool MyAvatar::getIsInSittingState() const {
|
|||
return _isInSittingState.get();
|
||||
}
|
||||
|
||||
// Deprecated, will be removed.
|
||||
MyAvatar::SitStandModelType MyAvatar::getUserRecenterModel() const {
|
||||
qCDebug(interfaceapp)
|
||||
<< "MyAvatar.getUserRecenterModel is deprecated and will be removed. If you need it, please contact the developers.";
|
||||
|
||||
// The legacy SitStandModelType corresponding to each AllowAvatarLeaningPreference.
|
||||
std::array<SitStandModelType, static_cast<uint>(AllowAvatarLeaningPreference::Count)> legacySitStandModels = {
|
||||
SitStandModelType::Auto, // AllowAvatarLeaningPreference::WhenUserIsStanding
|
||||
SitStandModelType::ForceStand, // AllowAvatarLeaningPreference::Always
|
||||
SitStandModelType::ForceSit, // AllowAvatarLeaningPreference::Never
|
||||
SitStandModelType::DisableHMDLean // AllowAvatarLeaningPreference::AlwaysNoRecenter
|
||||
};
|
||||
|
||||
return legacySitStandModels[static_cast<uint>(_allowAvatarLeaningPreference.get())];
|
||||
}
|
||||
|
||||
// Deprecated, will be removed.
|
||||
bool MyAvatar::getIsSitStandStateLocked() const {
|
||||
qCDebug(interfaceapp) << "MyAvatar.getIsSitStandStateLocked is deprecated and will be removed. If you need it, please "
|
||||
"contact the developers. See also: MyAvatar.getUserRecenterModel.";
|
||||
|
||||
// In the old code, the record of the user's sit/stand state was locked except when using
|
||||
// SitStandModelType::Auto or SitStandModelType::DisableHMDLean.
|
||||
return (_allowAvatarStandingPreference.get() != AllowAvatarStandingPreference::WhenUserIsStanding) &&
|
||||
(_allowAvatarLeaningPreference.get() != AllowAvatarLeaningPreference::AlwaysNoRecenter);
|
||||
}
|
||||
|
||||
// Get the user preference of when MyAvatar may stand.
|
||||
MyAvatar::AllowAvatarStandingPreference MyAvatar::getAllowAvatarStandingPreference() const {
|
||||
return _allowAvatarStandingPreference.get();
|
||||
|
@ -5344,6 +5371,32 @@ void MyAvatar::setIsInSittingState(bool isSitting) {
|
|||
setSitStandStateChange(true);
|
||||
}
|
||||
|
||||
// Deprecated, will be removed.
|
||||
void MyAvatar::setUserRecenterModel(MyAvatar::SitStandModelType modelName) {
|
||||
qCDebug(interfaceapp)
|
||||
<< "MyAvatar.setUserRecenterModel is deprecated and will be removed. If you need it, please contact the developers.";
|
||||
|
||||
switch (modelName) {
|
||||
case SitStandModelType::ForceSit:
|
||||
setAllowAvatarStandingPreference(AllowAvatarStandingPreference::Always);
|
||||
setAllowAvatarLeaningPreference(AllowAvatarLeaningPreference::Never);
|
||||
break;
|
||||
case SitStandModelType::ForceStand:
|
||||
setAllowAvatarStandingPreference(AllowAvatarStandingPreference::Always);
|
||||
setAllowAvatarLeaningPreference(AllowAvatarLeaningPreference::Always);
|
||||
break;
|
||||
case SitStandModelType::Auto:
|
||||
default:
|
||||
setAllowAvatarStandingPreference(AllowAvatarStandingPreference::Always);
|
||||
setAllowAvatarLeaningPreference(AllowAvatarLeaningPreference::WhenUserIsStanding);
|
||||
break;
|
||||
case SitStandModelType::DisableHMDLean:
|
||||
setAllowAvatarStandingPreference(AllowAvatarStandingPreference::WhenUserIsStanding);
|
||||
setAllowAvatarLeaningPreference(AllowAvatarLeaningPreference::AlwaysNoRecenter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the user preference of when the avatar may stand.
|
||||
void MyAvatar::setAllowAvatarStandingPreference(const MyAvatar::AllowAvatarStandingPreference preference) {
|
||||
_allowAvatarStandingPreference.set(preference);
|
||||
|
@ -5353,6 +5406,13 @@ void MyAvatar::setAllowAvatarStandingPreference(const MyAvatar::AllowAvatarStand
|
|||
centerBodyInternal(false);
|
||||
}
|
||||
|
||||
// Deprecated, will be removed.
|
||||
void MyAvatar::setIsSitStandStateLocked(bool isLocked) {
|
||||
Q_UNUSED(isLocked);
|
||||
qCDebug(interfaceapp) << "MyAvatar.setIsSitStandStateLocked is deprecated and will be removed. If you need it, please "
|
||||
"contact the developers. See also: MyAvatar.setUserRecenterModel.";
|
||||
}
|
||||
|
||||
// Set the user preference of when the avatar may lean.
|
||||
void MyAvatar::setAllowAvatarLeaningPreference(const MyAvatar::AllowAvatarLeaningPreference preference) {
|
||||
_allowAvatarLeaningPreference.set(preference);
|
||||
|
|
|
@ -282,11 +282,18 @@ class MyAvatar : public Avatar {
|
|||
* <p><strong>Warning:</strong> Setting this value also sets the value of <code>analogPlusSprintSpeed</code> to twice
|
||||
* the value.</p>
|
||||
* @property {number} analogPlusSprintSpeed - The sprint (run) speed of your avatar for the "AnalogPlus" control scheme.
|
||||
* @property {MyAvatar.SitStandModelType} userRecenterModel - Controls avatar leaning and recentering behavior.
|
||||
* <p class="important">Deprecated: This property is deprecated and will be removed. If you need it, please contact
|
||||
* the developers.</p>
|
||||
* @property {boolean} isInSittingState - <code>true</code> if the user wearing the HMD is determined to be sitting;
|
||||
* <code>false</code> if the user wearing the HMD is determined to be standing. This can affect whether the avatar
|
||||
* is allowed to stand, lean or recenter its footing, depending on user preferences.
|
||||
* The property value automatically updates as the user sits or stands. Setting the property value overrides the current
|
||||
* sitting / standing state, which is updated when the user next sits or stands.
|
||||
* @property {boolean} isSitStandStateLocked - <code>true</code> to lock the avatar sitting/standing state, i.e., use this
|
||||
* to disable automatically changing state.
|
||||
* <p class="important">Deprecated: This property is deprecated and will be removed. If you need it, please contact
|
||||
* the developers. See also: <code>getUserRecenterModel</code> and <code>setUserRecenterModel</code>.</p>
|
||||
* @property {boolean} allowTeleporting - <code>true</code> if teleporting is enabled in the Interface settings,
|
||||
* <code>false</code> if it isn't. <em>Read-only.</em>
|
||||
*
|
||||
|
@ -408,6 +415,19 @@ class MyAvatar : public Avatar {
|
|||
Q_PROPERTY(float walkBackwardSpeed READ getWalkBackwardSpeed WRITE setWalkBackwardSpeed NOTIFY walkBackwardSpeedChanged);
|
||||
Q_PROPERTY(float sprintSpeed READ getSprintSpeed WRITE setSprintSpeed NOTIFY sprintSpeedChanged);
|
||||
Q_PROPERTY(bool isInSittingState READ getIsInSittingState WRITE setIsInSittingState);
|
||||
|
||||
/**jsdoc
|
||||
* @deprecated This property is deprecated and will be removed. If you need it, please contact the developers.
|
||||
*/
|
||||
Q_PROPERTY(MyAvatar::SitStandModelType userRecenterModel READ getUserRecenterModel WRITE setUserRecenterModel);
|
||||
|
||||
/**jsdoc
|
||||
* @deprecated This property is deprecated and will be removed. If you need it, please contact the developers.
|
||||
* See also: {@link MyAvatar.getUserRecenterModel|getUserRecenterModel} and
|
||||
* {@link MyAvatar.setUserRecenterModel|setUserRecenterModel}.
|
||||
*/
|
||||
Q_PROPERTY(bool isSitStandStateLocked READ getIsSitStandStateLocked WRITE setIsSitStandStateLocked);
|
||||
|
||||
Q_PROPERTY(bool allowTeleporting READ getAllowTeleporting)
|
||||
|
||||
const QString DOMINANT_LEFT_HAND = "left";
|
||||
|
@ -512,6 +532,8 @@ public:
|
|||
|
||||
/**jsdoc
|
||||
* <p>Specifies different avatar leaning and recentering behaviors.</p>
|
||||
* <p class="important">Deprecated: This enumeration is deprecated and will be removed. If you need it, please contact
|
||||
* the developers</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Name</th><th>Description</th></tr>
|
||||
|
@ -1769,6 +1791,10 @@ public:
|
|||
bool getIsInWalkingState() const;
|
||||
void setIsInSittingState(bool isSitting);
|
||||
bool getIsInSittingState() const;
|
||||
void setUserRecenterModel(MyAvatar::SitStandModelType modelName); // Deprecated, will be removed.
|
||||
MyAvatar::SitStandModelType getUserRecenterModel() const; // Deprecated, will be removed.
|
||||
void setIsSitStandStateLocked(bool isLocked); // Deprecated, will be removed.
|
||||
bool getIsSitStandStateLocked() const; // Deprecated, will be removed.
|
||||
void setAllowAvatarStandingPreference(const AllowAvatarStandingPreference preference);
|
||||
AllowAvatarStandingPreference getAllowAvatarStandingPreference() const;
|
||||
void setAllowAvatarLeaningPreference(const AllowAvatarLeaningPreference preference);
|
||||
|
|
Loading…
Reference in a new issue