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
// that it would remove by title name instead.
function enableParticles(enabled) {
if (enabled && editTabView.children.length < 4) {
if (enabled && editTabView.count < 5) {
console.log("ADDING PARTICLES TAB");
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");
editTabView.removeTab(4);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -16,8 +16,17 @@ var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath(' .html');
ParticleExplorerTool = function() {
var that = {};
that.createWebView = function() {
var bound = false;
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.setVisible = function(value) {};
that.webView.webEventReceived.connect(that.webEventReceived);
@ -35,16 +44,17 @@ ParticleExplorerTool = function() {
that.webView.emitScriptEvent(JSON.stringify(messageData));
}
*/
that.webEventReceived = function(data) {
var data = JSON.parse(data);
if (data.messageType === "settings_update") {
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
var message = JSON.parse(data);
if (message.messageType === "settings_update") {
Entities.editEntity(that.activeParticleEntity, message.updatedSettings);
}
}
};
that.setActiveParticleEntity = function(id) {
that.activeParticleEntity = id;
}
};
return that;
};