diff --git a/libraries/script-engine/src/ScriptManagerScriptingInterface.h b/libraries/script-engine/src/ScriptManagerScriptingInterface.h index 2b9aeb49e8..5620a9fb13 100644 --- a/libraries/script-engine/src/ScriptManagerScriptingInterface.h +++ b/libraries/script-engine/src/ScriptManagerScriptingInterface.h @@ -16,7 +16,7 @@ #include "ScriptManager.h" -/**jsdoc +/*@jsdoc * The Script API provides facilities for working with scripts. * * @namespace Script @@ -64,7 +64,7 @@ public: virtual ~ScriptManagerScriptingInterface() { } - /**jsdoc + /*@jsdoc * Stops and unloads the current script. *

Warning: If an assignment client script, the script gets restarted after stopping.

* @function Script.stop @@ -83,7 +83,7 @@ public: // NOTE - this is intended to be a public interface for Agent scripts, and local scripts, but not for EntityScripts Q_INVOKABLE void stop(bool marshal = false) { _manager->stop(marshal); } - /**jsdoc + /*@jsdoc * Gets the context that the script is running in: Interface/avatar, client entity, server entity, or assignment client. * @function Script.getContext * @returns {string} The context that the script is running in: @@ -97,7 +97,7 @@ public: Q_INVOKABLE QString getContext() const { return _manager->getContext(); } - /**jsdoc + /*@jsdoc * Checks whether the script is running as an Interface or avatar script. * @function Script.isClientScript * @returns {boolean} true if the script is running as an Interface or avatar script, false if it @@ -105,7 +105,7 @@ public: */ Q_INVOKABLE bool isClientScript() const { return _manager->isClientScript(); } - /**jsdoc + /*@jsdoc * Checks whether the application was compiled as a debug build. * @function Script.isDebugMode * @returns {boolean} true if the application was compiled as a debug build, false if it was @@ -113,21 +113,21 @@ public: */ Q_INVOKABLE bool isDebugMode() const { return _manager->isDebugMode(); } - /**jsdoc + /*@jsdoc * Checks whether the script is running as a client entity script. * @function Script.isEntityClientScript * @returns {boolean} true if the script is running as a client entity script, false if it isn't. */ Q_INVOKABLE bool isEntityClientScript() const { return _manager->isEntityClientScript(); } - /**jsdoc + /*@jsdoc * Checks whether the script is running as a server entity script. * @function Script.isEntityServerScript * @returns {boolean} true if the script is running as a server entity script, false if it isn't. */ Q_INVOKABLE bool isEntityServerScript() const { return _manager->isEntityServerScript(); } - /**jsdoc + /*@jsdoc * Checks whether the script is running as an assignment client script. * @function Script.isAgentScript * @returns {boolean} true if the script is running as an assignment client script, false if it @@ -147,7 +147,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // NOTE - these are intended to be public interfaces available to scripts - /**jsdoc + /*@jsdoc * @function Script.formatExecption * @param {object} exception - Exception. * @param {boolean} inludeExtendeDetails - Include extended details. @@ -156,7 +156,7 @@ public: */ Q_INVOKABLE QString formatException(const ScriptValue& exception, bool includeExtendedDetails) { return _manager->formatException(exception, includeExtendedDetails); } - /**jsdoc + /*@jsdoc * Adds a function to the list of functions called when a particular event occurs on a particular entity. *

See also, the {@link Entities} API.

* @function Script.addEventHandler @@ -180,7 +180,7 @@ public: */ Q_INVOKABLE void addEventHandler(const EntityItemID& entityID, const QString& eventName, const ScriptValue& handler) { _manager->addEventHandler(entityID, eventName, handler); } - /**jsdoc + /*@jsdoc * Removes a function from the list of functions called when an entity event occurs on a particular entity. *

See also, the {@link Entities} API.

* @function Script.removeEventHandler @@ -190,7 +190,7 @@ public: */ Q_INVOKABLE void removeEventHandler(const EntityItemID& entityID, const QString& eventName, const ScriptValue& handler) { _manager->removeEventHandler(entityID, eventName, handler); } - /**jsdoc + /*@jsdoc * Starts running another script in Interface, if it isn't already running. The script is not automatically loaded next * time Interface starts. *

Supported Script Types: Interface Scripts • Avatar Scripts

@@ -212,7 +212,7 @@ public: */ Q_INVOKABLE void load(const QString& loadfile) { _manager->load(loadfile); } - /**jsdoc + /*@jsdoc * Includes JavaScript from other files in the current script. If a callback is specified, the files are loaded and * included asynchronously, otherwise they are included synchronously (i.e., script execution blocks while the files are * included). @@ -224,7 +224,7 @@ public: */ Q_INVOKABLE void include(const QStringList& includeFiles, const ScriptValue& callback = ScriptValue()) { _manager->include(includeFiles, callback);}; - /**jsdoc + /*@jsdoc * Includes JavaScript from another file in the current script. If a callback is specified, the file is loaded and included * asynchronously, otherwise it is included synchronously (i.e., script execution blocks while the file is included). * @function Script.include @@ -252,7 +252,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MODULE related methods - /**jsdoc + /*@jsdoc * Provides access to methods or objects provided in an external JavaScript or JSON file. * See {@link https://docs.overte.org/script/js-tips.html} for further details. * @function Script.require @@ -263,14 +263,14 @@ public: */ Q_INVOKABLE ScriptValue require(const QString& moduleId) { return _manager->require(moduleId); } - /**jsdoc + /*@jsdoc * @function Script.resetModuleCache * @param {boolean} [deleteScriptCache=false] - Delete script cache. * @deprecated This function is deprecated and will be removed. */ Q_INVOKABLE void resetModuleCache(bool deleteScriptCache = false) { _manager->resetModuleCache(deleteScriptCache);} - /**jsdoc + /*@jsdoc * Calls a function repeatedly, at a set interval. * @function Script.setInterval * @param {function} function - The function to call. This can be either the name of a function or an in-line definition. @@ -283,7 +283,7 @@ public: */ Q_INVOKABLE QTimer* setInterval(const ScriptValue& function, int intervalMS) { return _manager->setInterval(function, intervalMS); } - /**jsdoc + /*@jsdoc * Calls a function once, after a delay. * @function Script.setTimeout * @param {function} function - The function to call. This can be either the name of a function or an in-line definition. @@ -296,7 +296,7 @@ public: */ Q_INVOKABLE QTimer* setTimeout(const ScriptValue& function, int timeoutMS) { return _manager->setTimeout(function, timeoutMS); }; - /**jsdoc + /*@jsdoc * Stops an interval timer set by {@link Script.setInterval|setInterval}. * @function Script.clearInterval * @param {object} timer - The interval timer to stop. @@ -317,7 +317,7 @@ public: // Overloaded version is needed in case the timer has expired Q_INVOKABLE void clearInterval(QVariantMap timer) { ; } - /**jsdoc + /*@jsdoc * Stops a timeout timer set by {@link Script.setTimeout|setTimeout}. * @function Script.clearTimeout * @param {object} timer - The timeout timer to stop. @@ -335,7 +335,7 @@ public: // Overloaded version is needed in case the timer has expired Q_INVOKABLE void clearTimeout(QVariantMap timer) { ; } - /**jsdoc + /*@jsdoc * Prints a message to the program log and emits {@link Script.printedMessage}. *

Alternatively, you can use {@link print} or one of the {@link console} API methods.

* @function Script.print @@ -343,7 +343,7 @@ public: */ Q_INVOKABLE void print(const QString& message) { _manager->print(message); } - /**jsdoc + /*@jsdoc * Resolves a relative path to an absolute path. The relative path is relative to the script's location. * @function Script.resolvePath * @param {string} path - The relative path to resolve. @@ -357,14 +357,14 @@ public: */ Q_INVOKABLE QUrl resolvePath(const QString& path) const { return _manager->resolvePath(path);} - /**jsdoc + /*@jsdoc * Gets the path to the resources directory for QML files. * @function Script.resourcesPath * @returns {string} The path to the resources directory for QML files. */ Q_INVOKABLE QUrl resourcesPath() const { return _manager->resourcesPath(); } - /**jsdoc + /*@jsdoc * Starts timing a section of code in order to send usage data about it to Vircadia. Shouldn't be used outside of the * standard scripts. * @function Script.beginProfileRange @@ -372,7 +372,7 @@ public: */ Q_INVOKABLE void beginProfileRange(const QString& label) const { _manager->beginProfileRange(label); } - /**jsdoc + /*@jsdoc * Finishes timing a section of code in order to send usage data about it to Vircadia. Shouldn't be used outside of * the standard scripts. * @function Script.endProfileRange @@ -383,7 +383,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Entity Script Related methods - /**jsdoc + /*@jsdoc * Checks whether an entity has an entity script running. * @function Script.isEntityScriptRunning * @param {Uuid} entityID - The ID of the entity. @@ -391,14 +391,14 @@ public: */ Q_INVOKABLE bool isEntityScriptRunning(const EntityItemID& entityID) { return _manager->isEntityScriptRunning(entityID); } - /**jsdoc + /*@jsdoc * Manually runs the JavaScript garbage collector which reclaims memory by disposing of objects that are no longer * reachable. * @function Script.requestGarbageCollection */ Q_INVOKABLE void requestGarbageCollection() { _manager->requestGarbageCollection(); } - /**jsdoc + /*@jsdoc * Prints out current backtrace to the log. * @function Script.logBacktrace * @param {string} title - Title added to the printed out backtrace. @@ -414,7 +414,7 @@ public: */ Q_INVOKABLE void loadEntityScript(const EntityItemID& entityID, const QString& entityScript, bool forceRedownload) { _manager->loadEntityScript(entityID, entityScript, forceRedownload); } - /**jsdoc + /*@jsdoc * @function Script.unloadEntityScript * @param {Uuid} entityID - Entity ID. * @param {boolean} [shouldRemoveFromMap=false] - Should remove from map. @@ -422,14 +422,14 @@ public: */ Q_INVOKABLE void unloadEntityScript(const EntityItemID& entityID, bool shouldRemoveFromMap = false) { _manager->unloadEntityScript(entityID, shouldRemoveFromMap); } - /**jsdoc + /*@jsdoc * @function Script.unloadAllEntityScripts * @param {boolean} [blockingCall=false] - Wait for completion if call moved to another thread. * @deprecated This function is deprecated and will be removed. */ Q_INVOKABLE void unloadAllEntityScripts(bool blockingCall = false) { _manager->unloadAllEntityScripts(blockingCall); } - /**jsdoc + /*@jsdoc * Calls a method in an entity script. * @function Script.callEntityScriptMethod * @param {Uuid} entityID - The ID of the entity running the entity script. @@ -441,7 +441,7 @@ public: const QStringList& params = QStringList(), const QUuid& remoteCallerID = QUuid()) { _manager->callEntityScriptMethod(entityID, methodName, params, remoteCallerID); } - /**jsdoc + /*@jsdoc * Calls a method in an entity script. * @function Script.callEntityScriptMethod * @param {Uuid} entityID - Entity ID. @@ -451,7 +451,7 @@ public: */ Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const PointerEvent& event) { _manager->callEntityScriptMethod(entityID, methodName, event); } - /**jsdoc + /*@jsdoc * Calls a method in an entity script. * @function Script.callEntityScriptMethod * @param {Uuid} entityID - Entity ID. @@ -462,14 +462,14 @@ public: */ Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const EntityItemID& otherID, const Collision& collision) { _manager->callEntityScriptMethod(entityID, methodName, otherID, collision);} - /**jsdoc + /*@jsdoc * @function Script.generateUUID * @returns {Uuid} A new UUID. * @deprecated This function is deprecated and will be removed. Use {@link Uuid(0).generate|Uuid.generate} instead. */ Q_INVOKABLE QUuid generateUUID() { return QUuid::createUuid(); } - /**jsdoc + /*@jsdoc * Gets the URL for an asset in an external resource bucket. (The location where the bucket is hosted may change over time * but this method will return the asset's current URL.) * @function Script.getExternalPath @@ -486,7 +486,7 @@ public: */ Q_INVOKABLE QString getExternalPath(ExternalResource::Bucket bucket, const QString& path) { return _manager->getExternalPath(bucket, path); } - /**jsdoc + /*@jsdoc *

Object containing memory usage statistics data.

* * @@ -503,26 +503,26 @@ public: * @typedef {object} Script.MemoryUsageData */ - /**jsdoc + /*@jsdoc * Returns memory usage statistics data. * @function Script.getMemoryUsageStatistics * @Returns {Script.MemoryUsageData} Object containing statistics about memory usage. */ Q_INVOKABLE QVariantMap getMemoryUsageStatistics(); - /**jsdoc + /*@jsdoc * Start collecting object statistics that can later be reported with Script.dumpHeapObjectStatistics(). * @function Script.dumpHeapObjectStatistics */ Q_INVOKABLE void startCollectingObjectStatistics(); - /**jsdoc + /*@jsdoc * Prints heap statistics to a file. Collecting needs to first be started with Script.dumpHeapObjectStatistics(). * @function Script.dumpHeapObjectStatistics */ Q_INVOKABLE void dumpHeapObjectStatistics(); - /**jsdoc + /*@jsdoc * Create test object for garbage collector debugging. * @function Script.createGarbageCollectorDebuggingObject() * @Returns Test object. @@ -531,7 +531,7 @@ public: signals: - /**jsdoc + /*@jsdoc * @function Script.scriptLoaded * @param {string} filename - File name. * @returns {Signal} @@ -539,7 +539,7 @@ signals: */ void scriptLoaded(const QString& scriptFilename); - /**jsdoc + /*@jsdoc * @function Script.errorLoadingScript * @param {string} filename - File name. * @returns {Signal} @@ -547,7 +547,7 @@ signals: */ void errorLoadingScript(const QString& scriptFilename); - /**jsdoc + /*@jsdoc * Triggered frequently at a system-determined interval. * @function Script.update * @param {number} deltaTime - The time since the last update, in s. @@ -559,7 +559,7 @@ signals: */ void update(float deltaTime); - /**jsdoc + /*@jsdoc * Triggered when the script is stopping. * @function Script.scriptEnding * @returns {Signal} @@ -577,7 +577,7 @@ signals: */ void scriptEnding(); - /**jsdoc + /*@jsdoc * @function Script.finished * @param {string} filename - File name. * @param {object} engine - Engine. @@ -586,7 +586,7 @@ signals: */ void finished(const QString& fileNameString, ScriptManagerPointer); - /**jsdoc + /*@jsdoc * Triggered when the script prints a message to the program log via {@link print}, {@link Script.print}, * {@link console.log}, {@link console.debug}, {@link console.group}, {@link console.groupEnd}, {@link console.time}, or * {@link console.timeEnd}. @@ -597,7 +597,7 @@ signals: */ void printedMessage(const QString& message, const QString& scriptName); - /**jsdoc + /*@jsdoc * Triggered when the script generates an error, {@link console.error} or {@link console.exception} is called, or * {@link console.assert} is called and fails. * @function Script.errorMessage @@ -607,7 +607,7 @@ signals: */ void errorMessage(const QString& message, const QString& scriptName); - /**jsdoc + /*@jsdoc * Triggered when the script generates a warning or {@link console.warn} is called. * @function Script.warningMessage * @param {string} message - The warning message. @@ -616,7 +616,7 @@ signals: */ void warningMessage(const QString& message, const QString& scriptName); - /**jsdoc + /*@jsdoc * Triggered when the script generates an information message or {@link console.info} is called. * @function Script.infoMessage * @param {string} message - The information message. @@ -625,21 +625,21 @@ signals: */ void infoMessage(const QString& message, const QString& scriptName); - /**jsdoc + /*@jsdoc * Triggered when the running state of the script changes, e.g., from running to stopping. * @function Script.runningStateChanged * @returns {Signal} */ void runningStateChanged(); - /**jsdoc + /*@jsdoc * @function Script.clearDebugWindow * @returns {Signal} * @deprecated This signal is deprecated and will be removed. */ void clearDebugWindow(); - /**jsdoc + /*@jsdoc * @function Script.loadScript * @param {string} scriptName - Script name. * @param {boolean} isUserLoaded - Is user loaded. @@ -648,7 +648,7 @@ signals: */ void loadScript(const QString& scriptName, bool isUserLoaded); - /**jsdoc + /*@jsdoc * @function Script.reloadScript * @param {string} scriptName - Script name. * @param {boolean} isUserLoaded - Is user loaded. @@ -657,14 +657,14 @@ signals: */ void reloadScript(const QString& scriptName, bool isUserLoaded); - /**jsdoc + /*@jsdoc * Triggered when the script has stopped. * @function Script.doneRunning * @returns {Signal} */ void doneRunning(); - /**jsdoc + /*@jsdoc * @function Script.entityScriptDetailsUpdated * @returns {Signal} * @deprecated This signal is deprecated and will be removed. @@ -673,7 +673,7 @@ signals: // script is updated (goes from RUNNING to ERROR_RUNNING_SCRIPT, for example) void entityScriptDetailsUpdated(); - /**jsdoc + /*@jsdoc * Triggered when the script starts for the user. See also, {@link Entities.preload}. *

Supported Script Types: Client Entity Scripts • Server Entity Scripts

* @function Script.entityScriptPreloadFinished @@ -701,7 +701,7 @@ signals: // Emitted when an entity script has finished running preload void entityScriptPreloadFinished(const EntityItemID& entityID); - /**jsdoc + /*@jsdoc * Triggered when a script generates an unhandled exception. * @function Script.unhandledException * @param {object} exception - The details of the exception. @@ -716,7 +716,7 @@ signals: protected: - /**jsdoc + /*@jsdoc * @function Script.executeOnScriptThread * @param {function} function - Function. * @param {ConnectionType} [type=2] - Connection type. @@ -728,7 +728,7 @@ protected: // // Q_INVOKABLE void executeOnScriptThread(std::function function, const Qt::ConnectionType& type = Qt::QueuedConnection ) { _manager->executeOnScriptThread(function, type);} - /**jsdoc + /*@jsdoc * @function Script._requireResolve * @param {string} module - Module. * @param {string} [relativeTo=""] - Relative to. @@ -739,7 +739,7 @@ protected: // then inside of init() we just have to do "Script.require.resolve = Script._requireResolve;" Q_INVOKABLE QString _requireResolve(const QString& moduleId, const QString& relativeTo = QString()) { return _manager->_requireResolve(moduleId, relativeTo); } - /**jsdoc + /*@jsdoc * @function Script.entityScriptContentAvailable * @param {Uuid} entityID - Entity ID. * @param {string} scriptOrURL - Path. @@ -759,4 +759,4 @@ private slots: private: ScriptManager *_manager; -}; \ No newline at end of file +}; diff --git a/libraries/script-engine/src/ScriptValueUtils.cpp b/libraries/script-engine/src/ScriptValueUtils.cpp index f888c4767d..5bada98f15 100644 --- a/libraries/script-engine/src/ScriptValueUtils.cpp +++ b/libraries/script-engine/src/ScriptValueUtils.cpp @@ -720,7 +720,7 @@ ScriptValue qColorToScriptValue(ScriptEngine* engine, const QColor& color) { return object; } -/**jsdoc +/*@jsdoc * An axis-aligned cube, defined as the bottom right near (minimum axes values) corner of the cube plus the dimension of its * sides. * @typedef {object} AACube @@ -817,7 +817,7 @@ bool pickRayFromScriptValue(const ScriptValue& object, PickRay& pickRay) { return true; } -/**jsdoc +/*@jsdoc * Details of a collision between avatars and entities. * @typedef {object} Collision * @property {ContactEventType} type - The contact type of the collision event. @@ -862,7 +862,7 @@ bool quuidFromScriptValue(const ScriptValue& object, QUuid& uuid) { return true; } -/**jsdoc +/*@jsdoc * A 2D size value. * @typedef {object} Size * @property {number} height - The height value. @@ -881,7 +881,7 @@ bool qSizeFFromScriptValue(const ScriptValue& object, QSizeF& qSizeF) { return true; } -/**jsdoc +/*@jsdoc * The details of an animation that is playing. * @typedef {object} Avatar.AnimationDetails * @property {string} role - Not used. @@ -955,7 +955,7 @@ bool meshesFromScriptValue(const ScriptValue& value, MeshProxyList& out) { return true; } -/**jsdoc +/*@jsdoc * A triangle in a mesh. * @typedef {object} MeshFace * @property {number[]} vertices - The indexes of the three vertices that make up the face. diff --git a/libraries/script-engine/src/ScriptValueUtils.h b/libraries/script-engine/src/ScriptValueUtils.h index 49319667cb..45fee61cc4 100644 --- a/libraries/script-engine/src/ScriptValueUtils.h +++ b/libraries/script-engine/src/ScriptValueUtils.h @@ -32,7 +32,7 @@ bool isListOfStrings(const ScriptValue& value); void registerMetaTypes(ScriptEngine* engine); // Mat4 -/**jsdoc +/*@jsdoc * A 4 x 4 matrix, typically containing a scale, rotation, and translation transform. See also the {@link Mat4(0)|Mat4} object. * * @typedef {object} Mat4 @@ -56,7 +56,7 @@ void registerMetaTypes(ScriptEngine* engine); ScriptValue mat4toScriptValue(ScriptEngine* engine, const glm::mat4& mat4); bool mat4FromScriptValue(const ScriptValue& object, glm::mat4& mat4); -/**jsdoc +/*@jsdoc * A 2-dimensional vector. * * @typedef {object} Vec2 @@ -73,7 +73,7 @@ bool mat4FromScriptValue(const ScriptValue& object, glm::mat4& mat4); ScriptValue vec2ToScriptValue(ScriptEngine* engine, const glm::vec2& vec2); bool vec2FromScriptValue(const ScriptValue& object, glm::vec2& vec2); -/**jsdoc +/*@jsdoc * A 3-dimensional vector. See also the {@link Vec3(0)|Vec3} object. * * @typedef {object} Vec3 @@ -97,7 +97,7 @@ ScriptValue vec3ToScriptValue(ScriptEngine* engine, const glm::vec3& vec3); ScriptValue vec3ColorToScriptValue(ScriptEngine* engine, const glm::vec3& vec3); bool vec3FromScriptValue(const ScriptValue& object, glm::vec3& vec3); -/**jsdoc +/*@jsdoc * A color vector. See also the {@link Vec3(0)|Vec3} object. * * @typedef {object} Color @@ -116,7 +116,7 @@ bool vec3FromScriptValue(const ScriptValue& object, glm::vec3& vec3); * Entities.editEntity(, { color: "red"}); // { red: 255, green: 0, blue: 0 } * Entities.editEntity(, { color: "#00FF00"}); // { red: 0, green: 255, blue: 0 } */ -/**jsdoc +/*@jsdoc * A color vector with real values. Values may also be null. See also the {@link Vec3(0)|Vec3} object. * * @typedef {object} ColorFloat @@ -139,7 +139,7 @@ ScriptValue u8vec3ToScriptValue(ScriptEngine* engine, const glm::u8vec3& vec3); ScriptValue u8vec3ColorToScriptValue(ScriptEngine* engine, const glm::u8vec3& vec3); bool u8vec3FromScriptValue(const ScriptValue& object, glm::u8vec3& vec3); -/**jsdoc +/*@jsdoc * A 4-dimensional vector. * * @typedef {object} Vec4 @@ -155,7 +155,7 @@ bool vec4FromScriptValue(const ScriptValue& object, glm::vec4& vec4); ScriptValue quatToScriptValue(ScriptEngine* engine, const glm::quat& quat); bool quatFromScriptValue(const ScriptValue& object, glm::quat& quat); -/**jsdoc +/*@jsdoc * Defines a rectangular portion of an image or screen, or similar. * @typedef {object} Rect * @property {number} x - Left, x-coordinate value. @@ -236,8 +236,8 @@ class Collision; ScriptValue collisionToScriptValue(ScriptEngine* engine, const Collision& collision); bool collisionFromScriptValue(const ScriptValue& object, Collision& collision); -/**jsdoc - * UUIDs (Universally Unique IDentifiers) are used to uniquely identify entities, avatars, and the like. They are represented +/*@jsdoc + * UUIDs (Universally Unique IDentifiers) are used to uniquely identify entities, avatars, and the like. They are represented * in JavaScript as strings in the format, "{nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}", where the "n"s are * hexadecimal digits. * @typedef {string} Uuid