Trying to hunt down a specific issue

This commit is contained in:
Menithal 2017-05-24 09:53:01 +03:00
parent 9aa7e2e56d
commit 674f1f5f3a
6 changed files with 46 additions and 43 deletions

View file

@ -273,10 +273,10 @@ TabView {
// This should eventually be done properly so that if more tabs are added // This should eventually be done properly so that if more tabs are added
// that it would remove by title name instead. // that it would remove by title name instead.
function enableParticles(enabled) { function enableParticles(enabled) {
if (enabled && editTabView.children.length < 4) { if (enabled && editTabView.count < 5) {
console.log("ADDING PARTICLES TAB"); console.log("ADDING PARTICLES TAB");
editTabView.addTab("P", Qt.createComponent("tabs/ParticleTab.qml")); editTabView.addTab("P", Qt.createComponent("tabs/ParticleTab.qml"));
} else if (!enabled && editTabView.children.length > 2) { } else if (!enabled && editTabView.count > 4) {
console.log("REMOVING PARTICLES TAB"); console.log("REMOVING PARTICLES TAB");
editTabView.removeTab(4); editTabView.removeTab(4);
} }

View file

@ -83,8 +83,8 @@ selectionManager.addEventListener(function () {
if (type === "ParticleEffect") { if (type === "ParticleEffect") {
// Destroy the old particles web view first // Destroy the old particles web view first
particleExplorerTool.destroyWebView(); // particleExplorerTool.destroyWebView();
particleExplorerTool.createWebView(); particleExplorerTool.bindWebView();
var properties = Entities.getEntityProperties(selectedEntityID); var properties = Entities.getEntityProperties(selectedEntityID);
var particleData = { var particleData = {
messageType: "particle_settings", messageType: "particle_settings",
@ -112,7 +112,7 @@ selectionManager.addEventListener(function () {
if (needToDestroyParticleExplorer && selectedParticleEntityID !== null) { if (needToDestroyParticleExplorer && selectedParticleEntityID !== null) {
tablet.sendToQml({method: 'enableParticles', params: {enabled: false}}); tablet.sendToQml({method: 'enableParticles', params: {enabled: false}});
selectedParticleEntityID = null; selectedParticleEntityID = null;
particleExplorerTool.destroyWebView(); particleExplorerTool.bindWebView();
} }
}); });
@ -870,13 +870,13 @@ function mouseClickEvent(event) {
selectedEntityID = foundEntity; selectedEntityID = foundEntity;
orientation = MyAvatar.orientation; orientation = MyAvatar.orientation;
intersection = rayPlaneIntersection(pickRay, P, Quat.getForward(orientation)); intersection = rayPlaneIntersection(pickRay, P, Quat.getForward(orientation));
/*
if (event.isShifted) { if (event.isShifted) {
particleExplorerTool.destroyWebView(); particleExplorerTool.destroyWebView();
} }*/
if (properties.type !== "ParticleEffect") { if (properties.type !== "ParticleEffect") {
tablet.sendToQml({method: 'enableParticles', params: {enabled: false}}); tablet.sendToQml({method: 'enableParticles', params: {enabled: false}});
particleExplorerTool.destroyWebView(); // particleExplorerTool.destroyWebView();
} else { } else {
tablet.sendToQml({method: 'enableParticles', params: {enabled: true}}); tablet.sendToQml({method: 'enableParticles', params: {enabled: true}});
} }
@ -1310,7 +1310,7 @@ function parentSelectedEntities() {
function deleteSelectedEntities() { function deleteSelectedEntities() {
if (SelectionManager.hasSelection()) { if (SelectionManager.hasSelection()) {
selectedParticleEntityID = null; selectedParticleEntityID = null;
particleExplorerTool.destroyWebView(); // particleExplorerTool.destroyWebView();
SelectionManager.saveProperties(); SelectionManager.saveProperties();
var savedProperties = []; var savedProperties = [];
var newSortedSelection = sortSelectedEntities(selectionManager.selections); var newSortedSelection = sortSelectedEntities(selectionManager.selections);
@ -2095,8 +2095,8 @@ function selectParticleEntity(entityID) {
messageType: "particle_settings", messageType: "particle_settings",
currentProperties: properties currentProperties: properties
}; };
particleExplorerTool.destroyWebView(); // particleExplorerTool.destroyWebView();
particleExplorerTool.createWebView(); particleExplorerTool.bindWebView();
selectedParticleEntity = entityID; selectedParticleEntity = entityID;
particleExplorerTool.setActiveParticleEntity(entityID); particleExplorerTool.setActiveParticleEntity(entityID);
@ -2128,7 +2128,7 @@ entityListTool.webView.webEventReceived.connect(function (data) {
} else { } else {
tablet.sendToQml({method: 'enableParticles', params: {enabled: false}}); tablet.sendToQml({method: 'enableParticles', params: {enabled: false}});
selectedParticleEntity = 0; selectedParticleEntity = 0;
particleExplorerTool.destroyWebView(); //particleExplorerTool.destroyWebView();
} }
} }
} }

View file

@ -69,7 +69,6 @@ HifiEntityUI.prototype = {
data = JSON.parse(data); data = JSON.parse(data);
if (data.messageType === 'particle_settings') { if (data.messageType === 'particle_settings') {
// Update settings // Update settings
console.log(data);
var currentProperties = data.currentProperties; var currentProperties = data.currentProperties;
// Do expected property match with structure; // Do expected property match with structure;
Object.keys(currentProperties).forEach(function(value, index) { Object.keys(currentProperties).forEach(function(value, index) {
@ -81,7 +80,7 @@ HifiEntityUI.prototype = {
if (field.className.indexOf("radian") !== -1) { if (field.className.indexOf("radian") !== -1) {
el.value = property / RADIAN; el.value = property / RADIAN;
el.onchange({target: el}); el.onchange({target: el});
} else if (field.className.indexOf("range") !== -1 || field.className.indexOf("texture") !== -1){ } else if (field.className.indexOf("range") !== -1 || field.className.indexOf("texture") !== -1) {
el.value = property; el.value = property;
el.onchange({target: el}); el.onchange({target: el});
} else if (field.className.indexOf("checkbox") !== -1) { } else if (field.className.indexOf("checkbox") !== -1) {
@ -102,19 +101,16 @@ HifiEntityUI.prototype = {
// crashes here. // crashes here.
} else if (field.className.indexOf("xyz")) { } else if (field.className.indexOf("xyz")) {
/*
var x = document.getElementById(value+"-x"); var x = document.getElementById(value+"-x");
var y = document.getElementById(value+"-y"); var y = document.getElementById(value+"-y");
var z = document.getElementById(value+"-z"); var z = document.getElementById(value+"-z");
// crashes here. // crashes here.
if (value === "emitOrientation") { x.value = property.x;
y.value = property.y;
} else { z.value = property.z;
x.value = property.x; */
y.value = property.y;
z.value = property.z;
}
} }
} }
} }
@ -157,7 +153,7 @@ HifiEntityUI.prototype = {
for (var property in properties) { for (var property in properties) {
var builtRow = self.addElement(animationWrapper, properties[property]) var builtRow = self.addElement(animationWrapper, properties[property]);
var id = properties[property].id; var id = properties[property].id;
if (id) { if (id) {
self.builtRows[id] = builtRow; self.builtRows[id] = builtRow;
@ -207,20 +203,14 @@ HifiEntityUI.prototype = {
} }
return label; return label;
}, },
addVector: function(parent, group){ addVector: function(parent, group, labels){
var self = this; var self = this;
var inputs = ["x","y","z"]; var inputs = labels | ["x","y","z"];
var domArray = []; var domArray = [];
parent.id = group.id; parent.id = group.id;
for (var index in inputs) { for (var index in inputs) {
var element = document.createElement("input"); var element = document.createElement("input");
if (group.defaultColor) {
element.value = group.defaultColor[inputs[index]];
} else if (inputs[index] === "red"){
element.value = 255;
} else {
element.value = 0;
}
element.setAttribute("type","number"); element.setAttribute("type","number");
element.className = inputs[index]; element.className = inputs[index];
element.id = group.id + "-" + inputs[index]; element.id = group.id + "-" + inputs[index];
@ -232,7 +222,11 @@ HifiEntityUI.prototype = {
} }
this.addLabel(parent, group); this.addLabel(parent, group);
parent.className += " property vector-section xyz"; var className = "";
for ( var i = 0; i < inputs.length; i++) {
className += inputs[i];
}
parent.className += " property vector-section " + className;
// Add Tuple and the rest // Add Tuple and the rest
var tupleContainer = document.createElement("div"); var tupleContainer = document.createElement("div");
@ -250,7 +244,7 @@ HifiEntityUI.prototype = {
parent.appendChild(tupleContainer); parent.appendChild(tupleContainer);
}, },
addVectorQuaternion: function(parent, group) { addVectorQuaternion: function(parent, group) {
this.addVector(parent,group); this.addVector(parent,group, ["Pitch", "Yaw", "Roll"]);
}, },
addColorPicker: function(parent, group) { addColorPicker: function(parent, group) {
var self = this; var self = this;

View file

@ -33,7 +33,6 @@
<div id="particle-explorer"> <div id="particle-explorer">
<div class="section-header"> <div class="section-header">
<label> Particle Explorer </label> <label> Particle Explorer </label>
<!-- padding -->
</div> </div>
<!-- This will be filled by the script! --> <!-- This will be filled by the script! -->
</div> </div>

View file

@ -81,7 +81,7 @@
id: "emitOrientation", id: "emitOrientation",
unit: "deg", unit: "deg",
name: "Emit Orientation", name: "Emit Orientation",
type: "Vector" type: "VectorQuaternion"
}, },
{ type: "Row" }, { type: "Row" },
{ {

View file

@ -16,8 +16,17 @@ var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath(' .html');
ParticleExplorerTool = function() { ParticleExplorerTool = function() {
var that = {}; var that = {};
var bound = false;
that.createWebView = function() { that.bindWebView = function() {
if (!bound) {
that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
that.webView.setVisible = function(value) {};
that.webView.webEventReceived.connect(that.webEventReceived);
bound = true;
}
}
/*
that.createWebView = function() {
that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
that.webView.setVisible = function(value) {}; that.webView.setVisible = function(value) {};
that.webView.webEventReceived.connect(that.webEventReceived); that.webView.webEventReceived.connect(that.webEventReceived);
@ -35,16 +44,17 @@ ParticleExplorerTool = function() {
that.webView.emitScriptEvent(JSON.stringify(messageData)); that.webView.emitScriptEvent(JSON.stringify(messageData));
} }
*/
that.webEventReceived = function(data) { that.webEventReceived = function(data) {
var data = JSON.parse(data); var message = JSON.parse(data);
if (data.messageType === "settings_update") { if (message.messageType === "settings_update") {
Entities.editEntity(that.activeParticleEntity, data.updatedSettings); Entities.editEntity(that.activeParticleEntity, message.updatedSettings);
} }
} };
that.setActiveParticleEntity = function(id) { that.setActiveParticleEntity = function(id) {
that.activeParticleEntity = id; that.activeParticleEntity = id;
} };
return that; return that;
}; };