partial getMapping PR integration

This commit is contained in:
humbletim 2018-01-17 17:08:57 -05:00
parent a863aec4a0
commit 0930cc4f0e
2 changed files with 17 additions and 3 deletions

View file

@ -27,8 +27,7 @@
#include <shared/QtHelpers.h> #include <shared/QtHelpers.h>
#include "Gzip.h" #include "Gzip.h"
#include "ScriptEngine.h" #include "ScriptEngine.h"
#include "ScriptEngineLogging.h"
//using Promise = MiniPromise::Promise;
AssetScriptingInterface::AssetScriptingInterface(QObject* parent) : BaseAssetScriptingInterface(parent) { AssetScriptingInterface::AssetScriptingInterface(QObject* parent) : BaseAssetScriptingInterface(parent) {
if (auto engine = qobject_cast<QScriptEngine*>(parent)) { if (auto engine = qobject_cast<QScriptEngine*>(parent)) {
@ -88,7 +87,7 @@ void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callb
if (!urlString.startsWith(ATP_SCHEME)) { if (!urlString.startsWith(ATP_SCHEME)) {
// ... for now at least log a message so user can check logs // ... for now at least log a message so user can check logs
qDebug() << "AssetScriptingInterface::downloadData ERROR: url does not start with " << ATP_SCHEME; qCDebug(scriptengine) << "AssetScriptingInterface::downloadData url must be of form atp:<hash-value>";
return; return;
} }
QString hash = AssetUtils::extractAssetHash(urlString); QString hash = AssetUtils::extractAssetHash(urlString);

View file

@ -79,6 +79,21 @@ public:
* @param {string} error * @param {string} error
*/ */
Q_INVOKABLE void setMapping(QString path, QString hash, QScriptValue callback); 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 error {string} error description if the path could not be resolved; otherwise a null value.
* @param assetID {string} hash value if found, else an empty string
*/
Q_INVOKABLE void getMapping(QString path, QScriptValue callback); Q_INVOKABLE void getMapping(QString path, QScriptValue callback);
Q_INVOKABLE void setBakingEnabled(QString path, bool enabled, QScriptValue callback); Q_INVOKABLE void setBakingEnabled(QString path, bool enabled, QScriptValue callback);