mirror of
https://github.com/lubosz/overte.git
synced 2025-04-27 09:35:28 +02:00
Fix properties not populating particle explorer tab
This commit is contained in:
parent
6d505ddc99
commit
03bad0265c
2 changed files with 26 additions and 11 deletions
scripts/system
|
@ -2366,22 +2366,19 @@ var selectedParticleEntity = 0;
|
|||
var selectedParticleEntityID = null;
|
||||
|
||||
function selectParticleEntity(entityID) {
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
selectedParticleEntityID = entityID;
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
if (properties.emitOrientation) {
|
||||
properties.emitOrientation = Quat.safeEulerAngles(properties.emitOrientation);
|
||||
}
|
||||
var particleData = {
|
||||
messageType: "particle_settings",
|
||||
currentProperties: properties
|
||||
};
|
||||
|
||||
particleExplorerTool.destroyWebView();
|
||||
particleExplorerTool.createWebView();
|
||||
|
||||
selectedParticleEntity = entityID;
|
||||
particleExplorerTool.setActiveParticleEntity(entityID);
|
||||
|
||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
||||
particleExplorerTool.setActiveParticleProperties(properties);
|
||||
|
||||
// Switch to particle explorer
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
|
|
@ -16,37 +16,55 @@ var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath('particleExplorer.html');
|
|||
|
||||
ParticleExplorerTool = function() {
|
||||
var that = {};
|
||||
that.activeParticleEntity = 0;
|
||||
that.activeParticleProperties = {};
|
||||
|
||||
that.createWebView = function() {
|
||||
that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
that.webView.setVisible = function(value) {};
|
||||
that.webView.webEventReceived.connect(that.webEventReceived);
|
||||
}
|
||||
};
|
||||
|
||||
that.destroyWebView = function() {
|
||||
if (!that.webView) {
|
||||
return;
|
||||
}
|
||||
that.activeParticleEntity = 0;
|
||||
that.activeParticleProperties = {};
|
||||
|
||||
var messageData = {
|
||||
messageType: "particle_close"
|
||||
};
|
||||
that.webView.emitScriptEvent(JSON.stringify(messageData));
|
||||
};
|
||||
|
||||
function sendActiveParticleProperies() {
|
||||
that.webView.emitScriptEvent(JSON.stringify({
|
||||
messageType: "particle_settings",
|
||||
currentProperties: that.activeParticleProperties
|
||||
}));
|
||||
}
|
||||
|
||||
that.webEventReceived = function(data) {
|
||||
var data = JSON.parse(data);
|
||||
data = JSON.parse(data);
|
||||
if (data.messageType === "settings_update") {
|
||||
if (data.updatedSettings.emitOrientation) {
|
||||
data.updatedSettings.emitOrientation = Quat.fromVec3Degrees(data.updatedSettings.emitOrientation);
|
||||
}
|
||||
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
|
||||
} else if (data.messageType === "page_loaded") {
|
||||
sendActiveParticleProperies();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
that.setActiveParticleEntity = function(id) {
|
||||
that.activeParticleEntity = id;
|
||||
}
|
||||
};
|
||||
|
||||
that.setActiveParticleProperties = function(properties) {
|
||||
that.activeParticleProperties = properties;
|
||||
sendActiveParticleProperies();
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue