mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
Fixed issue with orientation
This commit is contained in:
parent
e76dfe4182
commit
4842de8f07
5 changed files with 35 additions and 33 deletions
|
@ -80,22 +80,7 @@ selectionManager.addEventListener(function () {
|
||||||
}
|
}
|
||||||
var type = Entities.getEntityProperties(selectedEntityID, "type").type;
|
var type = Entities.getEntityProperties(selectedEntityID, "type").type;
|
||||||
if (type === "ParticleEffect") {
|
if (type === "ParticleEffect") {
|
||||||
// Destroy the old particles web view first
|
selectParticleEntity(selectedEntityID);
|
||||||
particleExplorerTool.destroyWebView();
|
|
||||||
particleExplorerTool.createWebView();
|
|
||||||
var properties = Entities.getEntityProperties(selectedEntityID);
|
|
||||||
var particleData = {
|
|
||||||
messageType: "particle_settings",
|
|
||||||
currentProperties: properties
|
|
||||||
};
|
|
||||||
selectedParticleEntityID = selectedEntityID;
|
|
||||||
particleExplorerTool.setActiveParticleEntity(selectedParticleEntityID);
|
|
||||||
particleData.emitOrientation = Quat.safeEulerAngles(particleData.emitOrientation);
|
|
||||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
|
||||||
|
|
||||||
// Switch to particle explorer
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
|
||||||
tablet.sendToQml({method: 'selectTab', params: {id: 'particle'}});
|
|
||||||
} else {
|
} else {
|
||||||
needToDestroyParticleExplorer = true;
|
needToDestroyParticleExplorer = true;
|
||||||
}
|
}
|
||||||
|
@ -2078,6 +2063,10 @@ var selectedParticleEntityID = null;
|
||||||
|
|
||||||
function selectParticleEntity(entityID) {
|
function selectParticleEntity(entityID) {
|
||||||
var properties = Entities.getEntityProperties(entityID);
|
var properties = Entities.getEntityProperties(entityID);
|
||||||
|
|
||||||
|
if(properties.emitOrientation) {
|
||||||
|
properties.emitOrientation = Quat.safeEulerAngles(properties.emitOrientation);
|
||||||
|
}
|
||||||
var particleData = {
|
var particleData = {
|
||||||
messageType: "particle_settings",
|
messageType: "particle_settings",
|
||||||
currentProperties: properties
|
currentProperties: properties
|
||||||
|
@ -2087,6 +2076,7 @@ function selectParticleEntity(entityID) {
|
||||||
|
|
||||||
selectedParticleEntity = entityID;
|
selectedParticleEntity = entityID;
|
||||||
particleExplorerTool.setActiveParticleEntity(entityID);
|
particleExplorerTool.setActiveParticleEntity(entityID);
|
||||||
|
|
||||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
||||||
|
|
||||||
// Switch to particle explorer
|
// Switch to particle explorer
|
||||||
|
|
|
@ -45,8 +45,9 @@ and If there is any changes to either the Entities or properties of
|
||||||
|
|
||||||
var RADIAN = Math.PI / 180;
|
var RADIAN = Math.PI / 180;
|
||||||
|
|
||||||
var roundFloat = function (input) {
|
var roundFloat = function (input, round) {
|
||||||
return Math.floor(parseFloat(input) * 1000)/1000;
|
round = round ? round: 1000;
|
||||||
|
return Math.round(parseFloat(input) * round)/round;
|
||||||
};
|
};
|
||||||
|
|
||||||
function HifiEntityUI(parent) {
|
function HifiEntityUI(parent) {
|
||||||
|
@ -186,9 +187,9 @@ HifiEntityUI.prototype = {
|
||||||
var red = document.getElementById(value + "-red");
|
var red = document.getElementById(value + "-red");
|
||||||
var blue = document.getElementById(value + "-blue");
|
var blue = document.getElementById(value + "-blue");
|
||||||
var green = document.getElementById(value + "-green");
|
var green = document.getElementById(value + "-green");
|
||||||
red.value = roundFloat(property.red);
|
red.value = parseInt(property.red);
|
||||||
blue.value = roundFloat(property.blue);
|
blue.value = parseInt(property.blue);
|
||||||
green.value = roundFloat(property.green);
|
green.value = parseInt(property.green);
|
||||||
|
|
||||||
red.oninput({
|
red.oninput({
|
||||||
target: red
|
target: red
|
||||||
|
@ -197,18 +198,19 @@ HifiEntityUI.prototype = {
|
||||||
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.
|
|
||||||
x.value = roundFloat(property.x);
|
x.value = roundFloat(property.x, 100);
|
||||||
y.value = roundFloat(property.y);
|
y.value = roundFloat(property.y, 100);
|
||||||
z.value = roundFloat(property.z);
|
z.value = roundFloat(property.z, 100);
|
||||||
} else if (field.className.indexOf("pyr") !== -1) {
|
} else if (field.className.indexOf("pyr") !== -1) {
|
||||||
var pitch = document.getElementById(value + "-Pitch");
|
var pitch = document.getElementById(value + "-Pitch");
|
||||||
var yaw = document.getElementById(value + "-Yaw");
|
var yaw = document.getElementById(value + "-Yaw");
|
||||||
var roll = document.getElementById(value + "-Roll");
|
var roll = document.getElementById(value + "-Roll");
|
||||||
// crashes here.
|
|
||||||
pitch.value = roundFloat(property.x);
|
pitch.value = roundFloat(property.x, 100);
|
||||||
yaw.value = roundFloat(property.y);
|
yaw.value = roundFloat(property.y, 100);
|
||||||
roll.value = roundFloat(property.z);
|
roll.value = roundFloat(property.z, 100);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +303,7 @@ HifiEntityUI.prototype = {
|
||||||
sectionDivBody.style.maxHeight = "0px";
|
sectionDivBody.style.maxHeight = "0px";
|
||||||
} else {
|
} else {
|
||||||
sectionDivBody.className += " visible";
|
sectionDivBody.className += " visible";
|
||||||
sectionDivBody.style.maxHeight = height;
|
sectionDivBody.style.maxHeight = (animationWrapper.clientHeight) + "px";
|
||||||
}
|
}
|
||||||
// sectionDivBody.style.display = collapsed ? "none": "block";
|
// sectionDivBody.style.display = collapsed ? "none": "block";
|
||||||
dropDown.innerHTML = collapsed ? "L" : "M";
|
dropDown.innerHTML = collapsed ? "L" : "M";
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<script type="text/javascript" src="../html/js/colpick.js"></script>
|
<script type="text/javascript" src="../html/js/colpick.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="underscore-min.js"></script>
|
<script type="text/javascript" src="underscore-min.js"></script>
|
||||||
<script type="text/javascript" src="hifi-entity-ui.js"></script>
|
<script type="text/javascript" src="hifi-entity-ui.js?v1"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../html/css/hifi-style.css">
|
<link rel="stylesheet" type="text/css" href="../html/css/hifi-style.css">
|
||||||
<link rel="stylesheet" type="text/css" href="../html/css/edit-style.css">
|
<link rel="stylesheet" type="text/css" href="../html/css/edit-style.css">
|
||||||
|
|
|
@ -149,7 +149,11 @@
|
||||||
id: "emitOrientation",
|
id: "emitOrientation",
|
||||||
unit: "deg",
|
unit: "deg",
|
||||||
name: "Emit Orientation",
|
name: "Emit Orientation",
|
||||||
type: "VectorQuaternion"
|
type: "VectorQuaternion",
|
||||||
|
defaultRange: {
|
||||||
|
min: 0,
|
||||||
|
step: 0.01
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{ type: "Row" },
|
{ type: "Row" },
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,8 +37,14 @@ ParticleExplorerTool = function() {
|
||||||
that.webEventReceived = function(data) {
|
that.webEventReceived = function(data) {
|
||||||
var data = JSON.parse(data);
|
var data = JSON.parse(data);
|
||||||
if (data.messageType === "settings_update") {
|
if (data.messageType === "settings_update") {
|
||||||
data.updatedSettings.emitOrientation = Quat.fromVec3Degrees(data.updatedSettings.emitOrientation);
|
if (data.updatedSettings.emitOrientation) {
|
||||||
|
data.updatedSettings.emitOrientation = Quat.fromVec3Degrees(data.updatedSettings.emitOrientation);
|
||||||
|
}
|
||||||
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
|
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
|
||||||
|
|
||||||
|
if ( data.updatedSettings.emitOrientation ) {
|
||||||
|
print('-settings-udate- ' + that.activeParticleEntity + ' - ' + JSON.stringify(data.updatedSettings));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue