mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 21:56:15 +02:00
Add deleteMapping to asset scripting interface
This commit is contained in:
parent
a18486d97d
commit
6ca4b72479
2 changed files with 17 additions and 0 deletions
|
@ -782,6 +782,22 @@ void AssetScriptingInterface::getMapping(QString path, QScriptValue callback) {
|
||||||
request->start();
|
request->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssetScriptingInterface::deleteMapping(QString path, QScriptValue callback) {
|
||||||
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
|
auto request = assetClient->createDeleteMappingRequest(path);
|
||||||
|
|
||||||
|
connect(request, &DeleteMappingRequest::finished, this, [this, callback](DeleteMappingRequest* request) mutable {
|
||||||
|
QScriptValueList args { uint8_t(request->getError()) };
|
||||||
|
|
||||||
|
callback.call(_engine->currentContext()->thisObject(), args);
|
||||||
|
|
||||||
|
request->deleteLater();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
request->start();
|
||||||
|
}
|
||||||
|
|
||||||
void AssetScriptingInterface::getAllMappings(QScriptValue callback) {
|
void AssetScriptingInterface::getAllMappings(QScriptValue callback) {
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
auto request = assetClient->createGetAllMappingsRequest();
|
auto request = assetClient->createGetAllMappingsRequest();
|
||||||
|
|
|
@ -188,6 +188,7 @@ public:
|
||||||
Q_INVOKABLE void downloadData(QString url, QScriptValue downloadComplete);
|
Q_INVOKABLE void downloadData(QString url, QScriptValue downloadComplete);
|
||||||
Q_INVOKABLE void setMapping(QString path, QString hash, QScriptValue callback);
|
Q_INVOKABLE void setMapping(QString path, QString hash, QScriptValue callback);
|
||||||
Q_INVOKABLE void getMapping(QString path, QScriptValue callback);
|
Q_INVOKABLE void getMapping(QString path, QScriptValue callback);
|
||||||
|
Q_INVOKABLE void deleteMapping(QString path, QScriptValue callback);
|
||||||
Q_INVOKABLE void getAllMappings(QScriptValue callback);
|
Q_INVOKABLE void getAllMappings(QScriptValue callback);
|
||||||
protected:
|
protected:
|
||||||
QSet<AssetRequest*> _pendingRequests;
|
QSet<AssetRequest*> _pendingRequests;
|
||||||
|
|
Loading…
Reference in a new issue