diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h
index af9c03a218..bfad5644bf 100644
--- a/interface/src/scripting/WindowScriptingInterface.h
+++ b/interface/src/scripting/WindowScriptingInterface.h
@@ -42,7 +42,7 @@ void CustomPromptResultFromScriptValue(const QScriptValue& object, CustomPromptR
* @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other
* chrome), in pixels. Read-only.
* @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other
- * chrome) plus the height of the menu bar, in pixels. Read-only.
+ * chrome), in pixels. Read-only.
* @property {object} location - Provides facilities for working with your current metaverse location. See {@link location}.
* @property {number} x - The x coordinate of the top left corner of the Interface window on the display. Read-only.
* @property {number} y - The y coordinate of the top left corner of the Interface window on the display. Read-only.
@@ -301,7 +301,7 @@ public slots:
/**jsdoc
* Get Interface's build number.
* @function Window.checkVersion
- * @returns {string} - Interface's build number.
+ * @returns {string} Interface's build number.
*/
QString checkVersion();
@@ -327,7 +327,7 @@ public slots:
* full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the
* dimensions is adjusted in order to match the aspect ratio.
* @example
Using the snapshot function and signals.
- * function onStillSnapshottaken(path, notify) {
+ * function onStillSnapshotTaken(path, notify) {
* print("Still snapshot taken: " + path);
* print("Notify: " + notify);
* }
@@ -340,7 +340,7 @@ public slots:
* print("Animated snapshot taken: " + animatedPath);
* }
*
- * Window.stillSnapshotTaken.connect(onStillSnapshottaken);
+ * Window.stillSnapshotTaken.connect(onStillSnapshotTaken);
* Window.processingGifStarted.connect(onProcessingGifStarted);
* Window.processingGifCompleted.connect(onProcessingGifCompleted);
*
@@ -555,7 +555,7 @@ signals:
/**jsdoc
* Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with
- * includeAnimated = false
.
+ * includeAnimated = false
or {@link Window.takeSecondaryCameraSnapshot|takeSecondaryCameraSnapshot}.
* @function Window.stillSnapshotTaken
* @param {string} pathStillSnapshot - The path and name of the snapshot image file.
* @param {boolean} notify - The value of the notify
parameter that {@link Window.takeSnapshot|takeSnapshot}
diff --git a/libraries/script-engine/src/AssetScriptingInterface.cpp b/libraries/script-engine/src/AssetScriptingInterface.cpp
index 25e8c0dcf3..e0e04a1e25 100644
--- a/libraries/script-engine/src/AssetScriptingInterface.cpp
+++ b/libraries/script-engine/src/AssetScriptingInterface.cpp
@@ -16,9 +16,11 @@
#include
#include
#include
-#include
#include
+#include "ScriptEngineLogging.h"
+
+
AssetScriptingInterface::AssetScriptingInterface(QScriptEngine* engine) :
_engine(engine)
{
@@ -53,10 +55,32 @@ void AssetScriptingInterface::setMapping(QString path, QString hash, QScriptValu
setMappingRequest->start();
}
+void AssetScriptingInterface::getMapping(QString path, QScriptValue callback) {
+ auto request = DependencyManager::get()->createGetMappingRequest(path);
+ QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {
+ auto result = request->getError();
+ if (callback.isFunction()) {
+ if (result == GetMappingRequest::NotFound) {
+ QScriptValueList args { "", true };
+ callback.call(_engine->currentContext()->thisObject(), args);
+ } else if (result == GetMappingRequest::NoError) {
+ QScriptValueList args { request->getHash(), true };
+ callback.call(_engine->currentContext()->thisObject(), args);
+ } else {
+ qCDebug(scriptengine) << "error -- " << request->getError() << " -- " << request->getErrorString();
+ QScriptValueList args { "", false };
+ callback.call(_engine->currentContext()->thisObject(), args);
+ }
+ request->deleteLater();
+ }
+ });
+ request->start();
+}
void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callback) {
if (!urlString.startsWith(ATP_SCHEME)) {
+ qCDebug(scriptengine) << "AssetScriptingInterface::downloadData url must be of form atp:";
return;
}
diff --git a/libraries/script-engine/src/AssetScriptingInterface.h b/libraries/script-engine/src/AssetScriptingInterface.h
index 2812be65f9..dded2ef21d 100644
--- a/libraries/script-engine/src/AssetScriptingInterface.h
+++ b/libraries/script-engine/src/AssetScriptingInterface.h
@@ -75,7 +75,24 @@ public:
* @param {string} error
*/
Q_INVOKABLE void setMapping(QString path, QString hash, QScriptValue callback);
-
+
+ /**jsdoc
+ * Look up a path to hash mapping within the connected domain's asset server
+ * @function Assets.getMapping
+ * @static
+ * @param path {string}
+ * @param callback {Assets~getMappingCallback}
+ */
+
+ /**jsdoc
+ * Called when getMapping is complete.
+ * @callback Assets~getMappingCallback
+ * @param assetID {string} hash value if found, else an empty string
+ * @param success {boolean} false for errors other than "not found", else true
+ */
+ Q_INVOKABLE void getMapping(QString path, QScriptValue callback);
+
+
Q_INVOKABLE void setBakingEnabled(QString path, bool enabled, QScriptValue callback);
#if (PR_BUILD || DEV_BUILD)