mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:37:46 +02:00
Use MyAvatar.SELF_ID instead of Uuid.SELF
This commit is contained in:
parent
1e3a2b3e4e
commit
ed1c974f75
6 changed files with 16 additions and 15 deletions
|
@ -106,6 +106,8 @@ class MyAvatar : public Avatar {
|
||||||
* "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js".
|
* "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js".
|
||||||
* @property userHeight {number} The height of the user in sensor space. (meters).
|
* @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 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
|
// FIXME: `glm::vec3 position` is not accessible from QML, so this exposes position in a QML-native type
|
||||||
|
@ -153,6 +155,8 @@ class MyAvatar : public Avatar {
|
||||||
Q_PROPERTY(float userHeight READ getUserHeight WRITE setUserHeight)
|
Q_PROPERTY(float userHeight READ getUserHeight WRITE setUserHeight)
|
||||||
Q_PROPERTY(float userEyeHeight READ getUserEyeHeight)
|
Q_PROPERTY(float userEyeHeight READ getUserEyeHeight)
|
||||||
|
|
||||||
|
Q_PROPERTY(QString SELF_ID READ SELF_UUID CONSTANT)
|
||||||
|
|
||||||
const QString DOMINANT_LEFT_HAND = "left";
|
const QString DOMINANT_LEFT_HAND = "left";
|
||||||
const QString DOMINANT_RIGHT_HAND = "right";
|
const QString DOMINANT_RIGHT_HAND = "right";
|
||||||
|
|
||||||
|
@ -648,8 +652,6 @@ private:
|
||||||
|
|
||||||
void setVisibleInSceneIfReady(Model* model, const render::ScenePointer& scene, bool visiblity);
|
void setVisibleInSceneIfReady(Model* model, const render::ScenePointer& scene, bool visiblity);
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
virtual void updatePalms() override {}
|
virtual void updatePalms() override {}
|
||||||
void lateUpdatePalms();
|
void lateUpdatePalms();
|
||||||
|
|
||||||
|
@ -826,6 +828,9 @@ private:
|
||||||
|
|
||||||
// height of user in sensor space, when standing erect.
|
// height of user in sensor space, when standing erect.
|
||||||
ThreadSafeValueCache<float> _userHeight { DEFAULT_AVATAR_HEIGHT };
|
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);
|
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
class ScriptUUID : public QObject, protected QScriptable {
|
class ScriptUUID : public QObject, protected QScriptable {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString NULL READ NULL_UUID CONSTANT) // String for use in scripts.
|
Q_PROPERTY(QString NULL READ NULL_UUID CONSTANT) // String for use in scripts.
|
||||||
Q_PROPERTY(QString SELF READ SELF_UUID CONSTANT)
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
QUuid fromString(const QString& string);
|
QUuid fromString(const QString& string);
|
||||||
|
@ -33,10 +32,7 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString NULL_UUID() { return NULL_ID; }
|
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 NULL_ID { "{00000000-0000-0000-0000-000000000000}" };
|
||||||
const QString SELF_ID{ AVATAR_SELF_ID.toString() };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ScriptUUID_h
|
#endif // hifi_ScriptUUID_h
|
||||||
|
|
|
@ -43,7 +43,7 @@ var OVERLAY_DATA_HMD = {
|
||||||
scale: 2 * MyAvatar.sensorToWorldScale,
|
scale: 2 * MyAvatar.sensorToWorldScale,
|
||||||
emissive: true,
|
emissive: true,
|
||||||
drawInFront: true,
|
drawInFront: true,
|
||||||
parentID: Uuid.SELF,
|
parentID: MyAvatar.SELF_ID,
|
||||||
parentJointIndex: CAMERA_MATRIX
|
parentJointIndex: CAMERA_MATRIX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ createControllerDisplay = function(config) {
|
||||||
dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions),
|
dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions),
|
||||||
localRotation: controller.rotation,
|
localRotation: controller.rotation,
|
||||||
localPosition: Vec3.multiply(sensorScaleFactor, position),
|
localPosition: Vec3.multiply(sensorScaleFactor, position),
|
||||||
parentID: Uuid.SELF,
|
parentID: MyAvatar.SELF_ID,
|
||||||
parentJointIndex: controller.jointIndex,
|
parentJointIndex: controller.jointIndex,
|
||||||
ignoreRayIntersection: true
|
ignoreRayIntersection: true
|
||||||
});
|
});
|
||||||
|
@ -196,7 +196,7 @@ createControllerDisplay = function(config) {
|
||||||
url: part.modelURL,
|
url: part.modelURL,
|
||||||
localPosition: partPosition,
|
localPosition: partPosition,
|
||||||
localRotation: innerRotation,
|
localRotation: innerRotation,
|
||||||
parentID: Uuid.SELF,
|
parentID: MyAvatar.SELF_ID,
|
||||||
parentJointIndex: controller.jointIndex,
|
parentJointIndex: controller.jointIndex,
|
||||||
ignoreRayIntersection: true
|
ignoreRayIntersection: true
|
||||||
};
|
};
|
||||||
|
|
|
@ -99,7 +99,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
|
||||||
"grabbableKey": {"grabbable": true}
|
"grabbableKey": {"grabbable": true}
|
||||||
}),
|
}),
|
||||||
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth },
|
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth },
|
||||||
parentID: Uuid.SELF,
|
parentID: MyAvatar.SELF_ID,
|
||||||
visible: visible
|
visible: visible
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ WebTablet.prototype.register = function() {
|
||||||
|
|
||||||
WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
|
WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
|
||||||
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, 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) {
|
children.forEach(function(childID) {
|
||||||
var props = Entities.getEntityProperties(childID, ["name"]);
|
var props = Entities.getEntityProperties(childID, ["name"]);
|
||||||
if (props.name === "WebTablet Tablet") {
|
if (props.name === "WebTablet Tablet") {
|
||||||
|
|
|
@ -311,19 +311,19 @@ findHandChildEntities = function(hand) {
|
||||||
// find children of avatar's hand joint
|
// find children of avatar's hand joint
|
||||||
var handJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "RightHand" : "LeftHand");
|
var handJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "RightHand" : "LeftHand");
|
||||||
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, handJointIndex);
|
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
|
// find children of faux controller joint
|
||||||
var controllerJointIndex = getControllerJointIndex(hand);
|
var controllerJointIndex = getControllerJointIndex(hand);
|
||||||
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex));
|
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
|
// find children of faux camera-relative controller joint
|
||||||
var controllerCRJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ?
|
var controllerCRJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ?
|
||||||
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
|
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
|
||||||
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
||||||
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerCRJointIndex));
|
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) {
|
return children.filter(function (childID) {
|
||||||
var childType = Entities.getNestableType(childID);
|
var childType = Entities.getNestableType(childID);
|
||||||
|
|
Loading…
Reference in a new issue