From 0945bdaac7c30406b11bb418b0744f7cef4f5f8e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 20 Jun 2019 15:11:01 +1200 Subject: [PATCH] Remainder of Entities methods' JSDoc --- .../entities/src/EntityScriptingInterface.h | 430 +++++++++++------- .../octree/src/OctreeScriptingInterface.h | 30 +- libraries/script-engine/src/ScriptEngine.cpp | 3 + libraries/shared/src/PointerEvent.cpp | 2 +- 4 files changed, 297 insertions(+), 168 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 1a34fd2139..d38f2917a7 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -177,13 +177,12 @@ public: public slots: /**jsdoc - * Check whether or not you can change the locked property of entities. Locked entities have their - * locked property set to true and cannot be edited or deleted. Whether or not you can change - * entities' locked properties is configured in the domain server's permissions. + * Checks whether or not the script can change the locked property of entities. Locked entities have their + * locked property set to true and cannot be edited or deleted. * @function Entities.canAdjustLocks - * @returns {boolean} true if the client can change the locked property of entities, - * otherwise false. - * @example Set an entity's locked property to true if you can. + * @returns {boolean} true if the domain server will allow the script to change the locked + * property of entities, otherwise false. + * @example Lock an entity if you can. * if (Entities.canAdjustLocks()) { * Entities.editEntity(entityID, { locked: true }); * } else { @@ -193,42 +192,43 @@ public slots: Q_INVOKABLE bool canAdjustLocks(); /**jsdoc - * Check whether or not you can rez (create) new entities in the domain. + * Checks whether or not the script can rez (create) new entities in the domain. * @function Entities.canRez - * @returns {boolean} true if the domain server will allow the script to rez (create) new entities, - * otherwise false. + * @returns {boolean} true if the domain server will allow the script to rez (create) new entities, otherwise + * false. */ Q_INVOKABLE bool canRez(); /**jsdoc - * Check whether or not you can rez (create) new temporary entities in the domain. Temporary entities are entities with a - * finite lifetime property value set. + * Checks whether or not the script can rez (create) new temporary entities in the domain. Temporary entities are entities + * with a finite lifetime property value set. * @function Entities.canRezTmp - * @returns {boolean} true if the domain server will allow the script to rez (create) new temporary - * entities, otherwise false. + * @returns {boolean} true if the domain server will allow the script to rez (create) new temporary entities, + * otherwise false. */ Q_INVOKABLE bool canRezTmp(); /**jsdoc - * Check whether or not you can rez (create) new certified entities in the domain. Certified entities are entities that have - * PoP certificates. + * Checks whether or not the script can rez (create) new certified entities in the domain. Certified entities are entities + * that have PoP certificates. * @function Entities.canRezCertified - * @returns {boolean} true if the domain server will allow the script to rez (create) new certified - * entities, otherwise false. + * @returns {boolean} true if the domain server will allow the script to rez (create) new certified entities, + * otherwise false. */ Q_INVOKABLE bool canRezCertified(); /**jsdoc - * Check whether or not you can rez (create) new temporary certified entities in the domain. Temporary entities are entities - * with a finite lifetime property value set. Certified entities are entities that have PoP certificates. + * Checks whether or not the script can rez (create) new temporary certified entities in the domain. Temporary entities are + * entities with a finite lifetime property value set. Certified entities are entities that have PoP + * certificates. * @function Entities.canRezTmpCertified - * @returns {boolean} true if the domain server will allow the script to rez (create) new temporary - * certified entities, otherwise false. + * @returns {boolean} true if the domain server will allow the script to rez (create) new temporary certified + * entities, otherwise false. */ Q_INVOKABLE bool canRezTmpCertified(); /**jsdoc - * Check whether or not you can make changes to the asset server's assets. + * Checks whether or not the script can make changes to the asset server's assets. * @function Entities.canWriteAssets * @returns {boolean} true if the domain server will allow the script to make changes to the asset server's * assets, otherwise false. @@ -236,7 +236,7 @@ public slots: Q_INVOKABLE bool canWriteAssets(); /**jsdoc - * Check whether or not you can replace the domain's content set. + * Checks whether or not the script can replace the domain's content set. * @function Entities.canReplaceContent * @returns {boolean} true if the domain server will allow the script to replace the domain's content set, * otherwise false. @@ -244,10 +244,10 @@ public slots: Q_INVOKABLE bool canReplaceContent(); /**jsdoc - * Check whether or not you can get and set private user data. + * Checks whether or not the script can get and set the privateUserData property of entities. * @function Entities.canGetAndSetPrivateUserData - * @returns {boolean} true if the domain server will allow the user to get and set private user data, - * otherwise false. + * @returns {boolean} true if the domain server will allow the script to get and set the + * privateUserData property of entities, otherwise false. */ Q_INVOKABLE bool canGetAndSetPrivateUserData(); @@ -411,11 +411,13 @@ public slots: /**jsdoc * Gets an entity's script object. In particular, this is useful for accessing a {@link Entities.EntityProperties-Web|Web} - * entity's event bridge. + * entity's HTML EventBridge script object to exchange messages with the web page script. + *

Alternatively, you can use {@link Entities.emitScriptEvent} and {@link Entities.webEventReceived} to exchange + * messages with a Web entity over its event bridge.

* @function Entities.getEntityObject * @param {Uuid} id - The ID of the entity to get the script object for. * @returns {object} The script object for the entity if found. - * @example Receive "hello" messages from a Web entity. + * @example Exchange messages with a Web entity. * // HTML file, name: "webEntity.html". * * @@ -425,10 +427,17 @@ public slots: * *

HELLO

* * * @@ -439,17 +448,23 @@ public slots: * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -3 })), * rotation: MyAvatar.orientation, * sourceUrl: Script.resolvePath("webEntity.html"), - * alpha: 1.0 + * alpha: 1.0, + * lifetime: 300 // 5 min * }); + * + * var webEntityObject; * - * function onWebEventReceived(event) { - * print("onWebEventReceived() : " + JSON.stringify(event)); + * function onWebEventReceived(message) { + * // Message received. + * print("Message received: " + message); + * + * // Send a message back. + * webEntityObject.emitScriptEvent(message + " back"); * } * * Script.setTimeout(function () { - * var entityObject = Entities.getEntityObject(webEntity); - * print("$$$$ entityObject: " + entityObject); - * entityObject.webEventReceived.connect(onWebEventReceived); + * webEntityObject = Entities.getEntityObject(webEntity); + * webEntityObject.webEventReceived.connect(onWebEventReceived); * }, 500); * * Script.scriptEnding.connect(function () { @@ -468,10 +483,10 @@ public slots: Q_INVOKABLE bool isLoaded(const QUuid& id); /**jsdoc - * Check if there is an object of a given ID. + * Checks if there is an entity with a specified ID. * @function Entities.isAddedEntity * @param {Uuid} id - The ID to check. - * @returns {boolean} true if an object with the given ID exists, false otherwise. + * @returns {boolean} true if an entity with the specified ID exists, false if it doesn't. */ Q_INVOKABLE bool isAddedEntity(const QUuid& id); @@ -486,7 +501,7 @@ public slots: Q_INVOKABLE QSizeF textSize(const QUuid& id, const QString& text); /**jsdoc - * Call a method in a client entity script from a client script or client entity script, or call a method in a server + * Calls a method in a client entity script from a client script or client entity script, or calls a method in a server * entity script from a server entity script. The entity script method must be exposed as a property in the target client * entity script. Additionally, if calling a server entity script, the server entity script must include the method's name * in an exposed property called remotelyCallable that is an array of method names that can be called. @@ -498,7 +513,7 @@ public slots: Q_INVOKABLE void callEntityMethod(const QUuid& entityID, const QString& method, const QStringList& params = QStringList()); /**jsdoc - * Call a method in a server entity script from a client script or client entity script. The entity script method must be + * Calls a method in a server entity script from a client script or client entity script. The entity script method must be * exposed as a property in the target server entity script. Additionally, the target server entity script must include the * method's name in an exposed property called remotelyCallable that is an array of method names that can be * called. @@ -510,7 +525,7 @@ public slots: Q_INVOKABLE void callEntityServerMethod(const QUuid& entityID, const QString& method, const QStringList& params = QStringList()); /**jsdoc - * Call a method in a specific user's client entity script from a server entity script. The entity script method must be + * Calls a method in a specific user's client entity script from a server entity script. The entity script method must be * exposed as a property in the target client entity script. * @function Entities.callEntityClientMethod * @param {Uuid} clientSessionID - The session ID of the user to call the method in. @@ -652,14 +667,14 @@ public slots: Q_INVOKABLE bool reloadServerScripts(const QUuid& entityID); /**jsdoc - * Gets the status of server entity script attached to an entity + * Gets the status of a server entity script attached to an entity. * @function Entities.getServerScriptStatus - * @param {Uuid} entityID - The ID of the entity to get the server entity script status for. + * @param {Uuid} entityID - The ID of the entity to get the server entity script status of. * @param {Entities~getServerScriptStatusCallback} callback - The function to call upon completion. * @returns {boolean} true always. */ /**jsdoc - * Called when {@link Entities.getServerScriptStatus} is complete. + * Called when a {@link Entities.getServerScriptStatus} call is complete. * @callback Entities~getServerScriptStatusCallback * @param {boolean} success - true if the server entity script status could be obtained, otherwise * false. @@ -703,18 +718,18 @@ public slots: /**jsdoc - * Set whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Light|Light} entities. By + * Sets whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Light|Light} entities. By * default, Light entities are not intersected. The setting lasts for the Interface session. Ray picks are done using - * {@link Entities.findRayIntersection|findRayIntersection}, or the {@link Picks} API. + * {@link Entities.findRayIntersection|findRayIntersection}, or the {@link Picks} API. * @function Entities.setLightsArePickable - * @param {boolean} value - Set true to make ray picks intersect the bounding box of + * @param {boolean} value - true to make ray picks intersect the bounding box of * {@link Entities.EntityProperties-Light|Light} entities, otherwise false. */ // FIXME move to a renderable entity interface Q_INVOKABLE void setLightsArePickable(bool value); /**jsdoc - * Get whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Light|Light} entities. Ray + * Gets whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Light|Light} entities. Ray * picks are done using {@link Entities.findRayIntersection|findRayIntersection}, or the {@link Picks} API. * @function Entities.getLightsArePickable * @returns {boolean} true if ray picks intersect the bounding box of @@ -724,18 +739,18 @@ public slots: Q_INVOKABLE bool getLightsArePickable() const; /**jsdoc - * Set whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Zone|Zone} entities. By - * default, Light entities are not intersected. The setting lasts for the Interface session. Ray picks are done using + * Sets whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Zone|Zone} entities. By + * default, Zone entities are not intersected. The setting lasts for the Interface session. Ray picks are done using * {@link Entities.findRayIntersection|findRayIntersection}, or the {@link Picks} API. * @function Entities.setZonesArePickable - * @param {boolean} value - Set true to make ray picks intersect the bounding box of + * @param {boolean} value - true to make ray picks intersect the bounding box of * {@link Entities.EntityProperties-Zone|Zone} entities, otherwise false. */ // FIXME move to a renderable entity interface Q_INVOKABLE void setZonesArePickable(bool value); /**jsdoc - * Get whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Zone|Zone} entities. Ray + * Gets whether or not ray picks intersect the bounding box of {@link Entities.EntityProperties-Zone|Zone} entities. Ray * picks are done using {@link Entities.findRayIntersection|findRayIntersection}, or the {@link Picks} API. * @function Entities.getZonesArePickable * @returns {boolean} true if ray picks intersect the bounding box of @@ -745,17 +760,17 @@ public slots: Q_INVOKABLE bool getZonesArePickable() const; /**jsdoc - * Set whether or not {@link Entities.EntityProperties-Zone|Zone} entities' boundaries should be drawn. Currently not + * Sets whether or not {@link Entities.EntityProperties-Zone|Zone} entities' boundaries should be drawn. Currently not * used. * @function Entities.setDrawZoneBoundaries - * @param {boolean} value - Set to true if {@link Entities.EntityProperties-Zone|Zone} entities' boundaries - * should be drawn, otherwise false. + * @param {boolean} value - true if {@link Entities.EntityProperties-Zone|Zone} entities' boundaries should be + * drawn, otherwise false. */ // FIXME move to a renderable entity interface Q_INVOKABLE void setDrawZoneBoundaries(bool value); /**jsdoc - * Get whether or not {@link Entities.EntityProperties-Zone|Zone} entities' boundaries should be drawn. Currently + * Gets whether or not {@link Entities.EntityProperties-Zone|Zone} entities' boundaries should be drawn. Currently * not used. * @function Entities.getDrawZoneBoundaries * @returns {boolean} true if {@link Entities.EntityProperties-Zone|Zone} entities' boundaries should be @@ -876,9 +891,9 @@ public slots: Q_INVOKABLE bool setVoxelsInCuboid(const QUuid& entityID, const glm::vec3& lowPosition, const glm::vec3& cuboidSize, int value); /**jsdoc - * Convert voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity to world coordinates. Voxel coordinates are - * relative to the minimum axes values corner of the entity with a scale of Vec3.ONE being the dimensions of - * each voxel. + * Converts voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity to world coordinates. Voxel + * coordinates are relative to the minimum axes values corner of the entity with a scale of Vec3.ONE being the + * dimensions of each voxel. * @function Entities.voxelCoordsToWorldCoords * @param {Uuid} entityID - The ID of the {@link Entities.EntityProperties-PolyVox|PolyVox} entity. * @param {Vec3} voxelCoords - The voxel coordinates. May be fractional and outside the entity's bounding box. @@ -911,21 +926,24 @@ public slots: Q_INVOKABLE glm::vec3 voxelCoordsToWorldCoords(const QUuid& entityID, glm::vec3 voxelCoords); /**jsdoc - * Convert world coordinates to voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity. Voxel coordinates are - * relative to the minimum axes values corner of the entity, with a scale of Vec3.ONE being the dimensions of - * each voxel. + * Converts world coordinates to voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity. Voxel + * coordinates are relative to the minimum axes values corner of the entity, with a scale of Vec3.ONE being + * the dimensions of each voxel. * @function Entities.worldCoordsToVoxelCoords * @param {Uuid} entityID - The ID of the {@link Entities.EntityProperties-PolyVox|PolyVox} entity. * @param {Vec3} worldCoords - The world coordinates. May be outside the entity's bounding box. * @returns {Vec3} The voxel coordinates of the worldCoords if the entityID is a - * {@link Entities.EntityProperties-PolyVox|PolyVox} entity, otherwise {@link Vec3(0)|Vec3.ZERO}. The value may be fractional. + * {@link Entities.EntityProperties-PolyVox|PolyVox} entity, otherwise {@link Vec3(0)|Vec3.ZERO}. The value may be + * fractional and outside the entity's bounding box. */ // FIXME move to a renderable entity interface Q_INVOKABLE glm::vec3 worldCoordsToVoxelCoords(const QUuid& entityID, glm::vec3 worldCoords); /**jsdoc - * Convert voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity to local coordinates relative to the minimum - * axes value corner of the entity, with the scale being the same as world coordinates. + * Converts voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity to local coordinates. Local + * coordinates are relative to the minimum axes value corner of the entity, with the scale being the same as world + * coordinates. Voxel coordinates are relative to the minimum axes values corner of the entity, with a scale of + * Vec3.ONE being the dimensions of each voxel. * @function Entities.voxelCoordsToLocalCoords * @param {Uuid} entityID - The ID of the {@link Entities.EntityProperties-PolyVox|PolyVox} entity. * @param {Vec3} voxelCoords - The voxel coordinates. May be fractional and outside the entity's bounding box. @@ -946,13 +964,16 @@ public slots: Q_INVOKABLE glm::vec3 voxelCoordsToLocalCoords(const QUuid& entityID, glm::vec3 voxelCoords); /**jsdoc - * Convert local coordinates to voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity. Local coordinates are - * relative to the minimum axes value corner of the entity, with the scale being the same as world coordinates. + * Converts local coordinates to voxel coordinates in a {@link Entities.EntityProperties-PolyVox|PolyVox} entity. Local + * coordinates are relative to the minimum axes value corner of the entity, with the scale being the same as world + * coordinates. Voxel coordinates are relative to the minimum axes values corner of the entity, with a scale of + * Vec3.ONE being the dimensions of each voxel. * @function Entities.localCoordsToVoxelCoords * @param {Uuid} entityID - The ID of the {@link Entities.EntityProperties-PolyVox|PolyVox} entity. * @param {Vec3} localCoords - The local coordinates. May be outside the entity's bounding box. * @returns {Vec3} The voxel coordinates of the worldCoords if the entityID is a - * {@link Entities.EntityProperties-PolyVox|PolyVox} entity, otherwise {@link Vec3(0)|Vec3.ZERO}. The value may be fractional. + * {@link Entities.EntityProperties-PolyVox|PolyVox} entity, otherwise {@link Vec3(0)|Vec3.ZERO}. The value may be + * fractional and outside the entity's bounding box. */ // FIXME move to a renderable entity interface Q_INVOKABLE glm::vec3 localCoordsToVoxelCoords(const QUuid& entityID, glm::vec3 localCoords); @@ -1020,7 +1041,8 @@ public slots: Q_INVOKABLE bool appendPoint(const QUuid& entityID, const glm::vec3& point); /**jsdoc - * Dumps debug information about all entities in Interface's local in-memory tree of entities it knows about to the program log. + * Dumps debug information about all entities in Interface's local in-memory tree of entities it knows about to the program + * log. * @function Entities.dumpTree */ Q_INVOKABLE void dumpTree() const; @@ -1125,7 +1147,7 @@ public slots: * @example Compare the local and absolute rotations of an avatar model's left hand joint. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1170,7 +1192,7 @@ public slots: * @example Raise an avatar model's left palm. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1210,7 +1232,7 @@ public slots: * @example Report the local rotation of an avatar model's head joint. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1251,7 +1273,7 @@ public slots: * @example Make an avatar model turn its head left. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1292,7 +1314,7 @@ public slots: * @example Raise both palms of an avatar model. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1352,7 +1374,7 @@ public slots: * @example Report the index of a model's head joint. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1377,7 +1399,7 @@ public slots: * @example Report a model's joint names. * entityID = Entities.addEntity({ * type: "Model", - * modelURL: "https://hifi-content.s3.amazonaws.com/milad/production/Examples/Models/Avatars/blue_suited.fbx", + * modelURL: "https://github.com/highfidelity/hifi-api-docs/blob/master/docs/blue_suited.fbx?raw=true", * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })), * rotation: MyAvatar.orientation, * lifetime: 300 // Delete after 5 minutes. @@ -1522,7 +1544,7 @@ public slots: Q_INVOKABLE void setKeyboardFocusEntity(const QUuid& id); /**jsdoc - * Emit a {@link Entities.mousePressOnEntity|mousePressOnEntity} event. + * Emits a {@link Entities.mousePressOnEntity|mousePressOnEntity} event. * @function Entities.sendMousePressOnEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1530,7 +1552,7 @@ public slots: Q_INVOKABLE void sendMousePressOnEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.mouseMoveOnEntity|mouseMoveOnEntity} event. + * Emits a {@link Entities.mouseMoveOnEntity|mouseMoveOnEntity} event. * @function Entities.sendMouseMoveOnEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1538,7 +1560,7 @@ public slots: Q_INVOKABLE void sendMouseMoveOnEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.mouseReleaseOnEntity|mouseReleaseOnEntity} event. + * Emits a {@link Entities.mouseReleaseOnEntity|mouseReleaseOnEntity} event. * @function Entities.sendMouseReleaseOnEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1546,7 +1568,7 @@ public slots: Q_INVOKABLE void sendMouseReleaseOnEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.clickDownOnEntity|clickDownOnEntity} event. + * Emits a {@link Entities.clickDownOnEntity|clickDownOnEntity} event. * @function Entities.sendClickDownOnEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1554,7 +1576,7 @@ public slots: Q_INVOKABLE void sendClickDownOnEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.holdingClickOnEntity|holdingClickOnEntity} event. + * Emits a {@link Entities.holdingClickOnEntity|holdingClickOnEntity} event. * @function Entities.sendHoldingClickOnEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1562,7 +1584,7 @@ public slots: Q_INVOKABLE void sendHoldingClickOnEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.clickReleaseOnEntity|clickReleaseOnEntity} event. + * Emits a {@link Entities.clickReleaseOnEntity|clickReleaseOnEntity} event. * @function Entities.sendClickReleaseOnEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1570,7 +1592,7 @@ public slots: Q_INVOKABLE void sendClickReleaseOnEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.hoverEnterEntity|hoverEnterEntity} event. + * Emits a {@link Entities.hoverEnterEntity|hoverEnterEntity} event. * @function Entities.sendHoverEnterEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1578,7 +1600,7 @@ public slots: Q_INVOKABLE void sendHoverEnterEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.hoverOverEntity|hoverOverEntity} event. + * Emits a {@link Entities.hoverOverEntity|hoverOverEntity} event. * @function Entities.sendHoverOverEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1586,7 +1608,7 @@ public slots: Q_INVOKABLE void sendHoverOverEntity(const EntityItemID& id, const PointerEvent& event); /**jsdoc - * Emit a {@link Entities.hoverLeaveEntity|hoverLeaveEntity} event. + * Emits a {@link Entities.hoverLeaveEntity|hoverLeaveEntity} event. * @function Entities.sendHoverLeaveEntity * @param {Uuid} entityID - The ID of the entity to emit the event for. * @param {PointerEvent} event - The event details. @@ -1604,21 +1626,74 @@ public slots: Q_INVOKABLE bool wantsHandControllerPointerEvents(const QUuid& id); /**jsdoc - * Send a script event over a {@link Entities.EntityProperties-Web|Web} entity's EventBridge to the Web page's scripts. + * Sends a message to a {@link Entities.EntityProperties-Web|Web} entity's HTML page. To receive the message, the web + * page's script must connect to the EventBridge that is automatically provided to the script: + *
EventBridge.scriptEventReceived.connect(function(message) {
+     *     ...
+     * });
+ *

Use {@link Entities.webEventReceived} to receive messages from the Web entity's HTML page.

+ *

Alternatively, you can use {@link Entities.getEntityObject} to exchange messages over a Web entity's HTML event + * bridge.

* @function Entities.emitScriptEvent - * @param {Uuid} entityID - The ID of the {@link Entities.EntityProperties-Web|Web} entity. + * @param {Uuid} entityID - The ID of the Web entity to send the message to. * @param {string} message - The message to send. + * @example Exchange messages with a Web entity. + * // HTML file, name: "webEntity.html". + * + * + * + * HELLO + * + * + *

HELLO

+ * + * + * + * + * // Script file. + * var webEntity = Entities.addEntity({ + * type: "Web", + * position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -3 })), + * rotation: MyAvatar.orientation, + * sourceUrl: Script.resolvePath("webEntity.html"), + * alpha: 1.0, + * lifetime: 300 // 5 min + * }); + * + * function onWebEventReceived(entityID, message) { + * if (entityID === webEntity) { + * // Message received. + * print("Message received: " + message); + * + * // Send a message back. + * Entities.emitScriptEvent(webEntity, message + " back"); + * } + * } + * + * Entities.webEventReceived.connect(onWebEventReceived); */ Q_INVOKABLE void emitScriptEvent(const EntityItemID& entityID, const QVariant& message); /**jsdoc - * Check whether an axis-aligned box and a capsule intersect. + * Checks whether an axis-aligned box and a capsule intersect. * @function Entities.AABoxIntersectsCapsule * @param {Vec3} brn - The bottom right near (minimum axes values) corner of the AA box. * @param {Vec3} dimensions - The dimensions of the AA box. * @param {Vec3} start - One end of the capsule. * @param {Vec3} end - The other end of the capsule. - * @param {number} radius - The radiues of the capsule. + * @param {number} radius - The radius of the capsule. * @returns {boolean} true if the AA box and capsule intersect, otherwise false. */ Q_INVOKABLE bool AABoxIntersectsCapsule(const glm::vec3& low, const glm::vec3& dimensions, @@ -1709,123 +1784,174 @@ public slots: /**jsdoc + * Converts a position in world coordinates to a position in an avatar, entity, or joint's local coordinates. * @function Entities.worldToLocalPosition - * @param {Vec3} worldPosition - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} worldPosition - The world position to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent= false] - true to scale the local position per the parent's scale, + * false for the local position to be at world scale. + * @returns {Vec3} The position converted to local coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. + * @example Report the local coordinates of an entity parented to another. + * var parentPosition = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })); + * var childPosition = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 1, z: -5 })); + * + * var parentEntity = Entities.addEntity({ + * type: "Box", + * position: parentPosition, + * rotation: MyAvatar.orientation, + * dimensions: { x: 0.5, y: 0.5, z: 0.5 }, + * lifetime: 300 // Delete after 5 minutes. + * }); + * var childEntity = Entities.addEntity({ + * type: "Sphere", + * position: childPosition, + * dimensions: { x: 0.5, y: 0.5, z: 0.5 }, + * parentID: parentEntity, + * lifetime: 300 // Delete after 5 minutes. + * }); + * + * var localPosition = Entities.worldToLocalPosition(childPosition, parentEntity); + * print("Local position: " + JSON.stringify(localPosition)); // 0, 1, 0. + * localPosition = Entities.getEntityProperties(childEntity, "localPosition").localPosition; + * print("Local position: " + JSON.stringify(localPosition)); // The same. */ Q_INVOKABLE glm::vec3 worldToLocalPosition(glm::vec3 worldPosition, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a rotation or orientation in world coordinates to rotation in an avatar, entity, or joint's local coordinates. * @function Entities.worldToLocalRotation - * @param {Quat} worldRotation - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Quat} + * @param {Quat} worldRotation - The world rotation to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent=false] - Not used in the calculation. + * @returns {Quat} The rotation converted to local coordinates if successful, otherwise {@link Quat(0)|Quat.IDENTITY}. */ Q_INVOKABLE glm::quat worldToLocalRotation(glm::quat worldRotation, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a velocity in world coordinates to a velocity in an avatar, entity, or joint's local coordinates. * @function Entities.worldToLocalVelocity - * @param {Vec3} worldVelocity - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} worldVelocity - The world velocity to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent=false] - true to scale the local velocity per the parent's scale, + * false for the local velocity to be at world scale. + * @returns {Vec3} The velocity converted to local coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 worldToLocalVelocity(glm::vec3 worldVelocity, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a Euler angular velocity in world coordinates to an angular velocity in an avatar, entity, or joint's local + * coordinates. * @function Entities.worldToLocalAngularVelocity - * @param {Vec3} worldAngularVelocity - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} worldAngularVelocity - The world Euler angular velocity to convert. (Can be in any unit, e.g., deg/s or + * rad/s.) + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent=false] - Not used in the calculation. + * @returns {Vec3} The angular velocity converted to local coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 worldToLocalAngularVelocity(glm::vec3 worldAngularVelocity, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts dimensions in world coordinates to dimensions in an avatar or entity's local coordinates. * @function Entities.worldToLocalDimensions - * @param {Vec3} worldDimensions - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} worldDimensions - The world dimensions to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - Not used in the calculation. + * @param {boolean} [scalesWithParent=false] - true to scale the local dimensions per the parent's scale, + * false for the local dimensions to be at world scale. + * @returns {Vec3} The dimensions converted to local coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 worldToLocalDimensions(glm::vec3 worldDimensions, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a position in an avatar, entity, or joint's local coordinate to a position in world coordinates. * @function Entities.localToWorldPosition - * @param {Vec3} localPosition - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} localPosition - The local position to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithparent=false] - true if the local dimensions are scaled per the parent's scale, + * false if the local dimensions are at world scale. + * @returns {Vec3} The position converted to world coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 localToWorldPosition(glm::vec3 localPosition, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a rotation or orientation in an avatar, entity, or joint's local coordinate to a rotation in world coordinates. * @function Entities.localToWorldRotation - * @param {Quat} localRotation - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Quat} + * @param {Quat} localRotation - The local rotation to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent= false] - Not used in the calculation. + * @returns {Quat} The rotation converted to local coordinates if successful, otherwise {@link Quat(0)|Quat.IDENTITY}. */ Q_INVOKABLE glm::quat localToWorldRotation(glm::quat localRotation, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a velocity in an avatar, entity, or joint's local coordinate to a velocity in world coordinates. * @function Entities.localToWorldVelocity - * @param {Vec3} localVelocity - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} localVelocity - The local velocity to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent= false] - true if the local velocity is scaled per the parent's scale, + * false if the local velocity is at world scale. + * @returns {Vec3} The velocity converted to world coordinates it successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 localToWorldVelocity(glm::vec3 localVelocity, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts a Euler angular velocity in an avatar, entity, or joint's local coordinate to an angular velocity in world + * coordinates. * @function Entities.localToWorldAngularVelocity - * @param {Vec3} localAngularVelocity - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} localAngularVelocity - The local Euler angular velocity to convert. (Can be in any unit, e.g., deg/s or + * rad/s.) + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - The joint in the avatar or entity that the local coordinates are based on. If + * -1 then no joint is used and the local coordinates are based solely on the avatar or entity. + * @param {boolean} [scalesWithParent= false] - Not used in the calculation. + * @returns {Vec3} The angular velocity converted to world coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 localToWorldAngularVelocity(glm::vec3 localAngularVelocity, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc + * Converts dimensions in an avatar or entity's local coordinates to dimensions in world coordinates. * @function Entities.localToWorldDimensions - * @param {Vec3} localDimensions - * @param {Uuid} parentID - * @param {number} parentJointIndex - * @param {boolean} scalesWithparent - * @returns {Vec3} + * @param {Vec3} localDimensions - The local dimensions to convert. + * @param {Uuid} parentID - The avatar or entity that the local coordinates are based on. + * @param {number} [parentJointIndex=-1] - Not used in the calculation. + * @param {boolean} [scalesWithParent= false] - true if the local dimensions are scaled per the parent's + * scale, false if the local dimensions are at world scale. + * @returns {Vec3} The dimensions converted to world coordinates if successful, otherwise {@link Vec3(0)|Vec3.ZERO}. */ Q_INVOKABLE glm::vec3 localToWorldDimensions(glm::vec3 localDimensions, const QUuid& parentID, int parentJointIndex = -1, bool scalesWithParent = false); /**jsdoc - * Get the static certificate for an entity. The static certificate contains static properties of the item which cannot - * be altered. - * @function Entities.getStaticCertificateJSON - * @param {Uuid} entityID - The ID of the entity to get the static certificate for. - * @returns {string} The entity's static certificate as a JSON string if the entity can be found, otherwise an empty string. - */ + * Gets the static certificate for an entity. The static certificate contains static properties of the item which cannot + * be altered. + * @function Entities.getStaticCertificateJSON + * @param {Uuid} entityID - The ID of the entity to get the static certificate for. + * @returns {string} The entity's static certificate as a JSON string if the entity can be found, otherwise "". + */ Q_INVOKABLE QString getStaticCertificateJSON(const QUuid& entityID); /**jsdoc - * Verify the entity's proof of provenance, i.e., that the entity's certificateID property was produced by + * Verifies the entity's proof of provenance, i.e., that the entity's certificateID property was produced by * High Fidelity signing the entity's static certificate JSON. * @function Entities.verifyStaticCertificateProperties * @param {Uuid} entityID - The ID of the entity to verify. - * @returns {boolean} true if the entity can be found an its certificateID property is present - * and its value matches the entity's static certificate JSON; otherwise false. + * @returns {boolean} true if the entity can be found, its certificateID property is present, and + * its value matches the entity's static certificate JSON; otherwise false. */ Q_INVOKABLE bool verifyStaticCertificateProperties(const QUuid& entityID); @@ -1960,7 +2086,7 @@ signals: * pressed while its laser is on an entity. *

See also, {@link Script.addEventHandler}.

* @function Entities.mousePressOnEntity - * @param {Uuid} entityID - The ID of the entity that was pressed. + * @param {Uuid} entityID - The ID of the entity that was pressed on. * @param {PointerEvent} event - Details of the event. * @returns {Signal} * @example Report when an entity is clicked with the mouse or laser. @@ -1975,7 +2101,7 @@ signals: /**jsdoc * Triggered when a mouse button is double-clicked while the mouse cursor is on an entity. * @function Entities.mouseDoublePressOnEntity - * @param {Uuid} entityID - The ID of the entity that was double-pressed. + * @param {Uuid} entityID - The ID of the entity that was double-pressed on. * @param {PointerEvent} event - Details of the event. * @returns {Signal} */ @@ -2023,7 +2149,7 @@ signals: * Triggered when a mouse button is clicked while the mouse cursor is on an entity. Note: Not triggered by controller. *

See also, {@link Script.addEventHandler}.

* @function Entities.clickDownOnEntity - * @param {Uuid} entityID - The ID of the entity that was clicked. + * @param {Uuid} entityID - The ID of the entity that was clicked on. * @param {PointerEvent} event - Details of the event. * @returns {Signal} */ diff --git a/libraries/octree/src/OctreeScriptingInterface.h b/libraries/octree/src/OctreeScriptingInterface.h index e501dd166a..c7b0552511 100644 --- a/libraries/octree/src/OctreeScriptingInterface.h +++ b/libraries/octree/src/OctreeScriptingInterface.h @@ -37,7 +37,7 @@ private slots: public slots: /**jsdoc - * Set the maximum number of entity packets that the client can send per second. + * Sets the maximum number of entity packets that the client can send per second. * @function Entities.setPacketsPerSecond * @param {number} packetsPerSecond - Integer maximum number of entity packets that the client can send per second. */ @@ -45,7 +45,7 @@ public slots: void setPacketsPerSecond(int packetsPerSecond) { return _packetSender->setPacketsPerSecond(packetsPerSecond); } /**jsdoc - * Get the maximum number of entity packets that the client can send per second. + * Gets the maximum number of entity packets that the client can send per second. * @function Entities.getPacketsPerSecond * @returns {number} Integer maximum number of entity packets that the client can send per second. */ @@ -53,7 +53,7 @@ public slots: int getPacketsPerSecond() const { return _packetSender->getPacketsPerSecond(); } /**jsdoc - * Check whether servers exist for the client to send entity packets to, i.e., whether you are connected to a domain and + * Checks whether servers exist for the client to send entity packets to, i.e., whether you are connected to a domain and * its entity server is working. * @function Entities.serversExist * @returns {boolean} true if servers exist for the client to send entity packets to, otherwise @@ -63,7 +63,7 @@ public slots: bool serversExist() const { return _packetSender->serversExist(); } /**jsdoc - * Check whether the client has entity packets waiting to be sent. + * Checks whether the client has entity packets waiting to be sent. * @function Entities.hasPacketsToSend * @returns {boolean} true if the client has entity packets waiting to be sent, otherwise false. */ @@ -71,7 +71,7 @@ public slots: bool hasPacketsToSend() const { return _packetSender->hasPacketsToSend(); } /**jsdoc - * Get the number of entity packets the client has waiting to be sent. + * Gets the number of entity packets the client has waiting to be sent. * @function Entities.packetsToSendCount * @returns {number} Integer number of entity packets the client has waiting to be sent. */ @@ -79,7 +79,7 @@ public slots: int packetsToSendCount() const { return (int)_packetSender->packetsToSendCount(); } /**jsdoc - * Get the entity packets per second send rate of the client over its lifetime. + * Gets the entity packets per second send rate of the client over its lifetime. * @function Entities.getLifetimePPS * @returns {number} Entity packets per second send rate of the client over its lifetime. */ @@ -87,7 +87,7 @@ public slots: float getLifetimePPS() const { return _packetSender->getLifetimePPS(); } /**jsdoc - * Get the entity bytes per second send rate of the client over its lifetime. + * Gets the entity bytes per second send rate of the client over its lifetime. * @function Entities.getLifetimeBPS * @returns {number} Entity bytes per second send rate of the client over its lifetime. */ @@ -95,7 +95,7 @@ public slots: float getLifetimeBPS() const { return _packetSender->getLifetimeBPS(); } /**jsdoc - * Get the entity packets per second queued rate of the client over its lifetime. + * Gets the entity packets per second queued rate of the client over its lifetime. * @function Entities.getLifetimePPSQueued * @returns {number} Entity packets per second queued rate of the client over its lifetime. */ @@ -103,7 +103,7 @@ public slots: float getLifetimePPSQueued() const { return _packetSender->getLifetimePPSQueued(); } /**jsdoc - * Get the entity bytes per second queued rate of the client over its lifetime. + * Gets the entity bytes per second queued rate of the client over its lifetime. * @function Entities.getLifetimeBPSQueued * @returns {number} Entity bytes per second queued rate of the client over its lifetime. */ @@ -111,7 +111,7 @@ public slots: float getLifetimeBPSQueued() const { return _packetSender->getLifetimeBPSQueued(); } /**jsdoc - * Get the lifetime of the client from the first entity packet sent until now, in microseconds. + * Gets the lifetime of the client from the first entity packet sent until now, in microseconds. * @function Entities.getLifetimeInUsecs * @returns {number} Lifetime of the client from the first entity packet sent until now, in microseconds. */ @@ -119,7 +119,7 @@ public slots: long long unsigned int getLifetimeInUsecs() const { return _packetSender->getLifetimeInUsecs(); } /**jsdoc - * Get the lifetime of the client from the first entity packet sent until now, in seconds. + * Gets the lifetime of the client from the first entity packet sent until now, in seconds. * @function Entities.getLifetimeInSeconds * @returns {number} Lifetime of the client from the first entity packet sent until now, in seconds. */ @@ -127,7 +127,7 @@ public slots: float getLifetimeInSeconds() const { return _packetSender->getLifetimeInSeconds(); } /**jsdoc - * Get the total number of entity packets sent by the client over its lifetime. + * Gets the total number of entity packets sent by the client over its lifetime. * @function Entities.getLifetimePacketsSent * @returns {number} The total number of entity packets sent by the client over its lifetime. */ @@ -135,7 +135,7 @@ public slots: long long unsigned int getLifetimePacketsSent() const { return _packetSender->getLifetimePacketsSent(); } /**jsdoc - * Get the total bytes of entity packets sent by the client over its lifetime. + * Gets the total bytes of entity packets sent by the client over its lifetime. * @function Entities.getLifetimeBytesSent * @returns {number} The total bytes of entity packets sent by the client over its lifetime. */ @@ -143,7 +143,7 @@ public slots: long long unsigned int getLifetimeBytesSent() const { return _packetSender->getLifetimeBytesSent(); } /**jsdoc - * Get the total number of entity packets queued by the client over its lifetime. + * Gets the total number of entity packets queued by the client over its lifetime. * @function Entities.getLifetimePacketsQueued * @returns {number} The total number of entity packets queued by the client over its lifetime. */ @@ -151,7 +151,7 @@ public slots: long long unsigned int getLifetimePacketsQueued() const { return _packetSender->getLifetimePacketsQueued(); } /**jsdoc - * Get the total bytes of entity packets queued by the client over its lifetime. + * Gets the total bytes of entity packets queued by the client over its lifetime. * @function Entities.getLifetimeBytesQueued * @returns {number} The total bytes of entity packets queued by the client over its lifetime. */ diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 9d29f32931..d820f0cb0f 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -2200,6 +2200,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& * lifetime: 300 // Delete after 5 minutes. * }); */ +// The JSDoc is for the callEntityScriptMethod() call in this method. // since all of these operations can be asynch we will always do the actual work in the response handler // for the download void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, const QString& scriptOrURL, const QString& contents, bool isURL, bool success , const QString& status) { @@ -2384,8 +2385,10 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co *

Note: Can only be connected to via this.unoad = function () { ... } in the entity script.

*
Available in:Client Entity ScriptsServer Entity Scripts
* @function Entities.unload + * @param {Uuid} entityID - The ID of the entity that the script is running in. * @returns {Signal} */ +// The JSDoc is for the callEntityScriptMethod() call in this method. void ScriptEngine::unloadEntityScript(const EntityItemID& entityID, bool shouldRemoveFromMap) { if (QThread::currentThread() != thread()) { #ifdef THREAD_DEBUGGING diff --git a/libraries/shared/src/PointerEvent.cpp b/libraries/shared/src/PointerEvent.cpp index 69d3f28d80..54374a934c 100644 --- a/libraries/shared/src/PointerEvent.cpp +++ b/libraries/shared/src/PointerEvent.cpp @@ -66,7 +66,7 @@ void PointerEvent::setButton(Button button) { } /**jsdoc - * A PointerEvent defines a 2D or 3D mouse or similar pointer event. + * A 2D or 3D mouse or similar pointer event. * @typedef {object} PointerEvent * @property {string} type - The type of event: "Press", "DoublePress", "Release", or * "Move".