diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index c374bd9d25..5349b82a0b 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -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(AllowAvatarLeaningPreference::Count)> legacySitStandModels = { + SitStandModelType::Auto, // AllowAvatarLeaningPreference::WhenUserIsStanding + SitStandModelType::ForceStand, // AllowAvatarLeaningPreference::Always + SitStandModelType::ForceSit, // AllowAvatarLeaningPreference::Never + SitStandModelType::DisableHMDLean // AllowAvatarLeaningPreference::AlwaysNoRecenter + }; + + return legacySitStandModels[static_cast(_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); diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index f424e3ba2c..b773f802d2 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -282,11 +282,18 @@ class MyAvatar : public Avatar { *

Warning: Setting this value also sets the value of analogPlusSprintSpeed to twice * the value.

* @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. + *

Deprecated: This property is deprecated and will be removed. If you need it, please contact + * the developers.

* @property {boolean} isInSittingState - true if the user wearing the HMD is determined to be sitting; * false 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 - true to lock the avatar sitting/standing state, i.e., use this + * to disable automatically changing state. + *

Deprecated: This property is deprecated and will be removed. If you need it, please contact + * the developers. See also: getUserRecenterModel and setUserRecenterModel.

* @property {boolean} allowTeleporting - true if teleporting is enabled in the Interface settings, * false if it isn't. Read-only. * @@ -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 *

Specifies different avatar leaning and recentering behaviors.

+ *

Deprecated: This enumeration is deprecated and will be removed. If you need it, please contact + * the developers

* * * @@ -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);
ValueNameDescription