diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index c74670bbed..e03015f3fd 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -106,18 +106,22 @@ class MyAvatar : public Avatar { * what causes your avatar to follow your HMD as you walk around the room, in room scale VR. Disabling this is useful * if you desire to pin the avatar to a fixed location. * @property collisionsEnabled {boolean} This can be used to disable collisions between the avatar and the world. + * @property {boolean} characterControllerEnabled * @property useAdvancedMovementControls {boolean} Stores the user preference only, does not change user mappings, this is * done in the default script, "toggleAdvancedMovementForHandControllers.js". + * @property {number} yawSpeed + * @property {number} pitchSpeed + * @property hmdRollControlEnabled {boolean} When enabled the roll angle of your HMD will turn your avatar while flying. + * @property hmdRollControlDeadZone {number} If hmdRollControlEnabled is true, this value can be used to tune what roll + * angle is required to begin turning. This angle is specified in degrees. + * @property hmdRollControlRate {number} If hmdRollControlEnabled is true, this value determines the maximum turn rate of + * your avatar when rolling your HMD in degrees per second. * @property userHeight {number} The height of the user in sensor space. * @property userEyeHeight {number} Estimated height of the users eyes in sensor space. - * @property SELF_ID {string} UUID representing "my avatar". Only use for local-only entities and overlays in situations + * @property SELF_ID {Uuid} UUID representing "my avatar". Only use for local-only entities and overlays in situations * where MyAvatar.sessionUUID is not available (e.g., if not connected to a domain). Note: Likely to be deprecated. * Read-only. - * @property hmdRollControlEnabled {boolean} When enabled the roll angle of your HMD will turn your avatar while flying. - * @property hmdRollControlDeadZone {number} If hmdRollControlEnabled is true, this value can be used to tune what roll - * angle is required to begin turning. This angle is specified in degrees. - * @property hmdRollControlRate {number} If hmdRollControlEnabled is true, this value determines the maximum turn rate of - * your avatar when rolling your HMD in degrees per second. + * @property {number} walkSpeed * * @property {Vec3} skeletonOffset - Can be used to apply a translation offset between the avatar's position and the * registration point of the 3D model. @@ -240,6 +244,9 @@ public: void reset(bool andRecenter = false, bool andReload = true, bool andHead = true); + /**jsdoc + * @function MyAvatar.resetSensorsAndBody + */ Q_INVOKABLE void resetSensorsAndBody(); /**jsdoc @@ -264,7 +271,16 @@ public: const glm::vec3& getHMDSensorPosition() const { return _hmdSensorPosition; } const glm::quat& getHMDSensorOrientation() const { return _hmdSensorOrientation; } + /**jsdoc + * @function MyAvatar.setOrientationVar + * @param {object} newOrientationVar + */ Q_INVOKABLE void setOrientationVar(const QVariant& newOrientationVar); + + /**jsdoc + * @function MyAvatar.getOrientationVar + * @returns {object} + */ Q_INVOKABLE QVariant getOrientationVar() const; // A method intended to be overriden by MyAvatar for polling orientation for network transmission. @@ -415,18 +431,58 @@ public: // a handler must not remove properties from animStateDictionaryIn, nor change property values that it does not intend to change. // It is not specified in what order multiple handlers are called. Q_INVOKABLE QScriptValue addAnimationStateHandler(QScriptValue handler, QScriptValue propertiesList) { return _skeletonModel->getRig().addAnimationStateHandler(handler, propertiesList); } + + /**jsdoc + * @function MyAvatar.removeAnimationStateHandler + * @param {number} handler + */ // Removes a handler previously added by addAnimationStateHandler. Q_INVOKABLE void removeAnimationStateHandler(QScriptValue handler) { _skeletonModel->getRig().removeAnimationStateHandler(handler); } + + /**jsdoc + * @function MyAvatar.getSnapTurn + * @returns {boolean} + */ Q_INVOKABLE bool getSnapTurn() const { return _useSnapTurn; } + /**jsdoc + * @function MyAvatar.setSnapTurn + * @param {boolean} on + */ Q_INVOKABLE void setSnapTurn(bool on) { _useSnapTurn = on; } + /**jsdoc + * @function MyAvatar.getClearOverlayWhenMoving + * @returns {boolean} + */ Q_INVOKABLE bool getClearOverlayWhenMoving() const { return _clearOverlayWhenMoving; } + /**jsdoc + * @function MyAvatar.setClearOverlayWhenMoving + * @returns {boolean} + */ Q_INVOKABLE void setClearOverlayWhenMoving(bool on) { _clearOverlayWhenMoving = on; } + + /**jsdoc + * @function MyAvatar.setDominantHand + * @param {string} hand + */ Q_INVOKABLE void setDominantHand(const QString& hand); + /**jsdoc + * @function MyAvatar.getDominantHand + * @returns {string} + */ Q_INVOKABLE QString getDominantHand() const { return _dominantHand; } + + /**jsdoc + * @function MyAvatar.setHMDLeanRecenterEnabled + * @param {boolean} enabled + */ Q_INVOKABLE void setHMDLeanRecenterEnabled(bool value) { _hmdLeanRecenterEnabled = value; } + /**jsdoc + * @function MyAvatar.getHMDLeanRecenterEnabled + * @returns {boolean} + */ Q_INVOKABLE bool getHMDLeanRecenterEnabled() const { return _hmdLeanRecenterEnabled; } bool useAdvancedMovementControls() const { return _useAdvancedMovementControls.get(); } @@ -452,13 +508,35 @@ public: void setDriveKey(DriveKeys key, float val); void setSprintMode(bool sprint); float getDriveKey(DriveKeys key) const; + + /**jsdoc + * @function MyAvatar.getRawDriveKey + * @param {DriveKeys} key + * @returns {number} + */ Q_INVOKABLE float getRawDriveKey(DriveKeys key) const; + void relayDriveKeysToCharacterController(); + /**jsdoc + * @function MyAvatar.disableDriveKey + * @param {DriveKeys} key + */ Q_INVOKABLE void disableDriveKey(DriveKeys key); + + /**jsdoc + * @function MyAvatar.enableDriveKey + * @param {DriveKeys} key + */ Q_INVOKABLE void enableDriveKey(DriveKeys key); + /**jsdoc + * @function MyAvatar.isDriveKeyDisabled + * @param {DriveKeys} key + * @returns {boolean} + */ Q_INVOKABLE bool isDriveKeyDisabled(DriveKeys key) const; + /**jsdoc *The triggerVerticalRecenter function activates one time the recentering *behaviour in the vertical direction. This call is only takes effect when the property @@ -495,9 +573,29 @@ public: * print(JSON.stringify(MyAvatar.getHeadPosition())); */ Q_INVOKABLE glm::vec3 getHeadPosition() const { return getHead()->getPosition(); } + + /**jsdoc + * @function MyAvatar.getHeadFinalYaw + * @returns {number} + */ Q_INVOKABLE float getHeadFinalYaw() const { return getHead()->getFinalYaw(); } + + /**jsdoc + * @function MyAvatar.getHeadFinalRoll + * @returns {number} + */ Q_INVOKABLE float getHeadFinalRoll() const { return getHead()->getFinalRoll(); } + + /**jsdoc + * @function MyAvatar.getHeadFinalPitch + * @returns {number} + */ Q_INVOKABLE float getHeadFinalPitch() const { return getHead()->getFinalPitch(); } + + /**jsdoc + * @function MyAvatar.getHeadDeltaPitch + * @returns {number} + */ Q_INVOKABLE float getHeadDeltaPitch() const { return getHead()->getDeltaPitch(); } /**jsdoc @@ -517,6 +615,11 @@ public: * print(JSON.stringify(MyAvatar.getTargetAvatarPosition())); */ Q_INVOKABLE glm::vec3 getTargetAvatarPosition() const { return _targetAvatarPosition; } + + /**jsdoc + * @function MyAvatar.getTargetAvatar + * @returns {AvatarData} + */ Q_INVOKABLE ScriptAvatarData* getTargetAvatar() const; @@ -543,7 +646,17 @@ public: * print(JSON.stringify(MyAvatar.getLeftHandPosition())); */ Q_INVOKABLE glm::vec3 getRightHandPosition() const; + + /**jsdoc + * @function MyAvatar.getLeftHandTipPosition + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 getLeftHandTipPosition() const; + + /**jsdoc + * @function MyAvatar.getRightHandTipPosition + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 getRightHandTipPosition() const; @@ -572,16 +685,67 @@ public: * print(JSON.stringify(MyAvatar.getRightHandPose())); */ Q_INVOKABLE controller::Pose getRightHandPose() const; + + /**jsdoc + * @function MyAvatar.getLeftHandTipPose + * @returns {Pose} + */ Q_INVOKABLE controller::Pose getLeftHandTipPose() const; + + /**jsdoc + * @function MyAvatar.getRightHandTipPose + * @returns {Pose} + */ Q_INVOKABLE controller::Pose getRightHandTipPose() const; // world-space to avatar-space rigconversion functions + /**jsdoc + * @function MyAvatar.worldToJointPoint + * @param {Vec3} position + * @param {number} [jointIndex=-1] + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 worldToJointPoint(const glm::vec3& position, const int jointIndex = -1) const; + + /**jsdoc + * @function MyAvatar.worldToJointDirection + * @param {Vec3} direction + * @param {number} [jointIndex=-1] + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 worldToJointDirection(const glm::vec3& direction, const int jointIndex = -1) const; + + /**jsdoc + * @function MyAvatar.worldToJointRotation + * @param {Quat} rotation + * @param {number} [jointIndex=-1] + * @returns {Quat} + */ Q_INVOKABLE glm::quat worldToJointRotation(const glm::quat& rotation, const int jointIndex = -1) const; + + /**jsdoc + * @function MyAvatar.jointToWorldPoint + * @param {vec3} position + * @param {number} [jointIndex=-1] + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 jointToWorldPoint(const glm::vec3& position, const int jointIndex = -1) const; + + /**jsdoc + * @function MyAvatar.jointToWorldDirection + * @param {Vec3} direction + * @param {number} [jointIndex=-1] + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 jointToWorldDirection(const glm::vec3& direction, const int jointIndex = -1) const; + + /**jsdoc + * @function MyAvatar.jointToWorldRotation + * @param {Quat} rotation + * @param {number} [jointIndex=-1] + * @returns {Quat} + */ Q_INVOKABLE glm::quat jointToWorldRotation(const glm::quat& rotation, const int jointIndex = -1) const; AvatarWeakPointer getLookAtTargetAvatar() const { return _lookAtTargetAvatar; } @@ -600,12 +764,35 @@ public: virtual void clearJointData(const QString& name) override; virtual void clearJointsData() override; + /**jsdoc + * @function MyAvatar.pinJoint + * @param {number} index + * @param {Vec3} position + * @param {Quat} orientation + * @returns {boolean} + */ Q_INVOKABLE bool pinJoint(int index, const glm::vec3& position, const glm::quat& orientation); + bool isJointPinned(int index); + + /**jsdoc + * @function MyAvatar.clearPinOnJoint + * @param {number} index + * @returns {boolean} + */ Q_INVOKABLE bool clearPinOnJoint(int index); + /**jsdoc + * @function MyAvatar.getIKErrorOnLastSolve + * @returns {number} + */ Q_INVOKABLE float getIKErrorOnLastSolve() const; + /**jsdoc + * @function MyAvatar.useFullAvatarURL + * @param {string} fullAvatarURL + * @param {string} [modelName=""] + */ Q_INVOKABLE void useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelName = QString()); /**jsdoc @@ -683,17 +870,68 @@ public: QVariantList getAvatarEntitiesVariant(); void removeAvatarEntities(); + /**jsdoc + * @function MyAvatar.isFlying + * @returns {boolean} + */ Q_INVOKABLE bool isFlying(); + + /**jsdoc + * @function MyAvatar.isInAir + * @returns {boolean} + */ Q_INVOKABLE bool isInAir(); + + /**jsdoc + * @function MyAvatar.setFlyingEnabled + * @param {boolean} enabled + */ Q_INVOKABLE void setFlyingEnabled(bool enabled); + + /**jsdoc + * @function MyAvatar.getFlyingEnabled + * @returns {boolean} + */ Q_INVOKABLE bool getFlyingEnabled(); + + /**jsdoc + * @function MyAvatar.getAvatarScale + * @returns {number} + */ Q_INVOKABLE float getAvatarScale(); + + /**jsdoc + * @function MyAvatar.setAvatarScale + * @param {number} scale + */ Q_INVOKABLE void setAvatarScale(float scale); + + /**jsdoc + * @function MyAvatar.setCollisionsEnabled + * @param {boolean} enabled + */ Q_INVOKABLE void setCollisionsEnabled(bool enabled); + + /**jsdoc + * @function MyAvatar.getCollisionsEnabled + * @returns {boolean} + */ Q_INVOKABLE bool getCollisionsEnabled(); + + /**jsdoc + * @function MyAvatar.setCharacterControllerEnabled + * @param {boolean} enabled + * @deprecated + */ Q_INVOKABLE void setCharacterControllerEnabled(bool enabled); // deprecated + + /**jsdoc + * @function MyAvatar.getCharacterControllerEnabled + * @returns {boolean} + * @deprecated + */ Q_INVOKABLE bool getCharacterControllerEnabled(); // deprecated virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override; @@ -719,7 +957,18 @@ public: // results are in HMD frame glm::mat4 deriveBodyFromHMDSensor() const; + /**jsdoc + * @function MyAvatar.isUp + * @param {Vec3} direction + * @returns {boolean} + */ Q_INVOKABLE bool isUp(const glm::vec3& direction) { return glm::dot(direction, _worldUpDirection) > 0.0f; }; // true iff direction points up wrt avatar's definition of up. + + /**jsdoc + * @function MyAvatar.isDown + * @param {Vec3} direction + * @returns {boolean} + */ Q_INVOKABLE bool isDown(const glm::vec3& direction) { return glm::dot(direction, _worldUpDirection) < 0.0f; }; void setUserHeight(float value); @@ -767,9 +1016,21 @@ public slots: */ void resetSize(); + /**jsdoc + * @function MyAvatar.animGraphLoaded + */ void animGraphLoaded(); + /**jsdoc + * @function MyAvatar.setGravity + * @param {number} gravity + */ void setGravity(float gravity); + + /**jsdoc + * @function MyAvatar.getGravity + * @returns {number} + */ float getGravity(); /**jsdoc @@ -789,27 +1050,103 @@ public slots: * @param {object} properties */ void goToLocation(const QVariant& properties); + + /**jsdoc + * @function MyAvatar.goToLocationAndEnableCollisions + * @param {Vec3} position + */ void goToLocationAndEnableCollisions(const glm::vec3& newPosition); + + /**jsdoc + * @function MyAvatar.safeLanding + * @param {Vec3} position + * @returns {boolean} + */ bool safeLanding(const glm::vec3& position); + + /**jsdoc + * @function MyAvatar.restrictScaleFromDomainSettings + * @param {objecct} domainSettingsObject + */ void restrictScaleFromDomainSettings(const QJsonObject& domainSettingsObject); + + /**jsdoc + * @function MyAvatar.clearScaleRestriction + */ void clearScaleRestriction(); + + /**jsdoc + * @function MyAvatar.addThrust + * @param {Vec3} thrust + */ // Set/Get update the thrust that will move the avatar around void addThrust(glm::vec3 newThrust) { _thrust += newThrust; }; + + /**jsdoc + * @function MyAvatar.getThrust + * @returns {vec3} + */ glm::vec3 getThrust() { return _thrust; }; + + /**jsdoc + * @function MyAvatar.setThrust + * @param {Vec3} thrust + */ void setThrust(glm::vec3 newThrust) { _thrust = newThrust; } + + /**jsdoc + * @function MyAvatar.updateMotionBehaviorFromMenu + */ Q_INVOKABLE void updateMotionBehaviorFromMenu(); + + /**jsdoc + * @function MyAvatar.setEnableDebugDrawDefaultPose + * @param {boolean} enabled + */ void setEnableDebugDrawDefaultPose(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawAnimPose + * @param {boolean} enabled + */ void setEnableDebugDrawAnimPose(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawPosition + * @param {boolean} enabled + */ void setEnableDebugDrawPosition(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawHandControllers + * @param {boolean} enabled + */ void setEnableDebugDrawHandControllers(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawSensorToWorldMatrix + * @param {boolean} enabled + */ void setEnableDebugDrawSensorToWorldMatrix(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawIKTargets + * @param {boolean} enabled + */ void setEnableDebugDrawIKTargets(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawIKConstraints + * @param {boolean} enabled + */ void setEnableDebugDrawIKConstraints(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawIKChains + * @param {boolean} enabled + */ void setEnableDebugDrawIKChains(bool isEnabled); + /**jsdoc + * @function MyAvatar.setEnableDebugDrawDetailedCollision + * @param {boolean} enabled + */ void setEnableDebugDrawDetailedCollision(bool isEnabled); /**jsdoc @@ -830,21 +1167,77 @@ public slots: * }, 10000); */ void setEnableMeshVisible(bool isEnabled); + + /**jsdoc + * @function MyAvatar.setEnableInverseKinematics + * @param {boolean} enabled + */ void setEnableInverseKinematics(bool isEnabled); + + /**jsdoc + * @function MyAvatar.getAnimGraphOverrideUrl + * @returns {string} + */ QUrl getAnimGraphOverrideUrl() const; // thread-safe + + /**jsdoc + * @function MyAvatar.setAnimGraphOverrideUrl + * @param {string} url + */ void setAnimGraphOverrideUrl(QUrl value); // thread-safe + + /**jsdoc + * @function MyAvatar.getAnimGraphUrl + * @returns {string} + */ QUrl getAnimGraphUrl() const; // thread-safe + + /**jsdoc + * @function MyAvatar.setAnimGraphUrl + * @param {string} url + */ void setAnimGraphUrl(const QUrl& url); // thread-safe + + /**jsdoc + * @function MyAvatar.getPositionForAudio + * @returns {Vec3} + */ glm::vec3 getPositionForAudio(); + + /**jsdoc + * @function MyAvatar.getOrientationForAudio + * @returns {Quat} + */ glm::quat getOrientationForAudio(); + + /**jsdoc + * @function MyAvatar.setModelScale + * @param {number} scale + */ virtual void setModelScale(float scale) override; signals: + + /**jsdoc + * @function MyAvatar.audioListenerModeChanged + * @returns {Signal} + */ void audioListenerModeChanged(); + + /**jsdoc + * @function MyAvatar.transformChanged + * @returns {Signal} + */ void transformChanged(); + + /**jsdoc + * @function MyAvatar.newCollisionSoundURL + * @param {string} url + * @returns {Signal} + */ void newCollisionSoundURL(const QUrl& url); /**jsdoc @@ -858,15 +1251,68 @@ signals: * }); */ void collisionWithEntity(const Collision& collision); + + /**jsdoc + * @function MyAvatar.energyChanged + * @param {number} energy + * @returns {Signal} + */ void energyChanged(float newEnergy); + + /**jsdoc + * @function MyAvatar.positionGoneTo + * @returns {Signal} + */ void positionGoneTo(); + + /**jsdoc + * @function MyAvatar.onLoadComplete + * @returns {Signal} + */ void onLoadComplete(); + + /**jsdoc + * @function MyAvatar.wentAway + * @returns {Signal} + */ void wentAway(); + + /**jsdoc + * @function MyAvatar.wentActive + * @returns {Signal} + */ void wentActive(); + + /**jsdoc + * @function MyAvatar.skeletonChanged + * @returns {Signal} + */ void skeletonChanged(); + + /**jsdoc + * @function MyAvatar.dominantHandChanged + * @param {string} hand + * @returns {Signal} + */ void dominantHandChanged(const QString& hand); + + /**jsdoc + * @function MyAvatar.sensorToWorldScaleChanged + * @param {number} scale + * @returns {Signal} + */ void sensorToWorldScaleChanged(float sensorToWorldScale); + + /**jsdoc + * @function MyAvatar.attachmentsChanged + * @returns {Signal} + */ void attachmentsChanged(); + + /**jsdoc + * @function MyAvatar.scaleChanged + * @returns {Signal} + */ void scaleChanged(); private slots: diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h index 38f72609d1..6ad056c97f 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h @@ -120,7 +120,18 @@ public: virtual int getJointIndex(const QString& name) const override; virtual QStringList getJointNames() const override; + /**jsdoc + * @function MyAvatar.getDefaultJointRotation + * @param {number} index + * @returns {Quat} + */ Q_INVOKABLE virtual glm::quat getDefaultJointRotation(int index) const; + + /**jsdoc + * @function MyAvatar.getDefaultJointTranslation + * @param {number} index + * @returns {Vec3} + */ Q_INVOKABLE virtual glm::vec3 getDefaultJointTranslation(int index) const; /**jsdoc @@ -217,6 +228,10 @@ public: */ Q_INVOKABLE glm::vec3 getNeckPosition() const; + /**jsdoc + * @function MyAvatar.getAcceleration + * @returns {Vec3} + */ Q_INVOKABLE glm::vec3 getAcceleration() const { return _acceleration; } /// Scales a world space position vector relative to the avatar position and scale @@ -240,12 +255,36 @@ public: void setPositionViaScript(const glm::vec3& position) override; void setOrientationViaScript(const glm::quat& orientation) override; - // these call through to the SpatiallyNestable versions, but they are here to expose these to javascript. + + /**jsdoc + * @function MyAvatar.getParentID + * @returns {Uuid} + */ + // This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript. Q_INVOKABLE virtual const QUuid getParentID() const override { return SpatiallyNestable::getParentID(); } + + /**jsdoc + * @function MyAvatar.setParentID + * @param {Uuid} parentID + */ + // This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript. Q_INVOKABLE virtual void setParentID(const QUuid& parentID) override; + + /**jsdoc + * @function MyAvatar.getParentJointIndex + * @returns {number} + */ + // This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript. Q_INVOKABLE virtual quint16 getParentJointIndex() const override { return SpatiallyNestable::getParentJointIndex(); } + + /**jsdoc + * @function MyAvatar.setParentJointIndex + * @param {number} parentJointIndex + */ + // This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript. Q_INVOKABLE virtual void setParentJointIndex(quint16 parentJointIndex) override; + /**jsdoc * Returns an array of joints, where each joint is an object containing name, index, and parentIndex fields. * @function MyAvatar.getSkeleton @@ -273,6 +312,11 @@ public: void setTargetScale(float targetScale) override; float getTargetScale() const { return _targetScale; } + /**jsdoc + * @function MyAvatar.getSimulationRate + * @param {string} [rateName=""] + * @returns {number} + */ Q_INVOKABLE float getSimulationRate(const QString& rateName = QString("")) const; bool hasNewJointData() const { return _hasNewJointData; } @@ -294,6 +338,7 @@ public: bool isFading() const { return _isFading; } void updateFadingStatus(render::ScenePointer scene); + // JSDoc is in AvatarData.h. Q_INVOKABLE virtual float getEyeHeight() const override; // returns eye height of avatar in meters, ignoring avatar scale. @@ -359,8 +404,18 @@ public slots: // hooked up to Model::setURLFinished signal void setModelURLFinished(bool success); - // hooked up to Model::rigReady & rigReset signals + /**jsdoc + * @function MyAvatar.rigReady + * @returns {Signal} + */ + // Hooked up to Model::rigReady signal void rigReady(); + + /**jsdoc + * @function MyAvatar.rigReset + * @returns {Signal} + */ + // Jooked up to Model::rigReset signal void rigReset(); protected: diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index cc34d560b5..0262143621 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -548,11 +548,24 @@ public: void setDomainMinimumHeight(float domainMinimumHeight); void setDomainMaximumHeight(float domainMaximumHeight); - // Hand State + /**jsdoc + * @function MyAvatar.setHandState + * @param {string} state + */ Q_INVOKABLE void setHandState(char s) { _handState = s; } + + /**jsdoc + * @function MyAvatar.getHandState + * @returns {string} + */ Q_INVOKABLE char getHandState() const { return _handState; } const QVector& getRawJointData() const { return _jointData; } + + /**jsdoc + * @function MyAvatar.setRawJointData + * @param {JointData[]} data + */ Q_INVOKABLE void setRawJointData(QVector data); /**jsdoc @@ -618,6 +631,12 @@ public: * @param {number} index - The index of the joint. */ Q_INVOKABLE virtual void clearJointData(int index); + + /**jsdoc + * @function MyAvatar.isJointDataValid + * @param {number} index + * @returns {boolean} + */ Q_INVOKABLE bool isJointDataValid(int index) const; /**jsdoc @@ -724,6 +743,12 @@ public: * }, 5000); */ Q_INVOKABLE virtual void clearJointData(const QString& name); + + /**jsdoc + * @function MyAvatar.isJointDataValid + * @param {string} name + * @returns {boolean} + */ Q_INVOKABLE virtual bool isJointDataValid(const QString& name) const; /**jsdoc @@ -757,6 +782,11 @@ public: * print(JSON.stringify(MyAvatar.getJointRotations())); */ Q_INVOKABLE virtual QVector getJointRotations() const; + + /**jsdoc + * @function MyAvatar.getJointTranslations + * @returns {Vec3[]} + */ Q_INVOKABLE virtual QVector getJointTranslations() const; /**jsdoc @@ -795,6 +825,11 @@ public: * }, 5000); */ Q_INVOKABLE virtual void setJointRotations(const QVector& jointRotations); + + /**jsdoc + * @function MyAvatar.setJointTranslations + * @param {Vec3[]} translations + */ Q_INVOKABLE virtual void setJointTranslations(const QVector& jointTranslations); /**jsdoc @@ -838,14 +873,45 @@ public: */ Q_INVOKABLE virtual QStringList getJointNames() const; + + /**jsdoc + * @function MyAvatar.setBlendshape + * @param {string} name + * @param {number} value + */ Q_INVOKABLE void setBlendshape(QString name, float val) { _headData->setBlendshape(name, val); } + + /**jsdoc + * @function MyAvatar.getAttachmentsVariant + * @returns {object} + */ Q_INVOKABLE QVariantList getAttachmentsVariant() const; + + /**jsdoc + * @function MyAvatar.setAttachmentsVariant + * @param {object} variant + */ Q_INVOKABLE void setAttachmentsVariant(const QVariantList& variant); + + /**jsdoc + * @function MyAvatar.updateAvatarEntity + * @param {Uuid} entityID + * @param {string} entityData + */ Q_INVOKABLE void updateAvatarEntity(const QUuid& entityID, const QByteArray& entityData); + /**jsdoc + * @function MyAvatar.clearAvatarEntity + * @param {Uuid} entityID + */ Q_INVOKABLE void clearAvatarEntity(const QUuid& entityID); + + /**jsdoc + * @function MyAvatar.setForceFaceTrackerConnected + * @param {boolean} connected + */ Q_INVOKABLE void setForceFaceTrackerConnected(bool connected) { _forceFaceTrackerConnected = connected; } // key state @@ -994,19 +1060,63 @@ public: glm::vec3 getClientGlobalPosition() const { return _globalPosition; } glm::vec3 getGlobalBoundingBoxCorner() const { return _globalPosition + _globalBoundingBoxOffset - _globalBoundingBoxDimensions; } + /**jsdoc + * @function MyAvatar.getAvatarEntityData + * @returns {object} + */ Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const; + + /**jsdoc + * @function MyAvatar.setAvatarEntityData + * @param {object} avatarEntityData + */ Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData); + virtual void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; } void insertDetachedEntityID(const QUuid entityID); AvatarEntityIDs getAndClearRecentlyDetachedIDs(); + /**jsdoc + * @function MyAvatar.getSensorToWorldMatrix + * @returns {Mat4} + */ // thread safe Q_INVOKABLE glm::mat4 getSensorToWorldMatrix() const; + + /**jsdoc + * @function MyAvatar.getSensorToWorldScale + * @returns {number} + */ + // thread safe Q_INVOKABLE float getSensorToWorldScale() const; + + /**jsdoc + * @function MyAvatar.getControllerLeftHandMatrix + * @returns {Mat4} + */ + // thread safe Q_INVOKABLE glm::mat4 getControllerLeftHandMatrix() const; + + /**jsdoc + * @function MyAvatar.getControllerRightHandMatrix + * @returns {Mat4} + */ + // thread safe Q_INVOKABLE glm::mat4 getControllerRightHandMatrix() const; + + /**jsdoc + * @function MyAvatar.getDataRate + * @param {string} [rateName=""] + * @returns {number} + */ Q_INVOKABLE float getDataRate(const QString& rateName = QString("")) const; + + /**jsdoc + * @function MyAvatar.getUpdateRate + * @param {string} [rateName=""] + * @returns {number} + */ Q_INVOKABLE float getUpdateRate(const QString& rateName = QString("")) const; int getJointCount() const { return _jointData.size(); } @@ -1042,17 +1152,55 @@ public: virtual void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {} signals: + + /**jsdoc + * @function MyAvatar.displayNameChanged + */ void displayNameChanged(); + + /**jsdoc + * @function MyAvatar.sessionDisplayNameChanged + */ void sessionDisplayNameChanged(); + + /**jsdoc + * @function MyAvatar.skeletonModelURLChanged + */ void skeletonModelURLChanged(); + + /**jsdoc + * @function MyAvatar.lookAtSnappingChanged + * @param {boolean} enabled + */ void lookAtSnappingChanged(bool enabled); + + /**jsdoc + * @function MyAvatar.sessionUUIDChanged + */ void sessionUUIDChanged(); public slots: + +/**jsdoc + * @function MyAvatar.sendAvatarDataPacket + * @param {boolean} [sendAll=false] + */ void sendAvatarDataPacket(bool sendAll = false); + + /**jsdoc + * @function MyAvatar.sendIdentityPacket + */ void sendIdentityPacket(); + /**jsdoc + * @function MyAvatar.setJointMappingsFromNetworkReply + */ void setJointMappingsFromNetworkReply(); + + /**jsdoc + * @function MyAvatar.setSessionUUID + * @param {Uuid} sessionUUID + */ virtual void setSessionUUID(const QUuid& sessionUUID) { if (sessionUUID != getID()) { if (sessionUUID == QUuid()) { @@ -1064,13 +1212,45 @@ public slots: } } + /**jsdoc + * @function MyAvatar.getAbsoluteJointRotationInObjectFrame + * @param {number} index + * @returns {Quat} + */ virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override; + + /**jsdoc + * @function MyAvatar.getAbsoluteJointTranslationInObjectFrame + * @param {number} index + * @returns {Vec3} + */ virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override; + + /**jsdoc + * @function MyAvatar.setAbsoluteJointRotationInObjectFrame + * @param {number} index + * @param {Quat} rotation + * @returns {boolean} + */ virtual bool setAbsoluteJointRotationInObjectFrame(int index, const glm::quat& rotation) override { return false; } + + /**jsdoc + * @function MyAvatar.setAbsoluteJointTranslationInObjectFrame + * @param {number} index + * @param {Vec3} translation + * @returns {boolean} + */ virtual bool setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) override { return false; } + /**jsdoc + * @function MyAvatar.getTargetScale + * @returns {number} + */ float getTargetScale() const { return _targetScale; } // why is this a slot? + /**jsdoc + * @function MyAvatar.resetLastSent + */ void resetLastSent() { _lastToByteArray = 0; } protected: