overte/examples/particle_explorer/particleExplorerTool.js
2016-02-01 15:23:54 -08:00

41 lines
No EOL
1.1 KiB
JavaScript

var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath('particleExplorer.html');
ParticleExplorerTool = function() {
var that = {};
that.createWebView = function() {
var url = PARTICLE_EXPLORER_HTML_URL;
that.webView = new OverlayWebWindow({
title: 'Particle Explorer',
source: url,
toolWindow: true
});
that.webView.setVisible(true);
that.webView.eventBridge.webEventReceived.connect(that.webEventReceived);
}
that.destroyWebView = function() {
print("EBL DESTROY WEB VIEW" + that.webView);
that.webView.close();
that.webView = null;
}
that.webEventReceived = function(data) {
var data = JSON.parse(data);
if (data.messageType === "settings_update") {
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
}
print("EBL WEB EVENT RECIEVED FROM PARTICLE GUI");
}
that.setActiveParticleEntity = function(id) {
that.activeParticleEntity = id;
}
return that;
};