mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:12:46 +02:00
switching between particle entities
This commit is contained in:
parent
85d8fc2944
commit
f98941e80f
3 changed files with 11 additions and 5 deletions
|
@ -1881,12 +1881,17 @@ var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
|
||||||
|
|
||||||
propertiesTool = PropertiesTool();
|
propertiesTool = PropertiesTool();
|
||||||
var particleExplorerTool = ParticleExplorerTool();
|
var particleExplorerTool = ParticleExplorerTool();
|
||||||
|
var selectedParticleEntity = 0;
|
||||||
entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
||||||
var data = JSON.parse(data);
|
var data = JSON.parse(data);
|
||||||
if (data.type == "selectionUpdate") {
|
if (data.type == "selectionUpdate") {
|
||||||
var ids = data.entityIds;
|
var ids = data.entityIds;
|
||||||
if(ids.length === 1) {
|
if(ids.length === 1) {
|
||||||
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") {
|
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect" ) {
|
||||||
|
if (JSON.stringify(selectedParticleEntity) !== JSON.stringify(ids[0])) {
|
||||||
|
// We already had a particle entity selected, so destroy that one and create the new one
|
||||||
|
particleExplorerTool.destroyWebView();
|
||||||
|
}
|
||||||
// Now we want to activate the partice explorer panel!
|
// Now we want to activate the partice explorer panel!
|
||||||
particleExplorerTool.createWebView();
|
particleExplorerTool.createWebView();
|
||||||
var properties = Entities.getEntityProperties(ids[0]);
|
var properties = Entities.getEntityProperties(ids[0]);
|
||||||
|
@ -1898,7 +1903,7 @@ entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
// Wait for event bridge on web side to open
|
// Wait for event bridge on web side to open
|
||||||
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
||||||
}, 3000)
|
}, 2000)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
particleExplorerTool.destroyWebView();
|
particleExplorerTool.destroyWebView();
|
||||||
|
|
|
@ -338,9 +338,7 @@ function writeVec3ToInterface(obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function listenForSettingsUpdates() {
|
function listenForSettingsUpdates() {
|
||||||
console.log("EBL LISTENING FOR EVENTS ON PARTICLE GUI WEB SIDE!")
|
|
||||||
EventBridge.scriptEventReceived.connect(function(data) {
|
EventBridge.scriptEventReceived.connect(function(data) {
|
||||||
console.log("EBL RECIEVED EVENT!! ON WEB SIDE - " + JSON.stringify(data));
|
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data.messageType === 'particle_settings') {
|
if (data.messageType === 'particle_settings') {
|
||||||
_.each(data.currentProperties, function(value, key) {
|
_.each(data.currentProperties, function(value, key) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// particleExplorerTool.js
|
// particleExplorerTool.js
|
||||||
//
|
//
|
||||||
// Created by Eric Levin on 2/15/16
|
// Created by Eric Levin on 2/15/16
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
// Adds particleExplorer tool to the edit panel when a user selects a particle entity from the edit tool window
|
// Adds particleExplorer tool to the edit panel when a user selects a particle entity from the edit tool window
|
||||||
// This is an example of a new, easy way to do two way bindings between dynamically created GUI and in-world entities.
|
// This is an example of a new, easy way to do two way bindings between dynamically created GUI and in-world entities.
|
||||||
//
|
//
|
||||||
|
@ -31,6 +31,9 @@ ParticleExplorerTool = function() {
|
||||||
|
|
||||||
|
|
||||||
that.destroyWebView = function() {
|
that.destroyWebView = function() {
|
||||||
|
if (!that.webView) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
that.webView.close();
|
that.webView.close();
|
||||||
that.webView = null;
|
that.webView = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue