mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 20:07:47 +02:00
when a new particle-entity is created, hook the particle explorer to it
This commit is contained in:
parent
bfa5f6a425
commit
33c1c3ac11
1 changed files with 32 additions and 22 deletions
|
@ -180,8 +180,12 @@ var toolBar = (function () {
|
||||||
position = grid.snapToSurface(grid.snapToGrid(position, false, dimensions), dimensions),
|
position = grid.snapToSurface(grid.snapToGrid(position, false, dimensions), dimensions),
|
||||||
properties.position = position;
|
properties.position = position;
|
||||||
entityID = Entities.addEntity(properties);
|
entityID = Entities.addEntity(properties);
|
||||||
|
if (properties.type == "ParticleEffect") {
|
||||||
|
selectParticleEntity(entityID);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Window.notifyEditError("Can't create " + properties.type + ": " + properties.type + " would be out of bounds.");
|
Window.notifyEditError("Can't create " + properties.type + ": " +
|
||||||
|
properties.type + " would be out of bounds.");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections();
|
||||||
|
@ -1903,6 +1907,32 @@ var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
|
||||||
var propertiesTool = new PropertiesTool();
|
var propertiesTool = new PropertiesTool();
|
||||||
var particleExplorerTool = new ParticleExplorerTool();
|
var particleExplorerTool = new ParticleExplorerTool();
|
||||||
var selectedParticleEntity = 0;
|
var selectedParticleEntity = 0;
|
||||||
|
|
||||||
|
function selectParticleEntity(entityID) {
|
||||||
|
var properties = Entities.getEntityProperties(entityID);
|
||||||
|
var particleData = {
|
||||||
|
messageType: "particle_settings",
|
||||||
|
currentProperties: properties
|
||||||
|
};
|
||||||
|
particleExplorerTool.destroyWebView();
|
||||||
|
particleExplorerTool.createWebView();
|
||||||
|
|
||||||
|
selectedParticleEntity = entityID;
|
||||||
|
particleExplorerTool.setActiveParticleEntity(entityID);
|
||||||
|
|
||||||
|
if (Settings.getValue("HUDUIEnabled")) {
|
||||||
|
particleExplorerTool.webView.webEventReceived.connect(function (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.messageType === "page_loaded") {
|
||||||
|
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// in the tablet version, the page was loaded earlier
|
||||||
|
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
entityListTool.webView.webEventReceived.connect(function (data) {
|
entityListTool.webView.webEventReceived.connect(function (data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data.type === "selectionUpdate") {
|
if (data.type === "selectionUpdate") {
|
||||||
|
@ -1914,27 +1944,7 @@ entityListTool.webView.webEventReceived.connect(function (data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Destroy the old particles web view first
|
// Destroy the old particles web view first
|
||||||
particleExplorerTool.destroyWebView();
|
selectParticleEntity(ids[0])
|
||||||
particleExplorerTool.createWebView();
|
|
||||||
var properties = Entities.getEntityProperties(ids[0]);
|
|
||||||
var particleData = {
|
|
||||||
messageType: "particle_settings",
|
|
||||||
currentProperties: properties
|
|
||||||
};
|
|
||||||
selectedParticleEntity = ids[0];
|
|
||||||
particleExplorerTool.setActiveParticleEntity(ids[0]);
|
|
||||||
|
|
||||||
if (Settings.getValue("HUDUIEnabled")) {
|
|
||||||
particleExplorerTool.webView.webEventReceived.connect(function (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.messageType === "page_loaded") {
|
|
||||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// in the tablet version, the page was loaded earlier
|
|
||||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
selectedParticleEntity = 0;
|
selectedParticleEntity = 0;
|
||||||
particleExplorerTool.destroyWebView();
|
particleExplorerTool.destroyWebView();
|
||||||
|
|
Loading…
Reference in a new issue