mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 02:23:38 +02:00
Merge pull request #10565 from vladest/fix_claraio_download_clones
Make sure that there is only one connection created for web events, s…
This commit is contained in:
commit
9a80a81321
5 changed files with 45 additions and 18 deletions
|
@ -170,20 +170,24 @@ Item {
|
||||||
objectName: "loader"
|
objectName: "loader"
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
|
// Hook up callback for clara.io download from the marketplace.
|
||||||
|
Connections {
|
||||||
|
id: eventBridgeConnection
|
||||||
|
target: null
|
||||||
|
onWebEventReceived: {
|
||||||
|
if (message.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
||||||
|
ApplicationInterface.addAssetToWorldFromURL(message.slice(18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
if (loader.item.hasOwnProperty("eventBridge")) {
|
if (loader.item.hasOwnProperty("eventBridge")) {
|
||||||
loader.item.eventBridge = eventBridge;
|
loader.item.eventBridge = eventBridge;
|
||||||
|
eventBridgeConnection.target = eventBridge
|
||||||
// Hook up callback for clara.io download from the marketplace.
|
|
||||||
eventBridge.webEventReceived.connect(function (event) {
|
|
||||||
if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
|
||||||
ApplicationInterface.addAssetToWorldFromURL(event.slice(18));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (loader.item.hasOwnProperty("sendToScript")) {
|
if (loader.item.hasOwnProperty("sendToScript")) {
|
||||||
loader.item.sendToScript.connect(tabletRoot.sendToScript);
|
loader.item.sendToScript.connect(tabletRoot.sendToScript);
|
||||||
|
|
|
@ -90,16 +90,21 @@ Windows.ScrollingWindow {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
// Hook up callback for clara.io download from the marketplace.
|
||||||
|
Connections {
|
||||||
|
id: eventBridgeConnection
|
||||||
|
target: null
|
||||||
|
onWebEventReceived: {
|
||||||
|
if (message.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
||||||
|
ApplicationInterface.addAssetToWorldFromURL(message.slice(18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
if (loader.item.hasOwnProperty("eventBridge")) {
|
if (loader.item.hasOwnProperty("eventBridge")) {
|
||||||
loader.item.eventBridge = eventBridge;
|
loader.item.eventBridge = eventBridge;
|
||||||
|
eventBridgeConnection.target = eventBridge
|
||||||
// Hook up callback for clara.io download from the marketplace.
|
|
||||||
eventBridge.webEventReceived.connect(function (event) {
|
|
||||||
if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
|
||||||
ApplicationInterface.addAssetToWorldFromURL(event.slice(18));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (loader.item.hasOwnProperty("sendToScript")) {
|
if (loader.item.hasOwnProperty("sendToScript")) {
|
||||||
loader.item.sendToScript.connect(tabletRoot.sendToScript);
|
loader.item.sendToScript.connect(tabletRoot.sendToScript);
|
||||||
|
|
|
@ -2100,7 +2100,13 @@ function selectParticleEntity(entityID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
entityListTool.webView.webEventReceived.connect(function (data) {
|
entityListTool.webView.webEventReceived.connect(function (data) {
|
||||||
data = JSON.parse(data);
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch(e) {
|
||||||
|
print("edit.js: Error parsing JSON: " + e.name + " data " + data)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.type === 'parent') {
|
if (data.type === 'parent') {
|
||||||
parentSelectedEntities();
|
parentSelectedEntities();
|
||||||
} else if(data.type === 'unparent') {
|
} else if(data.type === 'unparent') {
|
||||||
|
|
|
@ -109,7 +109,13 @@ EntityListTool = function(opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
webView.webEventReceived.connect(function(data) {
|
webView.webEventReceived.connect(function(data) {
|
||||||
data = JSON.parse(data);
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch(e) {
|
||||||
|
print("entityList.js: Error parsing JSON: " + e.name + " data " + data)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.type == "selectionUpdate") {
|
if (data.type == "selectionUpdate") {
|
||||||
var ids = data.entityIds;
|
var ids = data.entityIds;
|
||||||
var entityIDs = [];
|
var entityIDs = [];
|
||||||
|
|
|
@ -238,7 +238,13 @@ GridTool = function(opts) {
|
||||||
});
|
});
|
||||||
|
|
||||||
webView.webEventReceived.connect(function(data) {
|
webView.webEventReceived.connect(function(data) {
|
||||||
data = JSON.parse(data);
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch(e) {
|
||||||
|
print("gridTool.js: Error parsing JSON: " + e.name + " data " + data)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.type == "init") {
|
if (data.type == "init") {
|
||||||
horizontalGrid.emitUpdate();
|
horizontalGrid.emitUpdate();
|
||||||
} else if (data.type == "update") {
|
} else if (data.type == "update") {
|
||||||
|
|
Loading…
Reference in a new issue