Use MyAvatar.SELF_ID instead of Uuid.SELF

This commit is contained in:
David Rowe 2017-10-17 15:58:51 +13:00
parent 1e3a2b3e4e
commit ed1c974f75
6 changed files with 16 additions and 15 deletions

View file

@ -106,6 +106,8 @@ class MyAvatar : public Avatar {
* "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js".
* @property userHeight {number} The height of the user in sensor space. (meters).
* @property userEyeHeight {number} Estimated height of the users eyes in sensor space. (meters)
* @property SELF_ID {string} READ-ONLY. 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.
*/
// FIXME: `glm::vec3 position` is not accessible from QML, so this exposes position in a QML-native type
@ -152,6 +154,8 @@ class MyAvatar : public Avatar {
Q_PROPERTY(float userHeight READ getUserHeight WRITE setUserHeight)
Q_PROPERTY(float userEyeHeight READ getUserEyeHeight)
Q_PROPERTY(QString SELF_ID READ SELF_UUID CONSTANT)
const QString DOMINANT_LEFT_HAND = "left";
const QString DOMINANT_RIGHT_HAND = "right";
@ -648,8 +652,6 @@ private:
void setVisibleInSceneIfReady(Model* model, const render::ScenePointer& scene, bool visiblity);
private:
virtual void updatePalms() override {}
void lateUpdatePalms();
@ -826,6 +828,9 @@ private:
// height of user in sensor space, when standing erect.
ThreadSafeValueCache<float> _userHeight { DEFAULT_AVATAR_HEIGHT };
const QString SELF_UUID() { return SELF_ID; }
const QString SELF_ID { AVATAR_SELF_ID.toString() };
};
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);

View file

@ -21,7 +21,6 @@
class ScriptUUID : public QObject, protected QScriptable {
Q_OBJECT
Q_PROPERTY(QString NULL READ NULL_UUID CONSTANT) // String for use in scripts.
Q_PROPERTY(QString SELF READ SELF_UUID CONSTANT)
public slots:
QUuid fromString(const QString& string);
@ -33,10 +32,7 @@ public slots:
private:
const QString NULL_UUID() { return NULL_ID; }
const QString SELF_UUID() { return SELF_ID; }
const QString NULL_ID{ "{00000000-0000-0000-0000-000000000000}" };
const QString SELF_ID{ AVATAR_SELF_ID.toString() };
const QString NULL_ID { "{00000000-0000-0000-0000-000000000000}" };
};
#endif // hifi_ScriptUUID_h

View file

@ -43,7 +43,7 @@ var OVERLAY_DATA_HMD = {
scale: 2 * MyAvatar.sensorToWorldScale,
emissive: true,
drawInFront: true,
parentID: Uuid.SELF,
parentID: MyAvatar.SELF_ID,
parentJointIndex: CAMERA_MATRIX
};

View file

@ -176,7 +176,7 @@ createControllerDisplay = function(config) {
dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions),
localRotation: controller.rotation,
localPosition: Vec3.multiply(sensorScaleFactor, position),
parentID: Uuid.SELF,
parentID: MyAvatar.SELF_ID,
parentJointIndex: controller.jointIndex,
ignoreRayIntersection: true
});
@ -196,7 +196,7 @@ createControllerDisplay = function(config) {
url: part.modelURL,
localPosition: partPosition,
localRotation: innerRotation,
parentID: Uuid.SELF,
parentID: MyAvatar.SELF_ID,
parentJointIndex: controller.jointIndex,
ignoreRayIntersection: true
};

View file

@ -99,7 +99,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
"grabbableKey": {"grabbable": true}
}),
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth },
parentID: Uuid.SELF,
parentID: MyAvatar.SELF_ID,
visible: visible
};
@ -470,7 +470,7 @@ WebTablet.prototype.register = function() {
WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, jointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.SELF_ID, jointIndex));
children.forEach(function(childID) {
var props = Entities.getEntityProperties(childID, ["name"]);
if (props.name === "WebTablet Tablet") {

View file

@ -311,19 +311,19 @@ findHandChildEntities = function(hand) {
// find children of avatar's hand joint
var handJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "RightHand" : "LeftHand");
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, handJointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, handJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.SELF_ID, handJointIndex));
// find children of faux controller joint
var controllerJointIndex = getControllerJointIndex(hand);
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, controllerJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.SELF_ID, controllerJointIndex));
// find children of faux camera-relative controller joint
var controllerCRJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ?
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerCRJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, controllerCRJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.SELF_ID, controllerCRJointIndex));
return children.filter(function (childID) {
var childType = Entities.getNestableType(childID);