From a9e46f81e5d76f8a10431b966faff4d0a6c85043 Mon Sep 17 00:00:00 2001 From: Karol Suprynowicz Date: Thu, 31 Oct 2024 20:38:41 +0100 Subject: [PATCH] Fix missing properties in Script API --- libraries/script-engine/src/ScriptManager.h | 3 --- .../src/ScriptManagerScriptingInterface.h | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/ScriptManager.h b/libraries/script-engine/src/ScriptManager.h index 8197f26285..dc368d1430 100644 --- a/libraries/script-engine/src/ScriptManager.h +++ b/libraries/script-engine/src/ScriptManager.h @@ -280,9 +280,6 @@ public: */ class ScriptManager : public QObject, public EntitiesScriptEngineProvider, public std::enable_shared_from_this { Q_OBJECT - Q_PROPERTY(QString context READ getContext) - Q_PROPERTY(QString type READ getTypeAsString) - Q_PROPERTY(QString fileName MEMBER _fileNameString CONSTANT) public: static const QString SCRIPT_EXCEPTION_FORMAT; static const QString SCRIPT_BACKTRACE_SEP; diff --git a/libraries/script-engine/src/ScriptManagerScriptingInterface.h b/libraries/script-engine/src/ScriptManagerScriptingInterface.h index 9fc23de283..0a2ccb66e3 100644 --- a/libraries/script-engine/src/ScriptManagerScriptingInterface.h +++ b/libraries/script-engine/src/ScriptManagerScriptingInterface.h @@ -58,6 +58,9 @@ public: class ScriptManagerScriptingInterface : public QObject { Q_OBJECT + Q_PROPERTY(QString context READ getContext) + Q_PROPERTY(QString type READ getTypeAsString) + Q_PROPERTY(QString fileName READ getAbsoluteFilename CONSTANT) public: ScriptManagerScriptingInterface(ScriptManager *parent); @@ -96,6 +99,26 @@ public: */ Q_INVOKABLE QString getContext() const { return _manager->getContext(); } + /*@jsdoc + * Gets the type of script that is running: Interface, avatar, client entity, server entity, or assignment client. + * @function Script.getTypeAsString + * @returns {string} The type of script that is running: + * + */ + Q_INVOKABLE QString getTypeAsString() const { return _manager->getTypeAsString(); } + + /*@jsdoc + * Gets the filename of the script file. + * @function Script.getAbsoluteFilename + * @returns {string} The filename of the script file. + */ + Q_INVOKABLE QString getAbsoluteFilename() const { return _manager->getAbsoluteFilename(); } /*@jsdoc * Checks whether the script is running as an Interface or avatar script.