mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:56:52 +02:00
add two-way code but dont enable
This commit is contained in:
parent
5013e98b6c
commit
7a59a7dc43
2 changed files with 43 additions and 24 deletions
|
@ -84,10 +84,11 @@ var ParticleExplorer = function() {
|
|||
|
||||
//we need a way to keep track of our gui controllers
|
||||
var controllers = [];
|
||||
var particleExplorer;
|
||||
window.onload = function() {
|
||||
|
||||
//instantiate our object
|
||||
var particleExplorer = new ParticleExplorer();
|
||||
particleExplorer = new ParticleExplorer();
|
||||
|
||||
//whether or not to autoplace
|
||||
var gui = new dat.GUI({
|
||||
|
@ -113,6 +114,8 @@ window.onload = function() {
|
|||
_.each(particleKeys, function(key) {
|
||||
//add this key as a controller to the gui
|
||||
var controller = gui.add(particleExplorer, key);
|
||||
// the call below is potentially expensive but will enable two way binding. needs testing to see how many it supports at once.
|
||||
//var controller = gui.add(particleExplorer, key).listen();
|
||||
|
||||
var putInGroup = false;
|
||||
_.each(groups, function(group) {
|
||||
|
@ -181,3 +184,15 @@ function writeDataToInterface(property, value, shouldGroup) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
function listenForSettingsUpdates() {
|
||||
if (typeof EventBridge !== 'undefined') {
|
||||
EventBridge.scriptEventReceived.connect(function(data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.type === 'particleSettingsUpdate') {
|
||||
var particleSettings = data.particleSettings
|
||||
//parse the settings and change particle explorer, add .listen() to controllers
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -145,6 +145,9 @@ SettingsWindow = function() {
|
|||
_this.webWindow.eventBridge.webEventReceived.connect(_this.onWebEventReceived);
|
||||
print('INIT testParticles' + testParticles)
|
||||
};
|
||||
this.sendData = function(data) {
|
||||
_this.webWindow.eventBridge.emitScriptEvent(JSON.stringify(data));
|
||||
};
|
||||
this.onWebEventReceived = function(data) {
|
||||
// print('DATA ' + data)
|
||||
var _data = JSON.parse(data)
|
||||
|
@ -171,6 +174,7 @@ function editEntity(properties) {
|
|||
Entities.editEntity(testParticles, properties);
|
||||
var currentProperties = Entities.getEntityProperties(testParticles)
|
||||
// print('CURRENT PROPS', JSON.stringify(currentProperties))
|
||||
SettingsWindow.sendData({type:'particleSettingsUpdate',particleSettings:currentProperties})
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue