mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-06 11:12:18 +02:00
apply Huffman's feedback to Sam's PR
This commit is contained in:
parent
fd5a5bb104
commit
f90f0ed1f3
2 changed files with 5 additions and 3 deletions
|
@ -70,7 +70,7 @@ mapping2.enable();
|
||||||
|
|
||||||
Controller.enableMapping("example2");
|
Controller.enableMapping("example2");
|
||||||
*/
|
*/
|
||||||
var mapping3 = Controller.loadMapping("E:/Github/hifi/examples/controllers/example3.json");
|
var mapping3 = Controller.loadMapping(Script.resolvePath("example3.json"));
|
||||||
Controller.enableMapping("example3");
|
Controller.enableMapping("example3");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -209,6 +209,7 @@ namespace controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* ScriptingInterface::loadMapping(const QString& jsonUrl) {
|
QObject* ScriptingInterface::loadMapping(const QString& jsonUrl) {
|
||||||
|
QObject* result = nullptr;
|
||||||
auto request = ResourceManager::createResourceRequest(nullptr, QUrl(jsonUrl));
|
auto request = ResourceManager::createResourceRequest(nullptr, QUrl(jsonUrl));
|
||||||
if (request) {
|
if (request) {
|
||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
|
@ -220,12 +221,13 @@ namespace controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request->getResult() == ResourceRequest::Success) {
|
if (request->getResult() == ResourceRequest::Success) {
|
||||||
return parseMapping(QString(request->getData()));
|
result = parseMapping(QString(request->getData()));
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Failed to load mapping url <" << jsonUrl << ">" << endl;
|
qDebug() << "Failed to load mapping url <" << jsonUrl << ">" << endl;
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
request->deleteLater();
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_INVOKABLE QObject* newMapping(const QJsonObject& json);
|
Q_INVOKABLE QObject* newMapping(const QJsonObject& json);
|
||||||
|
|
Loading…
Reference in a new issue