Fix Uuid.NULL behavior

This commit is contained in:
Karol Suprynowicz 2024-10-19 19:06:16 +02:00 committed by HifiExperiments
parent 9da839fe48
commit d38ebbd9f9
24 changed files with 114 additions and 114 deletions

View file

@ -298,9 +298,9 @@ public:
* Audio is recorded to snapshots directory specified in settings. * Audio is recorded to snapshots directory specified in settings.
* @function Audio.startRecording * @function Audio.startRecording
* @returns {Uuid} A valid <code>Uuid</code> if the specified file could be opened and audio recording has started, otherwise * @returns {Uuid} A valid <code>Uuid</code> if the specified file could be opened and audio recording has started, otherwise
* <code>Uuid.NULL</code>. * <code>Uuid.NONE</code>.
* @example <caption>Make a 10 second audio recording.</caption> * @example <caption>Make a 10 second audio recording.</caption>
* if (Audio.startRecording() !== Uuid.NULL) { * if (Audio.startRecording() !== Uuid.NONE) {
* Script.setTimeout(function () { * Script.setTimeout(function () {
* Audio.stopRecording(); * Audio.stopRecording();
* print("Audio recording finished."); * print("Audio recording finished.");

View file

@ -85,7 +85,7 @@ public:
* *
* @property {Uuid} keyboardFocusOverlay - The <code>{@link Overlays.OverlayProperties-Web3D|"web3d"}</code> overlay * @property {Uuid} keyboardFocusOverlay - The <code>{@link Overlays.OverlayProperties-Web3D|"web3d"}</code> overlay
* ({@link Entities.EntityProperties-Web|Web} entity) that has keyboard focus. If no overlay (entity) has keyboard focus, * ({@link Entities.EntityProperties-Web|Web} entity) that has keyboard focus. If no overlay (entity) has keyboard focus,
* returns <code>null</code>; set to <code>null</code> or {@link Uuid(0)|Uuid.NULL} to clear keyboard focus. * returns <code>null</code>; set to <code>null</code> or {@link Uuid(0)|Uuid.NONE} to clear keyboard focus.
*/ */
class Overlays : public QObject { class Overlays : public QObject {
@ -125,7 +125,7 @@ public slots:
* @function Overlays.addOverlay * @function Overlays.addOverlay
* @param {Overlays.OverlayType} type - The type of the overlay to add. * @param {Overlays.OverlayType} type - The type of the overlay to add.
* @param {Overlays.OverlayProperties} properties - The properties of the overlay to add. * @param {Overlays.OverlayProperties} properties - The properties of the overlay to add.
* @returns {Uuid} The ID of the newly created overlay if successful, otherwise {@link Uuid(0)|Uuid.NULL}. * @returns {Uuid} The ID of the newly created overlay if successful, otherwise {@link Uuid(0)|Uuid.NONE}.
* @example <caption>Add a cube overlay in front of your avatar.</caption> * @example <caption>Add a cube overlay in front of your avatar.</caption>
* var overlay = Overlays.addOverlay("cube", { * var overlay = Overlays.addOverlay("cube", {
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })), * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
@ -141,7 +141,7 @@ public slots:
* <p>Note: For cloning behavior of 3D overlays and entities, see {@link Entities.cloneEntity}.</p> * <p>Note: For cloning behavior of 3D overlays and entities, see {@link Entities.cloneEntity}.</p>
* @function Overlays.cloneOverlay * @function Overlays.cloneOverlay
* @param {Uuid} id - The ID of the overlay (or entity) to clone. * @param {Uuid} id - The ID of the overlay (or entity) to clone.
* @returns {Uuid} The ID of the new overlay (or entity) if successful, otherwise {@link Uuid(0)|Uuid.NULL}. * @returns {Uuid} The ID of the new overlay (or entity) if successful, otherwise {@link Uuid(0)|Uuid.NONE}.
*/ */
QUuid cloneOverlay(const QUuid& id); QUuid cloneOverlay(const QUuid& id);
@ -535,7 +535,7 @@ public slots:
* @function Overlays.setKeyboardFocusOverlay * @function Overlays.setKeyboardFocusOverlay
* @param {Uuid} id - The ID of the <code>{@link Overlays.OverlayProperties-Web3D|"web3d"}</code> overlay * @param {Uuid} id - The ID of the <code>{@link Overlays.OverlayProperties-Web3D|"web3d"}</code> overlay
* ({@link Entities.EntityProperties-Web|Web} entity) to set keyboard focus to. Use <code>null</code> or * ({@link Entities.EntityProperties-Web|Web} entity) to set keyboard focus to. Use <code>null</code> or
* {@link Uuid(0)|Uuid.NULL} to unset keyboard focus from an overlay (entity). * {@link Uuid(0)|Uuid.NONE} to unset keyboard focus from an overlay (entity).
*/ */
void setKeyboardFocusOverlay(const QUuid& id) { DependencyManager::get<EntityScriptingInterface>()->setKeyboardFocusEntity(id); } void setKeyboardFocusOverlay(const QUuid& id) { DependencyManager::get<EntityScriptingInterface>()->setKeyboardFocusEntity(id); }

View file

@ -443,7 +443,7 @@ public:
/*@jsdoc /*@jsdoc
* Gets the ID of the entity or avatar that the avatar is parented to. * Gets the ID of the entity or avatar that the avatar is parented to.
* @function MyAvatar.getParentID * @function MyAvatar.getParentID
* @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NULL} if not parented. * @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NONE} if not parented.
*/ */
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript. // 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(); } Q_INVOKABLE virtual const QUuid getParentID() const override { return SpatiallyNestable::getParentID(); }
@ -452,7 +452,7 @@ public:
* Sets the ID of the entity or avatar that the avatar is parented to. * Sets the ID of the entity or avatar that the avatar is parented to.
* @function MyAvatar.setParentID * @function MyAvatar.setParentID
* @param {Uuid} parentID - The ID of the entity or avatar that the avatar should be parented to. Set to * @param {Uuid} parentID - The ID of the entity or avatar that the avatar should be parented to. Set to
* {@link Uuid(0)|Uuid.NULL} to unparent. * {@link Uuid(0)|Uuid.NONE} to unparent.
*/ */
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript. // This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
Q_INVOKABLE virtual void setParentID(const QUuid& parentID) override; Q_INVOKABLE virtual void setParentID(const QUuid& parentID) override;

View file

@ -153,7 +153,7 @@ public slots:
/*@jsdoc /*@jsdoc
* Gets the ID of the entity or avatar that the avatar is parented to. * Gets the ID of the entity or avatar that the avatar is parented to.
* @function ScriptAvatar.getParentID * @function ScriptAvatar.getParentID
* @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NULL} if not parented * @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NONE} if not parented
* or avatar data aren't available. * or avatar data aren't available.
*/ */
QUuid getParentID() const; QUuid getParentID() const;

View file

@ -31,8 +31,8 @@
* <code>false</code> if it isn't. The value is per the <code>entityHostType</code> property value, set at entity creation * <code>false</code> if it isn't. The value is per the <code>entityHostType</code> property value, set at entity creation
* by one of the {@link Entities.addEntity} methods. <em>Read-only.</em> * by one of the {@link Entities.addEntity} methods. <em>Read-only.</em>
* *
* @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if <code>avatarEntity</code> is * @property {Uuid} owningAvatarID=Uuid.NONE - The session ID of the owning avatar if <code>avatarEntity</code> is
* <code>true</code>, otherwise {@link Uuid(0)|Uuid.NULL}. <em>Read-only.</em> * <code>true</code>, otherwise {@link Uuid(0)|Uuid.NONE}. <em>Read-only.</em>
* *
* @property {number} created - When the entity was created, expressed as the number of microseconds since * @property {number} created - When the entity was created, expressed as the number of microseconds since
* 1970-01-01T00:00:00 UTC. <em>Read-only.</em> * 1970-01-01T00:00:00 UTC. <em>Read-only.</em>
@ -131,8 +131,8 @@
* button beside the "script URL" field in properties tab of the Create app works. * button beside the "script URL" field in properties tab of the Create app works.
* @property {string} serverScripts="" - The URL of the server entity script, if any, that is attached to the entity. * @property {string} serverScripts="" - The URL of the server entity script, if any, that is attached to the entity.
* *
* @property {Uuid} parentID=Uuid.NULL - The ID of the entity or avatar that the entity is parented to. A value of * @property {Uuid} parentID=Uuid.NONE - The ID of the entity or avatar that the entity is parented to. A value of
* {@link Uuid(0)|Uuid.NULL} is used if the entity is not parented. * {@link Uuid(0)|Uuid.NONE} is used if the entity is not parented.
* @property {number} parentJointIndex=65535 - The joint of the entity or avatar that the entity is parented to. Use * @property {number} parentJointIndex=65535 - The joint of the entity or avatar that the entity is parented to. Use
* <code>65535</code> or <code>-1</code> to parent to the entity or avatar's position and orientation rather than a joint. * <code>65535</code> or <code>-1</code> to parent to the entity or avatar's position and orientation rather than a joint.
* @property {Vec3} localPosition=0,0,0 - The position of the entity relative to its parent if the entity is parented, * @property {Vec3} localPosition=0,0,0 - The position of the entity relative to its parent if the entity is parented,
@ -184,7 +184,7 @@
* *
* @property {MirrorMode} mirrorMode="none" - If this entity should render as a mirror (reflecting the view of the camera), * @property {MirrorMode} mirrorMode="none" - If this entity should render as a mirror (reflecting the view of the camera),
* a portal (reflecting the view through its <code>portalExitID</code>), or normally. * a portal (reflecting the view through its <code>portalExitID</code>), or normally.
* @property {Uuid} portalExitID=Uuid.NULL - The ID of the entity that should act as the portal exit if the <code>mirrorMode</code> * @property {Uuid} portalExitID=Uuid.NONE - The ID of the entity that should act as the portal exit if the <code>mirrorMode</code>
* is set to <code>portal</code>. * is set to <code>portal</code>.
* *
* @comment The different entity types have additional properties as follows: * @comment The different entity types have additional properties as follows:
@ -612,18 +612,18 @@
* JPG or PNG format. If no texture is specified the surfaces display white. * JPG or PNG format. If no texture is specified the surfaces display white.
* @property {string} zTextureURL="" - The URL of the texture to map to surfaces perpendicular to the entity's local z-axis. * @property {string} zTextureURL="" - The URL of the texture to map to surfaces perpendicular to the entity's local z-axis.
* JPG or PNG format. If no texture is specified the surfaces display white. * JPG or PNG format. If no texture is specified the surfaces display white.
* @property {Uuid} xNNeighborID=Uuid.NULL - The ID of the neighboring PolyVox entity in the entity's -ve local x-axis * @property {Uuid} xNNeighborID=Uuid.NONE - The ID of the neighboring PolyVox entity in the entity's -ve local x-axis
* direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them. * direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NONE} if there is none or you don't want to join them.
* @property {Uuid} yNNeighborID=Uuid.NULL - The ID of the neighboring PolyVox entity in the entity's -ve local y-axis * @property {Uuid} yNNeighborID=Uuid.NONE - The ID of the neighboring PolyVox entity in the entity's -ve local y-axis
* direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them. * direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NONE} if there is none or you don't want to join them.
* @property {Uuid} zNNeighborID=Uuid.NULL - The ID of the neighboring PolyVox entity in the entity's -ve local z-axis * @property {Uuid} zNNeighborID=Uuid.NONE - The ID of the neighboring PolyVox entity in the entity's -ve local z-axis
* direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them. * direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NONE} if there is none or you don't want to join them.
* @property {Uuid} xPNeighborID=Uuid.NULL - The ID of the neighboring PolyVox entity in the entity's +ve local x-axis * @property {Uuid} xPNeighborID=Uuid.NONE - The ID of the neighboring PolyVox entity in the entity's +ve local x-axis
* direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them. * direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NONE} if there is none or you don't want to join them.
* @property {Uuid} yPNeighborID=Uuid.NULL - The ID of the neighboring PolyVox entity in the entity's +ve local y-axis * @property {Uuid} yPNeighborID=Uuid.NONE - The ID of the neighboring PolyVox entity in the entity's +ve local y-axis
* direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them. * direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NONE} if there is none or you don't want to join them.
* @property {Uuid} zPNeighborID=Uuid.NULL - The ID of the neighboring PolyVox entity in the entity's +ve local z-axis * @property {Uuid} zPNeighborID=Uuid.NONE - The ID of the neighboring PolyVox entity in the entity's +ve local z-axis
* direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them. * direction, if you want them joined. Set to {@link Uuid(0)|Uuid.NONE} if there is none or you don't want to join them.
* @example <caption>Create a textured PolyVox sphere.</caption> * @example <caption>Create a textured PolyVox sphere.</caption>
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -8 })); * var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -8 }));
* var texture = "http://public.highfidelity.com/cozza13/tuscany/Concrete2.jpg"; * var texture = "http://public.highfidelity.com/cozza13/tuscany/Concrete2.jpg";

View file

@ -164,7 +164,7 @@ public:
* @hifi-assignment-client * @hifi-assignment-client
* *
* @property {Uuid} keyboardFocusEntity - The {@link Entities.EntityProperties-Web|Web} entity that has keyboard focus. If no * @property {Uuid} keyboardFocusEntity - The {@link Entities.EntityProperties-Web|Web} entity that has keyboard focus. If no
* Web entity has keyboard focus, returns <code>null</code>; set to <code>null</code> or {@link Uuid(0)|Uuid.NULL} to clear * Web entity has keyboard focus, returns <code>null</code>; set to <code>null</code> or {@link Uuid(0)|Uuid.NONE} to clear
* keyboard focus. * keyboard focus.
*/ */
/// handles scripting of Entity commands from JS passed to assigned clients /// handles scripting of Entity commands from JS passed to assigned clients
@ -323,7 +323,7 @@ public slots:
* @param {Entities.EntityProperties} properties - The properties of the entity to create. * @param {Entities.EntityProperties} properties - The properties of the entity to create.
* @param {Entities.EntityHostType} [entityHostType="domain"] - The type of entity to create. * @param {Entities.EntityHostType} [entityHostType="domain"] - The type of entity to create.
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid(0)|Uuid.NULL}. * @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid(0)|Uuid.NONE}.
* @example <caption>Create a box domain entity in front of your avatar.</caption> * @example <caption>Create a box domain entity in front of your avatar.</caption>
* var entityID = Entities.addEntity({ * var entityID = Entities.addEntity({
* type: "Box", * type: "Box",
@ -354,7 +354,7 @@ public slots:
* @param {Entities.EntityProperties} properties - The properties of the entity to create. * @param {Entities.EntityProperties} properties - The properties of the entity to create.
* @param {boolean} [avatarEntity=false] - <code>true</code> to create an avatar entity, <code>false</code> to create a * @param {boolean} [avatarEntity=false] - <code>true</code> to create an avatar entity, <code>false</code> to create a
* domain entity. * domain entity.
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid(0)|Uuid.NULL}. * @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid(0)|Uuid.NONE}.
*/ */
Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, bool avatarEntity = false) { Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, bool avatarEntity = false) {
entity::HostType entityHostType = avatarEntity ? entity::HostType::AVATAR : entity::HostType::DOMAIN; entity::HostType entityHostType = avatarEntity ? entity::HostType::AVATAR : entity::HostType::DOMAIN;
@ -378,7 +378,7 @@ public slots:
* <code>true</code> in order to be cloned.</p> * <code>true</code> in order to be cloned.</p>
* @function Entities.cloneEntity * @function Entities.cloneEntity
* @param {Uuid} entityID - The ID of the entity to clone. * @param {Uuid} entityID - The ID of the entity to clone.
* @returns {Uuid} The ID of the new entity if successfully cloned, otherwise {@link Uuid(0)|Uuid.NULL}. * @returns {Uuid} The ID of the new entity if successfully cloned, otherwise {@link Uuid(0)|Uuid.NONE}.
*/ */
Q_INVOKABLE QUuid cloneEntity(const QUuid& entityID); Q_INVOKABLE QUuid cloneEntity(const QUuid& entityID);
@ -429,7 +429,7 @@ public slots:
* @function Entities.editEntity * @function Entities.editEntity
* @param {Uuid} entityID - The ID of the entity to edit. * @param {Uuid} entityID - The ID of the entity to edit.
* @param {Entities.EntityProperties} properties - The new property values. * @param {Entities.EntityProperties} properties - The new property values.
* @returns {Uuid} The ID of the entity if the edit was successful, otherwise <code>null</code> or {@link Uuid|Uuid.NULL}. * @returns {Uuid} The ID of the entity if the edit was successful, otherwise <code>null</code> or {@link Uuid|Uuid.NONE}.
* @example <caption>Change the color of an entity.</caption> * @example <caption>Change the color of an entity.</caption>
* var entityID = Entities.addEntity({ * var entityID = Entities.addEntity({
* type: "Box", * type: "Box",
@ -1681,7 +1681,7 @@ public slots:
* } * }
* *
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 })); * var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 }));
* var root = createEntity("Root", position, Uuid.NULL); * var root = createEntity("Root", position, Uuid.NONE);
* var child = createEntity("Child", Vec3.sum(position, { x: 0, y: -1, z: 0 }), root); * var child = createEntity("Child", Vec3.sum(position, { x: 0, y: -1, z: 0 }), root);
* var grandChild = createEntity("Grandchild", Vec3.sum(position, { x: 0, y: -2, z: 0 }), child); * var grandChild = createEntity("Grandchild", Vec3.sum(position, { x: 0, y: -2, z: 0 }), child);
* *
@ -1713,7 +1713,7 @@ public slots:
* } * }
* *
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 })); * var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 }));
* var root = createEntity("Root", position, Uuid.NULL); * var root = createEntity("Root", position, Uuid.NONE);
* var child = createEntity("Child", Vec3.sum(position, { x: 0, y: -1, z: 0 }), root); * var child = createEntity("Child", Vec3.sum(position, { x: 0, y: -1, z: 0 }), root);
* *
* Script.setTimeout(function () { // Wait for the entity to be created before editing. * Script.setTimeout(function () { // Wait for the entity to be created before editing.
@ -1749,7 +1749,7 @@ public slots:
* } * }
* *
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 })); * var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 }));
* var root = createEntity("Root", position, Uuid.NULL); * var root = createEntity("Root", position, Uuid.NONE);
* var child = createEntity("Child", Vec3.sum(position, { x: 0, y: -1, z: 0 }), root); * var child = createEntity("Child", Vec3.sum(position, { x: 0, y: -1, z: 0 }), root);
* var grandChild = createEntity("Grandchild", Vec3.sum(position, { x: 0, y: -2, z: 0 }), child); * var grandChild = createEntity("Grandchild", Vec3.sum(position, { x: 0, y: -2, z: 0 }), child);
* *
@ -1785,7 +1785,7 @@ public slots:
* Sets the {@link Entities.EntityProperties-Web|Web} entity that has keyboard focus. * Sets the {@link Entities.EntityProperties-Web|Web} entity that has keyboard focus.
* @function Entities.setKeyboardFocusEntity * @function Entities.setKeyboardFocusEntity
* @param {Uuid} id - The ID of the {@link Entities.EntityProperties-Web|Web} entity to set keyboard focus to. Use * @param {Uuid} id - The ID of the {@link Entities.EntityProperties-Web|Web} entity to set keyboard focus to. Use
* <code>null</code> or {@link Uuid(0)|Uuid.NULL} to unset keyboard focus from an entity. * <code>null</code> or {@link Uuid(0)|Uuid.NONE} to unset keyboard focus from an entity.
*/ */
Q_INVOKABLE void setKeyboardFocusEntity(const QUuid& id); Q_INVOKABLE void setKeyboardFocusEntity(const QUuid& id);
@ -2017,7 +2017,7 @@ public slots:
* *
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 })); * var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 2, z: -5 }));
* *
* var parent = createEntity(position, MyAvatar.orientation, Uuid.NULL); * var parent = createEntity(position, MyAvatar.orientation, Uuid.NONE);
* *
* var childTranslation = { x: 0, y: -1.5, z: 0 }; * var childTranslation = { x: 0, y: -1.5, z: 0 };
* var childRotation = Quat.fromPitchYawRollDegrees(0, 45, 0); * var childRotation = Quat.fromPitchYawRollDegrees(0, 45, 0);

View file

@ -49,7 +49,7 @@ const QString GET_PLACE = "/api/v1/places/%1";
* @hifi-avatar * @hifi-avatar
* @hifi-assignment-client * @hifi-assignment-client
* *
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NULL} if you're not * @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NONE} if you're not
* connected to the domain or are in a serverless domain. * connected to the domain or are in a serverless domain.
* <em>Read-only.</em> * <em>Read-only.</em>
* @property {string} hostname - The name of the domain for your current directory services address (e.g., <code>"DomainName"</code>, * @property {string} hostname - The name of the domain for your current directory services address (e.g., <code>"DomainName"</code>,
@ -83,7 +83,7 @@ const QString GET_PLACE = "/api/v1/places/%1";
* @deprecated This API is deprecated and will be removed. Use the {@link location} or {@link Window|Window.location} APIs * @deprecated This API is deprecated and will be removed. Use the {@link location} or {@link Window|Window.location} APIs
* instead. * instead.
* *
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NULL} if you're not * @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NONE} if you're not
* connected to the domain or are in a serverless domain. * connected to the domain or are in a serverless domain.
* <em>Read-only.</em> * <em>Read-only.</em>
* @property {string} hostname - The name of the domain for your current directory services address (e.g., <code>"DomainName"</code>, * @property {string} hostname - The name of the domain for your current directory services address (e.g., <code>"DomainName"</code>,
@ -397,7 +397,7 @@ signals:
* Triggered when a request is made to go to a URL or IP address. * Triggered when a request is made to go to a URL or IP address.
* @function location.possibleDomainChangeRequired * @function location.possibleDomainChangeRequired
* @param {string} domainURL - The URL of the domain. * @param {string} domainURL - The URL of the domain.
* @param {Uuid} domainID - The UUID of the domain to go to. May be {@link Uuid|Uuid.NULL} if not yet known. * @param {Uuid} domainID - The UUID of the domain to go to. May be {@link Uuid|Uuid.NONE} if not yet known.
* @returns {Signal} * @returns {Signal}
*/ */
// No example because this function isn't typically used in scripts. // No example because this function isn't typically used in scripts.

View file

@ -435,7 +435,7 @@ public:
* @param {Uuid} entityID - The ID of the entity running the entity script. * @param {Uuid} entityID - The ID of the entity running the entity script.
* @param {string} methodName - The name of the method to call. * @param {string} methodName - The name of the method to call.
* @param {string[]} [parameters=[]] - The parameters to call the specified method with. * @param {string[]} [parameters=[]] - The parameters to call the specified method with.
* @param {Uuid} [remoteCallerID=Uuid.NULL] - An ID that identifies the caller. * @param {Uuid} [remoteCallerID=Uuid.NONE] - An ID that identifies the caller.
*/ */
Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName,
const QStringList& params = QStringList(), const QStringList& params = QStringList(),
@ -740,7 +740,7 @@ public:
* @returns {Signal} * @returns {Signal}
* @example <caption>Get the ID of the entity that a client entity script is running in.</caption> * @example <caption>Get the ID of the entity that a client entity script is running in.</caption>
* var entityScript = function () { * var entityScript = function () {
* this.entityID = Uuid.NULL; * this.entityID = Uuid.NONE;
* }; * };
* *
* Script.entityScriptPreloadFinished.connect(function (entityID) { * Script.entityScriptPreloadFinished.connect(function (entityID) {

View file

@ -41,7 +41,7 @@
/// Provides the <code><a href="https://apidocs.overte.org/Uuid.html">Uuid</a></code> scripting interface /// Provides the <code><a href="https://apidocs.overte.org/Uuid.html">Uuid</a></code> scripting interface
class ScriptUUID : public QObject, protected Scriptable { class ScriptUUID : public QObject, protected Scriptable {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString NULL READ NULL_UUID CONSTANT) // String for use in scripts. Q_PROPERTY(QString NONE READ getNullUuid CONSTANT) // String for use in scripts.
public slots: public slots:
/*@jsdoc /*@jsdoc
@ -100,14 +100,14 @@ public slots:
* Tests whether a UUID is null. * Tests whether a UUID is null.
* @function Uuid(0).isNull * @function Uuid(0).isNull
* @param {Uuid} id - The UUID to test. * @param {Uuid} id - The UUID to test.
* @returns {boolean} <code>true</code> if the UUID equals <code>Uuid.NULL</code> or is <code>null</code>, otherwise * @returns {boolean} <code>true</code> if the UUID equals <code>Uuid.NONE</code> or is <code>null</code>, otherwise
* <code>false</code>. * <code>false</code>.
* @example <caption>Demonstrate <code>true</code> and <code>false</code> cases.</caption> * @example <caption>Demonstrate <code>true</code> and <code>false</code> cases.</caption>
* var uuid; // undefined * var uuid; // undefined
* print(Uuid.isNull(uuid)); // false * print(Uuid.isNull(uuid)); // false
* uuid = Uuid.generate(); * uuid = Uuid.generate();
* print(Uuid.isNull(uuid)); // false * print(Uuid.isNull(uuid)); // false
* uuid = Uuid.NULL; * uuid = Uuid.NONE;
* print(Uuid.isNull(uuid)); // true * print(Uuid.isNull(uuid)); // true
* uuid = null; * uuid = null;
* print(Uuid.isNull(uuid)); // true * print(Uuid.isNull(uuid)); // true
@ -125,9 +125,9 @@ public slots:
* print("Generated UUID: " + uuid); // Generated UUID: {nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn} * print("Generated UUID: " + uuid); // Generated UUID: {nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}
*/ */
void print(const QString& label, const QUuid& id); void print(const QString& label, const QUuid& id);
QString getNullUuid() const { return NULL_ID; }
private: private:
const QString NULL_UUID() { return NULL_ID; }
const QString NULL_ID { "{00000000-0000-0000-0000-000000000000}" }; const QString NULL_ID { "{00000000-0000-0000-0000-000000000000}" };
}; };

View file

@ -235,7 +235,7 @@ signals:
* @param {string} userName - The user name of the client, if the requesting client is an administrator in the domain or * @param {string} userName - The user name of the client, if the requesting client is an administrator in the domain or
* the <code>sessionID</code> is that of the client, otherwise <code>""</code>. * the <code>sessionID</code> is that of the client, otherwise <code>""</code>.
* @param {Uuid} machineFingerprint - The machine fingerprint of the client, if the requesting client is an administrator * @param {Uuid} machineFingerprint - The machine fingerprint of the client, if the requesting client is an administrator
* in the domain or the <code>sessionID</code> is that of the client, otherwise {@link Uuid|Uuid.NULL}. * in the domain or the <code>sessionID</code> is that of the client, otherwise {@link Uuid|Uuid.NONE}.
* @param {boolean} isAdmin - <code>true</code> if the client is an administrator in the domain, <code>false</code> if not. * @param {boolean} isAdmin - <code>true</code> if the client is an administrator in the domain, <code>false</code> if not.
* @returns {Signal} * @returns {Signal}
*/ */

View file

@ -139,7 +139,7 @@ function setSelectedObject(id, type) {
function setWindow(window) { function setWindow(window) {
if (activeWindow !== undefined) { if (activeWindow !== undefined) {
setSelectedObject(Uuid.NULL, ""); setSelectedObject(Uuid.NONE, "");
// activeWindow.closed.disconnect(killWindow); // activeWindow.closed.disconnect(killWindow);
activeWindow.fromQml.disconnect(fromQml); activeWindow.fromQml.disconnect(fromQml);
Controller.mousePressEvent.disconnect(mousePressEvent); Controller.mousePressEvent.disconnect(mousePressEvent);

View file

@ -115,7 +115,7 @@ function AttachedEntitiesManager() {
var allowedJoints = getEntityCustomData('wearable', grabbedEntity, DEFAULT_WEARABLE_DATA).joints; var allowedJoints = getEntityCustomData('wearable', grabbedEntity, DEFAULT_WEARABLE_DATA).joints;
var props = Entities.getEntityProperties(grabbedEntity, ["position", "parentID", "parentJointIndex"]); var props = Entities.getEntityProperties(grabbedEntity, ["position", "parentID", "parentJointIndex"]);
if (props.parentID === Uuid.NULL || props.parentID === MyAvatar.sessionUUID) { if (props.parentID === Uuid.NONE || props.parentID === MyAvatar.sessionUUID) {
var bestJointName = ""; var bestJointName = "";
var bestJointIndex = -1; var bestJointIndex = -1;
var bestJointDistance = 0; var bestJointDistance = 0;
@ -167,7 +167,7 @@ function AttachedEntitiesManager() {
if (updatePresets) { if (updatePresets) {
this.updateRelativeOffsets(newEntity); this.updateRelativeOffsets(newEntity);
} }
} else if (props.parentID != Uuid.NULL) { } else if (props.parentID != Uuid.NONE) {
// drop the entity and set it to have no parent (not on the avatar), unless it's being equipped in a hand. // drop the entity and set it to have no parent (not on the avatar), unless it's being equipped in a hand.
if (props.parentID === MyAvatar.sessionUUID && if (props.parentID === MyAvatar.sessionUUID &&
(props.parentJointIndex == MyAvatar.getJointIndex("RightHand") || (props.parentJointIndex == MyAvatar.getJointIndex("RightHand") ||
@ -175,7 +175,7 @@ function AttachedEntitiesManager() {
// this is equipped on a hand -- don't clear the parent. // this is equipped on a hand -- don't clear the parent.
} else { } else {
var wearProps = Entities.getEntityProperties(grabbedEntity); var wearProps = Entities.getEntityProperties(grabbedEntity);
wearProps.parentID = Uuid.NULL; wearProps.parentID = Uuid.NONE;
wearProps.parentJointIndex = -1; wearProps.parentJointIndex = -1;
delete wearProps.id; delete wearProps.id;
delete wearProps.created; delete wearProps.created;

View file

@ -340,7 +340,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
var props = controllerData.nearbyEntityPropertiesByID[hotspot.entityID]; var props = controllerData.nearbyEntityPropertiesByID[hotspot.entityID];
var hasParent = true; var hasParent = true;
if (props.parentID === Uuid.NULL) { if (props.parentID === Uuid.NONE) {
hasParent = false; hasParent = false;
} }
@ -561,7 +561,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
this.storeAttachPointInSettings(); this.storeAttachPointInSettings();
Entities.editEntity(this.targetEntityID, { Entities.editEntity(this.targetEntityID, {
parentID: Uuid.NULL, parentID: Uuid.NONE,
parentJointIndex: -1 parentJointIndex: -1
}); });

View file

@ -168,7 +168,7 @@ Script.include("/~/system/libraries/controllers.js");
tag: "far-grab-" + MyAvatar.sessionUUID, tag: "far-grab-" + MyAvatar.sessionUUID,
ttl: ACTION_TTL ttl: ACTION_TTL
}); });
if (this.actionID === Uuid.NULL) { if (this.actionID === Uuid.NONE) {
this.actionID = null; this.actionID = null;
} }

View file

@ -134,9 +134,9 @@ Script.include("/~/system/libraries/utils.js");
this.endNearParentingGrabOverlay = function () { this.endNearParentingGrabOverlay = function () {
var previousParentID = this.previousParentID[this.grabbedThingID]; var previousParentID = this.previousParentID[this.grabbedThingID];
if ((previousParentID === Uuid.NULL || previousParentID === null) && !this.robbed) { if ((previousParentID === Uuid.NONE || previousParentID === null) && !this.robbed) {
Entities.editEntity(this.grabbedThingID, { Entities.editEntity(this.grabbedThingID, {
parentID: Uuid.NULL, parentID: Uuid.NONE,
parentJointIndex: -1 parentJointIndex: -1
}); });
} else if (!this.robbed){ } else if (!this.robbed){

View file

@ -108,7 +108,7 @@ Script.include("/~/system/libraries/controllers.js");
} }
// add the tabletScreen, if it is valid // add the tabletScreen, if it is valid
if (HMD.tabletScreenID && HMD.tabletScreenID !== Uuid.NULL && if (HMD.tabletScreenID && HMD.tabletScreenID !== Uuid.NONE &&
Entities.getEntityProperties(HMD.tabletScreenID, ["visible"]).visible) { Entities.getEntityProperties(HMD.tabletScreenID, ["visible"]).visible) {
stylusTarget = getOverlayDistance(controllerPosition, HMD.tabletScreenID); stylusTarget = getOverlayDistance(controllerPosition, HMD.tabletScreenID);
if (stylusTarget) { if (stylusTarget) {
@ -117,7 +117,7 @@ Script.include("/~/system/libraries/controllers.js");
} }
// add the tablet home button. // add the tablet home button.
if (HMD.homeButtonID && HMD.homeButtonID !== Uuid.NULL && if (HMD.homeButtonID && HMD.homeButtonID !== Uuid.NONE &&
Entities.getEntityProperties(HMD.homeButtonID, ["visible"]).visible) { Entities.getEntityProperties(HMD.homeButtonID, ["visible"]).visible) {
stylusTarget = getOverlayDistance(controllerPosition, HMD.homeButtonID); stylusTarget = getOverlayDistance(controllerPosition, HMD.homeButtonID);
if (stylusTarget) { if (stylusTarget) {

View file

@ -513,7 +513,7 @@ Script.include("/~/system/libraries/controllers.js");
if (Vec3.distance(targetXZPosition, avatarXZPosition) < MIN_PARENTING_DISTANCE) { if (Vec3.distance(targetXZPosition, avatarXZPosition) < MIN_PARENTING_DISTANCE) {
// Set play area position and rotation in world coordinates with no parenting. // Set play area position and rotation in world coordinates with no parenting.
Overlays.editOverlay(_this.playAreaOverlay, { Overlays.editOverlay(_this.playAreaOverlay, {
parentID: Uuid.NULL, parentID: Uuid.NONE,
position: Vec3.sum(position, position: Vec3.sum(position,
Vec3.multiplyQbyV(sensorToWorldRotation, Vec3.multiplyQbyV(sensorToWorldRotation,
Vec3.multiply(MyAvatar.sensorToWorldScale, Vec3.multiply(MyAvatar.sensorToWorldScale,

View file

@ -106,7 +106,7 @@
} else if (properties.type === "Zone") { } else if (properties.type === "Zone") {
return { imageURL: ZONE_URL }; return { imageURL: ZONE_URL };
} else if (properties.type === "Material") { } else if (properties.type === "Material") {
if (properties.parentID !== Uuid.NULL && properties.name !== "MATERIAL_" + entityShapeVisualizerSessionName) { if (properties.parentID !== Uuid.NONE && properties.name !== "MATERIAL_" + entityShapeVisualizerSessionName) {
return { imageURL: MATERIAL_URL }; return { imageURL: MATERIAL_URL };
} else { } else {
return { imageURL: "" }; return { imageURL: "" };
@ -1858,7 +1858,7 @@
} }
selectedEntities.forEach(function (id, index) { selectedEntities.forEach(function (id, index) {
var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID; var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID;
if (parentId !== null && parentId.length > 0 && parentId !== Uuid.NULL) { if (parentId !== null && parentId.length > 0 && parentId !== Uuid.NONE) {
parentCheck = true; parentCheck = true;
} }
Entities.editEntity(id, {parentID: null}); Entities.editEntity(id, {parentID: null});
@ -2890,7 +2890,7 @@
} else if (data.type === "materialTargetRequest") { } else if (data.type === "materialTargetRequest") {
var parentModelData; var parentModelData;
var properties = Entities.getEntityProperties(data.entityID, ["type", "parentID"]); var properties = Entities.getEntityProperties(data.entityID, ["type", "parentID"]);
if (properties.type === "Material" && properties.parentID !== Uuid.NULL) { if (properties.type === "Material" && properties.parentID !== Uuid.NONE) {
var parentType = Entities.getEntityProperties(properties.parentID, ["type"]).type; var parentType = Entities.getEntityProperties(properties.parentID, ["type"]).type;
if (parentType === "Model" || Entities.getNestableType(properties.parentID) === "avatar") { if (parentType === "Model" || Entities.getNestableType(properties.parentID) === "avatar") {
parentModelData = Graphics.getModel(properties.parentID); parentModelData = Graphics.getModel(properties.parentID);
@ -3313,7 +3313,7 @@
var state = "NONE"; var state = "NONE";
var properties = Entities.getEntityProperties(id, ["parentID"]); var properties = Entities.getEntityProperties(id, ["parentID"]);
var children = createApp.getDomainOnlyChildrenIDs(id); var children = createApp.getDomainOnlyChildrenIDs(id);
if (properties.parentID !== Uuid.NULL) { if (properties.parentID !== Uuid.NONE) {
if (children.length > 0) { if (children.length > 0) {
state = "PARENT_CHILDREN"; state = "PARENT_CHILDREN";
} else { } else {

View file

@ -428,7 +428,7 @@ SelectionManager = (function() {
entityID: newEntityID, entityID: newEntityID,
properties: properties properties: properties
}); });
if (properties.parentID !== Uuid.NULL) { if (properties.parentID !== Uuid.NONE) {
duplicatedChildrenWithOldParents[newEntityID] = properties.parentID; duplicatedChildrenWithOldParents[newEntityID] = properties.parentID;
} }
originalEntityToNewEntityID[originalEntityID] = newEntityID; originalEntityToNewEntityID[originalEntityID] = newEntityID;
@ -480,7 +480,7 @@ SelectionManager = (function() {
entityID: newEntityID, entityID: newEntityID,
properties: properties properties: properties
}); });
if (properties.parentID !== Uuid.NULL) { if (properties.parentID !== Uuid.NONE) {
createdChildrenWithOldParents[newEntityID] = properties.parentID; createdChildrenWithOldParents[newEntityID] = properties.parentID;
} }
originalEntityToNewEntityID[properties.id] = newEntityID; originalEntityToNewEntityID[properties.id] = newEntityID;
@ -755,7 +755,7 @@ SelectionManager = (function() {
that.selections = []; that.selections = [];
for (var i = 0; i < currentSelection.length; i++) { for (var i = 0; i < currentSelection.length; i++) {
var properties = Entities.getEntityProperties(currentSelection[i], ['parentID']); var properties = Entities.getEntityProperties(currentSelection[i], ['parentID']);
if (properties.parentID !== Uuid.NULL) { if (properties.parentID !== Uuid.NONE) {
that.selections.push(properties.parentID); that.selections.push(properties.parentID);
} }
} }
@ -772,7 +772,7 @@ SelectionManager = (function() {
that.selections = []; that.selections = [];
for (var i = 0; i < currentSelection.length; i++) { for (var i = 0; i < currentSelection.length; i++) {
var topParentId = getTopParent(currentSelection[i]); var topParentId = getTopParent(currentSelection[i]);
if (topParentId !== Uuid.NULL) { if (topParentId !== Uuid.NONE) {
that.selections.push(topParentId); that.selections.push(topParentId);
} }
} }
@ -784,9 +784,9 @@ SelectionManager = (function() {
}; };
function getTopParent(id) { function getTopParent(id) {
var topParentId = Uuid.NULL; var topParentId = Uuid.NONE;
var properties = Entities.getEntityProperties(id, ['parentID']); var properties = Entities.getEntityProperties(id, ['parentID']);
if (properties.parentID === Uuid.NULL) { if (properties.parentID === Uuid.NONE) {
topParentId = id; topParentId = id;
} else { } else {
topParentId = getTopParent(properties.parentID); topParentId = getTopParent(properties.parentID);
@ -1567,7 +1567,7 @@ SelectionDisplay = (function() {
} else if (toolEntity === handleTranslateZCylinder) { } else if (toolEntity === handleTranslateZCylinder) {
return handleTranslateZCone; return handleTranslateZCone;
} }
return Uuid.NULL; return Uuid.NONE;
}; };
that.updateHighlight = function(event) { that.updateHighlight = function(event) {

View file

@ -317,7 +317,7 @@ var isAnothersAvatarEntity = function (iaaeProps) {
}; };
var isAnothersChildEntity = function (iaceProps) { var isAnothersChildEntity = function (iaceProps) {
while (iaceProps.parentID && iaceProps.parentID !== Uuid.NULL) { while (iaceProps.parentID && iaceProps.parentID !== Uuid.NONE) {
if (Entities.getNestableType(iaceProps.parentID) == "avatar") { if (Entities.getNestableType(iaceProps.parentID) == "avatar") {
if (iaceProps.parentID == MyAvatar.SELF_ID || iaceProps.parentID == MyAvatar.sessionUUID) { if (iaceProps.parentID == MyAvatar.SELF_ID || iaceProps.parentID == MyAvatar.sessionUUID) {
return false; // not another's, it's mine. return false; // not another's, it's mine.
@ -452,7 +452,7 @@ var ensureDynamic = function (entityID) {
// if we distance hold something and keep it very still before releasing it, it ends up // if we distance hold something and keep it very still before releasing it, it ends up
// non-dynamic in bullet. If it's too still, give it a little bounce so it will fall. // non-dynamic in bullet. If it's too still, give it a little bounce so it will fall.
var edProps = Entities.getEntityProperties(entityID, ["velocity", "dynamic", "parentID"]); var edProps = Entities.getEntityProperties(entityID, ["velocity", "dynamic", "parentID"]);
if (edProps.dynamic && edProps.parentID === Uuid.NULL) { if (edProps.dynamic && edProps.parentID === Uuid.NONE) {
var velocity = edProps.velocity; var velocity = edProps.velocity;
if (Vec3.length(velocity) < 0.05) { // see EntityMotionState.cpp DYNAMIC_LINEAR_VELOCITY_THRESHOLD if (Vec3.length(velocity) < 0.05) { // see EntityMotionState.cpp DYNAMIC_LINEAR_VELOCITY_THRESHOLD
velocity = { x: 0.0, y: 0.2, z: 0.0 }; velocity = { x: 0.0, y: 0.2, z: 0.0 };
@ -464,7 +464,7 @@ var ensureDynamic = function (entityID) {
var findGrabbableGroupParent = function (controllerData, targetProps) { var findGrabbableGroupParent = function (controllerData, targetProps) {
while (targetProps.grab.grabDelegateToParent && while (targetProps.grab.grabDelegateToParent &&
targetProps.parentID && targetProps.parentID &&
targetProps.parentID !== Uuid.NULL && targetProps.parentID !== Uuid.NONE &&
Entities.getNestableType(targetProps.parentID) == "entity") { Entities.getNestableType(targetProps.parentID) == "entity") {
var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES); var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES);
if (!parentProps) { if (!parentProps) {
@ -484,7 +484,7 @@ var findGrabbableGroupParent = function (controllerData, targetProps) {
var getEntityParents = function(targetProps) { var getEntityParents = function(targetProps) {
var parentProperties = []; var parentProperties = [];
while (targetProps.parentID && while (targetProps.parentID &&
targetProps.parentID !== Uuid.NULL && targetProps.parentID !== Uuid.NONE &&
Entities.getNestableType(targetProps.parentID) == "entity") { Entities.getNestableType(targetProps.parentID) == "entity") {
var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES); var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES);
if (!parentProps) { if (!parentProps) {

View file

@ -13,21 +13,21 @@
var controllerDispatcher = Script.require("/~/system/libraries/controllerDispatcherUtils.js"); var controllerDispatcher = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
function touchTargetHasKeyboardFocus(touchTarget) { function touchTargetHasKeyboardFocus(touchTarget) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE) {
return Entities.keyboardFocusEntity === touchTarget.entityID; return Entities.keyboardFocusEntity === touchTarget.entityID;
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
return Overlays.keyboardFocusOverlay === touchTarget.overlayID; return Overlays.keyboardFocusOverlay === touchTarget.overlayID;
} }
} }
function setKeyboardFocusOnTouchTarget(touchTarget) { function setKeyboardFocusOnTouchTarget(touchTarget) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL && if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE &&
Entities.wantsHandControllerPointerEvents(touchTarget.entityID)) { Entities.wantsHandControllerPointerEvents(touchTarget.entityID)) {
Overlays.keyboardFocusOverlay = Uuid.NULL; Overlays.keyboardFocusOverlay = Uuid.NONE;
Entities.keyboardFocusEntity = touchTarget.entityID; Entities.keyboardFocusEntity = touchTarget.entityID;
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
Overlays.keyboardFocusOverlay = touchTarget.overlayID; Overlays.keyboardFocusOverlay = touchTarget.overlayID;
Entities.keyboardFocusEntity = Uuid.NULL; Entities.keyboardFocusEntity = Uuid.NONE;
} }
} }
@ -42,9 +42,9 @@ function sendHoverEnterEventToTouchTarget(hand, touchTarget) {
button: "None" button: "None"
}; };
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE) {
Entities.sendHoverEnterEntity(touchTarget.entityID, pointerEvent); Entities.sendHoverEnterEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
Overlays.sendHoverEnterOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendHoverEnterOverlay(touchTarget.overlayID, pointerEvent);
} }
} }
@ -60,10 +60,10 @@ function sendHoverOverEventToTouchTarget(hand, touchTarget) {
button: "None" button: "None"
}; };
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE) {
Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoverOverEntity(touchTarget.entityID, pointerEvent); Entities.sendHoverOverEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent);
Overlays.sendHoverOverOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendHoverOverOverlay(touchTarget.overlayID, pointerEvent);
} }
@ -81,10 +81,10 @@ function sendTouchStartEventToTouchTarget(hand, touchTarget) {
isPrimaryHeld: true isPrimaryHeld: true
}; };
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE) {
Entities.sendMousePressOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMousePressOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendClickDownOnEntity(touchTarget.entityID, pointerEvent); Entities.sendClickDownOnEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
Overlays.sendMousePressOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMousePressOnOverlay(touchTarget.overlayID, pointerEvent);
} }
} }
@ -100,11 +100,11 @@ function sendTouchEndEventToTouchTarget(hand, touchTarget) {
button: "Primary" button: "Primary"
}; };
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE) {
Entities.sendMouseReleaseOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMouseReleaseOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendClickReleaseOnEntity(touchTarget.entityID, pointerEvent); Entities.sendClickReleaseOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoverLeaveEntity(touchTarget.entityID, pointerEvent); Entities.sendHoverLeaveEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
Overlays.sendMouseReleaseOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMouseReleaseOnOverlay(touchTarget.overlayID, pointerEvent);
} }
} }
@ -121,10 +121,10 @@ function sendTouchMoveEventToTouchTarget(hand, touchTarget) {
isPrimaryHeld: true isPrimaryHeld: true
}; };
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NONE) {
Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoldingClickOnEntity(touchTarget.entityID, pointerEvent); Entities.sendHoldingClickOnEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NONE) {
Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent);
} }
} }

View file

@ -442,7 +442,7 @@
function release() { function release() {
Entities.editEntity(miniOverlay, { Entities.editEntity(miniOverlay, {
"parentID": Uuid.NULL, // Release hold so that hand can grab tablet proper. "parentID": Uuid.NONE, // Release hold so that hand can grab tablet proper.
"grab": { "grab": {
"grabbable": false "grabbable": false
} }

View file

@ -23,7 +23,7 @@ const SIZE_Y = 0.075;
const LETTER_OFFSET = 0.03; // arbitrary value to dynamically change width, could be more accurate by detecting characters const LETTER_OFFSET = 0.03; // arbitrary value to dynamically change width, could be more accurate by detecting characters
const LINE_HEIGHT = 0.05; const LINE_HEIGHT = 0.05;
var nameTagEntityID = Uuid.NULL; var nameTagEntityID = Uuid.NONE;
var lastCheckForEntity = 0; var lastCheckForEntity = 0;
// create the name tag entity after a brief delay // create the name tag entity after a brief delay
@ -61,9 +61,9 @@ function updateNameTag() {
}; };
function deleteNameTag() { function deleteNameTag() {
if(nameTagEntityID !== Uuid.NULL) { if(nameTagEntityID !== Uuid.NONE) {
Entities.deleteEntity(nameTagEntityID); Entities.deleteEntity(nameTagEntityID);
nameTagEntityID = Uuid.NULL; nameTagEntityID = Uuid.NONE;
} }
} }
@ -84,7 +84,7 @@ function cleanup() {
Script.update.connect(update); Script.update.connect(update);
function update() { function update() {
// if no entity we return // if no entity we return
if(nameTagEntityID == Uuid.NULL) { if(nameTagEntityID == Uuid.NONE) {
return; return;
} }

View file

@ -47,7 +47,7 @@
var HMD_UI_SCALE_FACTOR = 1.0; //This define the size of all the notification system in HMD. var HMD_UI_SCALE_FACTOR = 1.0; //This define the size of all the notification system in HMD.
var hmdPanelLocalPosition = {"x": 0.3, "y": 0.25, "z": -1.5}; var hmdPanelLocalPosition = {"x": 0.3, "y": 0.25, "z": -1.5};
var hmdPanelLocalRotation = Quat.fromVec3Degrees({"x": 0, "y": -3, "z": 0}); var hmdPanelLocalRotation = Quat.fromVec3Degrees({"x": 0, "y": -3, "z": 0});
var mainHMDnotificationContainerID = Uuid.NULL; var mainHMDnotificationContainerID = Uuid.NONE;
var CAMERA_MATRIX_INDEX = -7; var CAMERA_MATRIX_INDEX = -7;
//HMD LOCAL ENTITY PROPERTIES //HMD LOCAL ENTITY PROPERTIES
@ -128,7 +128,7 @@
"unlit": true, "unlit": true,
"renderLayer": "hud" "renderLayer": "hud"
}; };
if (notifications[i].entityID === Uuid.NULL){ if (notifications[i].entityID === Uuid.NONE){
properties.text = notifications[i].dataText; properties.text = notifications[i].dataText;
notifications[i].entityID = Entities.addEntity(properties, "local"); notifications[i].entityID = Entities.addEntity(properties, "local");
} else { } else {
@ -149,7 +149,7 @@
"alpha": alpha, "alpha": alpha,
"renderLayer": "hud" "renderLayer": "hud"
}; };
if (notifications[i].imageEntityID === Uuid.NULL){ if (notifications[i].imageEntityID === Uuid.NONE){
properties.imageURL = notifications[i].dataImage.path; properties.imageURL = notifications[i].dataImage.path;
notifications[i].imageEntityID = Entities.addEntity(properties, "local"); notifications[i].imageEntityID = Entities.addEntity(properties, "local");
} else { } else {
@ -174,7 +174,7 @@
"leftMargin": overlayLeftMargin, "leftMargin": overlayLeftMargin,
"font": {"size": overlayFontSize} "font": {"size": overlayFontSize}
}; };
if (notifications[i].overlayID === Uuid.NULL){ if (notifications[i].overlayID === Uuid.NONE){
properties.text = notifications[i].dataText; properties.text = notifications[i].dataText;
notifications[i].overlayID = Overlays.addOverlay("text", properties); notifications[i].overlayID = Overlays.addOverlay("text", properties);
} else { } else {
@ -192,7 +192,7 @@
"visible": true, "visible": true,
"alpha": alpha "alpha": alpha
}; };
if (notifications[i].imageOverlayID === Uuid.NULL){ if (notifications[i].imageOverlayID === Uuid.NONE){
properties.imageURL = notifications[i].dataImage.path; properties.imageURL = notifications[i].dataImage.path;
notifications[i].imageOverlayID = Overlays.addOverlay("image", properties); notifications[i].imageOverlayID = Overlays.addOverlay("image", properties);
} else { } else {
@ -214,26 +214,26 @@
} }
function deleteSpecificNotification(indexNotification) { function deleteSpecificNotification(indexNotification) {
if (notifications[indexNotification].entityID !== Uuid.NULL){ if (notifications[indexNotification].entityID !== Uuid.NONE){
Entities.deleteEntity(notifications[indexNotification].entityID); Entities.deleteEntity(notifications[indexNotification].entityID);
notifications[indexNotification].entityID = Uuid.NULL; notifications[indexNotification].entityID = Uuid.NONE;
} }
if (notifications[indexNotification].overlayID !== Uuid.NULL){ if (notifications[indexNotification].overlayID !== Uuid.NONE){
Overlays.deleteOverlay(notifications[indexNotification].overlayID); Overlays.deleteOverlay(notifications[indexNotification].overlayID);
notifications[indexNotification].overlayID = Uuid.NULL; notifications[indexNotification].overlayID = Uuid.NONE;
} }
if (notifications[indexNotification].imageEntityID !== Uuid.NULL){ if (notifications[indexNotification].imageEntityID !== Uuid.NONE){
Entities.deleteEntity(notifications[indexNotification].imageEntityID); Entities.deleteEntity(notifications[indexNotification].imageEntityID);
notifications[indexNotification].imageEntityID = Uuid.NULL; notifications[indexNotification].imageEntityID = Uuid.NONE;
} }
if (notifications[indexNotification].imageOverlayID !== Uuid.NULL){ if (notifications[indexNotification].imageOverlayID !== Uuid.NONE){
Overlays.deleteOverlay(notifications[indexNotification].imageOverlayID); Overlays.deleteOverlay(notifications[indexNotification].imageOverlayID);
notifications[indexNotification].imageOverlayID = Uuid.NULL; notifications[indexNotification].imageOverlayID = Uuid.NONE;
} }
} }
function createMainHMDnotificationContainer() { function createMainHMDnotificationContainer() {
if (mainHMDnotificationContainerID === Uuid.NULL) { if (mainHMDnotificationContainerID === Uuid.NONE) {
var properties = { var properties = {
"type": "Shape", "type": "Shape",
"shape": "Cube", "shape": "Cube",
@ -249,9 +249,9 @@
} }
function deleteMainHMDnotificationContainer() { function deleteMainHMDnotificationContainer() {
if (mainHMDnotificationContainerID !== Uuid.NULL) { if (mainHMDnotificationContainerID !== Uuid.NONE) {
Entities.deleteEntity(mainHMDnotificationContainerID); Entities.deleteEntity(mainHMDnotificationContainerID);
mainHMDnotificationContainerID = Uuid.NULL; mainHMDnotificationContainerID = Uuid.NONE;
} }
} }
//UTILITY FUNCTIONS //UTILITY FUNCTIONS
@ -288,10 +288,10 @@
"dataText": dataText, "dataText": dataText,
"dataImage": dataImage, "dataImage": dataImage,
"timestamp": d.getTime(), "timestamp": d.getTime(),
"entityID": Uuid.NULL, "entityID": Uuid.NONE,
"imageEntityID": Uuid.NULL, "imageEntityID": Uuid.NONE,
"overlayID": Uuid.NULL, "overlayID": Uuid.NONE,
"imageOverlayID": Uuid.NULL "imageOverlayID": Uuid.NONE
}; };
notifications.push(notification); notifications.push(notification);
newEventDetected = true; newEventDetected = true;