mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 22:13:12 +02:00
Merge pull request #14376 from thoys/feat/create/localGlobalToggle
[CreateApp] Local/World toggle
This commit is contained in:
commit
5e6d0c0f94
9 changed files with 297 additions and 87 deletions
|
@ -294,12 +294,21 @@
|
||||||
"position": {
|
"position": {
|
||||||
"tooltip": "The global position of this entity."
|
"tooltip": "The global position of this entity."
|
||||||
},
|
},
|
||||||
|
"localPosition": {
|
||||||
|
"tooltip": "The local position of this entity."
|
||||||
|
},
|
||||||
"rotation": {
|
"rotation": {
|
||||||
"tooltip": "The rotation of the entity with respect to world coordinates."
|
"tooltip": "The global rotation of this entity."
|
||||||
|
},
|
||||||
|
"localRotation": {
|
||||||
|
"tooltip": "The local rotation of this entity."
|
||||||
},
|
},
|
||||||
"dimensions": {
|
"dimensions": {
|
||||||
"tooltip": "The global dimensions of this entity."
|
"tooltip": "The global dimensions of this entity."
|
||||||
},
|
},
|
||||||
|
"localDimensions": {
|
||||||
|
"tooltip": "The local dimensions of this entity."
|
||||||
|
},
|
||||||
"scale": {
|
"scale": {
|
||||||
"tooltip": "The global scaling of this entity.",
|
"tooltip": "The global scaling of this entity.",
|
||||||
"skipJSProperty": true
|
"skipJSProperty": true
|
||||||
|
@ -398,13 +407,13 @@
|
||||||
"userData": {
|
"userData": {
|
||||||
"tooltip": "Used to store extra data about the entity in JSON format."
|
"tooltip": "Used to store extra data about the entity in JSON format."
|
||||||
},
|
},
|
||||||
"velocity": {
|
"localVelocity": {
|
||||||
"tooltip": "The linear velocity vector of the entity. The velocity at which this entity moves forward in space."
|
"tooltip": "The linear velocity vector of the entity. The velocity at which this entity moves forward in space."
|
||||||
},
|
},
|
||||||
"damping": {
|
"damping": {
|
||||||
"tooltip": "The linear damping to slow down the linear velocity of an entity over time."
|
"tooltip": "The linear damping to slow down the linear velocity of an entity over time."
|
||||||
},
|
},
|
||||||
"angularVelocity": {
|
"localAngularVelocity": {
|
||||||
"tooltip": "The angular velocity of the entity in rad/s with respect to its axes, about its pivot point."
|
"tooltip": "The angular velocity of the entity in rad/s with respect to its axes, about its pivot point."
|
||||||
},
|
},
|
||||||
"angularDamping": {
|
"angularDamping": {
|
||||||
|
|
|
@ -494,9 +494,9 @@ var toolBar = (function () {
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All);
|
||||||
|
|
||||||
var type = requestedProperties.type;
|
var type = requestedProperties.type;
|
||||||
if (type == "Box" || type == "Sphere") {
|
if (type === "Box" || type === "Sphere") {
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape);
|
||||||
} else if (type == "Image") {
|
} else if (type === "Image") {
|
||||||
requestedProperties.type = "Model";
|
requestedProperties.type = "Model";
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1218,7 +1218,7 @@ function mouseClickEvent(event) {
|
||||||
var result, properties, tabletClicked;
|
var result, properties, tabletClicked;
|
||||||
if (isActive && event.isLeftButton) {
|
if (isActive && event.isLeftButton) {
|
||||||
result = findClickedEntity(event);
|
result = findClickedEntity(event);
|
||||||
tabletOrEditHandleClicked = wasTabletOrEditHandleClicked(event);
|
var tabletOrEditHandleClicked = wasTabletOrEditHandleClicked(event);
|
||||||
if (tabletOrEditHandleClicked) {
|
if (tabletOrEditHandleClicked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1541,7 @@ function insideBox(center, dimensions, point) {
|
||||||
(Math.abs(point.z - center.z) <= (dimensions.z / 2.0));
|
(Math.abs(point.z - center.z) <= (dimensions.z / 2.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAllEtitiesInCurrentSelectionBox(keepIfTouching) {
|
function selectAllEntitiesInCurrentSelectionBox(keepIfTouching) {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
// Get all entities touching the bounding box of the current selection
|
// Get all entities touching the bounding box of the current selection
|
||||||
var boundingBoxCorner = Vec3.subtract(selectionManager.worldPosition,
|
var boundingBoxCorner = Vec3.subtract(selectionManager.worldPosition,
|
||||||
|
@ -1820,9 +1820,9 @@ function handleMenuEvent(menuItem) {
|
||||||
Window.promptAsync("URL of SVO to import", "");
|
Window.promptAsync("URL of SVO to import", "");
|
||||||
}
|
}
|
||||||
} else if (menuItem === "Select All Entities In Box") {
|
} else if (menuItem === "Select All Entities In Box") {
|
||||||
selectAllEtitiesInCurrentSelectionBox(false);
|
selectAllEntitiesInCurrentSelectionBox(false);
|
||||||
} else if (menuItem === "Select All Entities Touching Box") {
|
} else if (menuItem === "Select All Entities Touching Box") {
|
||||||
selectAllEtitiesInCurrentSelectionBox(true);
|
selectAllEntitiesInCurrentSelectionBox(true);
|
||||||
} else if (menuItem === MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) {
|
} else if (menuItem === MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) {
|
||||||
entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE));
|
entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE));
|
||||||
} else if (menuItem === MENU_SHOW_ZONES_IN_EDIT_MODE) {
|
} else if (menuItem === MENU_SHOW_ZONES_IN_EDIT_MODE) {
|
||||||
|
@ -2108,14 +2108,14 @@ var DELETED_ENTITY_MAP = {};
|
||||||
function applyEntityProperties(data) {
|
function applyEntityProperties(data) {
|
||||||
var editEntities = data.editEntities;
|
var editEntities = data.editEntities;
|
||||||
var selectedEntityIDs = [];
|
var selectedEntityIDs = [];
|
||||||
var selectEdits = data.createEntities.length == 0 || !data.selectCreated;
|
var selectEdits = data.createEntities.length === 0 || !data.selectCreated;
|
||||||
var i, entityID;
|
var i, entityID, entityProperties;
|
||||||
for (i = 0; i < editEntities.length; i++) {
|
for (i = 0; i < editEntities.length; i++) {
|
||||||
var entityID = editEntities[i].entityID;
|
entityID = editEntities[i].entityID;
|
||||||
if (DELETED_ENTITY_MAP[entityID] !== undefined) {
|
if (DELETED_ENTITY_MAP[entityID] !== undefined) {
|
||||||
entityID = DELETED_ENTITY_MAP[entityID];
|
entityID = DELETED_ENTITY_MAP[entityID];
|
||||||
}
|
}
|
||||||
var entityProperties = editEntities[i].properties;
|
entityProperties = editEntities[i].properties;
|
||||||
if (entityProperties !== null) {
|
if (entityProperties !== null) {
|
||||||
Entities.editEntity(entityID, entityProperties);
|
Entities.editEntity(entityID, entityProperties);
|
||||||
}
|
}
|
||||||
|
@ -2125,7 +2125,7 @@ function applyEntityProperties(data) {
|
||||||
}
|
}
|
||||||
for (i = 0; i < data.createEntities.length; i++) {
|
for (i = 0; i < data.createEntities.length; i++) {
|
||||||
entityID = data.createEntities[i].entityID;
|
entityID = data.createEntities[i].entityID;
|
||||||
var entityProperties = data.createEntities[i].properties;
|
entityProperties = data.createEntities[i].properties;
|
||||||
var newEntityID = Entities.addEntity(entityProperties);
|
var newEntityID = Entities.addEntity(entityProperties);
|
||||||
recursiveAdd(newEntityID, data.createEntities[i]);
|
recursiveAdd(newEntityID, data.createEntities[i]);
|
||||||
DELETED_ENTITY_MAP[entityID] = newEntityID;
|
DELETED_ENTITY_MAP[entityID] = newEntityID;
|
||||||
|
@ -2261,9 +2261,17 @@ var PropertiesTool = function (opts) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
that.setSpaceMode = function(spaceMode) {
|
||||||
|
emitScriptEvent({
|
||||||
|
type: 'setSpaceMode',
|
||||||
|
spaceMode: spaceMode
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
function updateSelections(selectionUpdated) {
|
function updateSelections(selectionUpdated) {
|
||||||
var data = {
|
var data = {
|
||||||
type: 'update'
|
type: 'update',
|
||||||
|
spaceMode: selectionDisplay.getSpaceMode()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (selectionUpdated) {
|
if (selectionUpdated) {
|
||||||
|
@ -2293,6 +2301,9 @@ var PropertiesTool = function (opts) {
|
||||||
if (entity.properties.rotation !== undefined) {
|
if (entity.properties.rotation !== undefined) {
|
||||||
entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation);
|
entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation);
|
||||||
}
|
}
|
||||||
|
if (entity.properties.localRotation !== undefined) {
|
||||||
|
entity.properties.localRotation = Quat.safeEulerAngles(entity.properties.localRotation);
|
||||||
|
}
|
||||||
if (entity.properties.emitOrientation !== undefined) {
|
if (entity.properties.emitOrientation !== undefined) {
|
||||||
entity.properties.emitOrientation = Quat.safeEulerAngles(entity.properties.emitOrientation);
|
entity.properties.emitOrientation = Quat.safeEulerAngles(entity.properties.emitOrientation);
|
||||||
}
|
}
|
||||||
|
@ -2329,12 +2340,15 @@ var PropertiesTool = function (opts) {
|
||||||
} else if (data.properties) {
|
} else if (data.properties) {
|
||||||
if (data.properties.dynamic === false) {
|
if (data.properties.dynamic === false) {
|
||||||
// this object is leaving dynamic, so we zero its velocities
|
// this object is leaving dynamic, so we zero its velocities
|
||||||
data.properties.velocity = Vec3.ZERO;
|
data.properties.localVelocity = Vec3.ZERO;
|
||||||
data.properties.angularVelocity = Vec3.ZERO;
|
data.properties.localAngularVelocity = Vec3.ZERO;
|
||||||
}
|
}
|
||||||
if (data.properties.rotation !== undefined) {
|
if (data.properties.rotation !== undefined) {
|
||||||
data.properties.rotation = Quat.fromVec3Degrees(data.properties.rotation);
|
data.properties.rotation = Quat.fromVec3Degrees(data.properties.rotation);
|
||||||
}
|
}
|
||||||
|
if (data.properties.localRotation !== undefined) {
|
||||||
|
data.properties.localRotation = Quat.fromVec3Degrees(data.properties.localRotation);
|
||||||
|
}
|
||||||
if (data.properties.emitOrientation !== undefined) {
|
if (data.properties.emitOrientation !== undefined) {
|
||||||
data.properties.emitOrientation = Quat.fromVec3Degrees(data.properties.emitOrientation);
|
data.properties.emitOrientation = Quat.fromVec3Degrees(data.properties.emitOrientation);
|
||||||
}
|
}
|
||||||
|
@ -2583,7 +2597,7 @@ var PopupMenu = function () {
|
||||||
y: event.y
|
y: event.y
|
||||||
});
|
});
|
||||||
if (!pressingOverlay) {
|
if (!pressingOverlay) {
|
||||||
if (hoveringOverlay !== null && hoveringOverlay !== null && overlay !== hoveringOverlay) {
|
if (hoveringOverlay !== null && overlay !== hoveringOverlay) {
|
||||||
Overlays.editOverlay(hoveringOverlay, {
|
Overlays.editOverlay(hoveringOverlay, {
|
||||||
backgroundColor: upColor
|
backgroundColor: upColor
|
||||||
});
|
});
|
||||||
|
@ -2725,4 +2739,10 @@ entityListTool.webView.webEventReceived.connect(function(data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
selectionDisplay.onSpaceModeChange = function(spaceMode) {
|
||||||
|
entityListTool.setSpaceMode(spaceMode);
|
||||||
|
propertiesTool.setSpaceMode(spaceMode);
|
||||||
|
};
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
|
@ -103,7 +103,7 @@ thead {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
background-color: #1c1c1c;
|
background-color: #1c1c1c;
|
||||||
padding: 1px 0px;
|
padding: 1px 0;
|
||||||
border-bottom: 1px solid #575757;
|
border-bottom: 1px solid #575757;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ input::-webkit-input-placeholder {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:focus, textarea:focus {
|
input:focus, textarea:focus, button:focus {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
outline: 1px solid #00b4ef;
|
outline: 1px solid #00b4ef;
|
||||||
|
@ -283,7 +283,7 @@ input[type=number]::-webkit-inner-spin-button {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
height: 90%;
|
height: 90%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-family: hifi-glyphs;
|
font-family: HiFi-Glyphs;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
color: #afafaf;
|
color: #afafaf;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -340,14 +340,14 @@ input.no-spin::-webkit-inner-spin-button {
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button] {
|
input[type=button], button.hifi-edit-button {
|
||||||
font-family: Raleway-Bold;
|
font-family: Raleway-Bold;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
padding: 0px 18px;
|
padding: 0 18px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -357,7 +357,7 @@ input[type=button] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button].glyph {
|
input[type=button].glyph, button.hifi-edit-button.glyph {
|
||||||
font-family: HiFi-Glyphs;
|
font-family: HiFi-Glyphs;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
|
@ -365,58 +365,58 @@ input[type=button].glyph {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button].red {
|
input[type=button].red, button.hifi-edit-button.red {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #94132e;
|
background-color: #94132e;
|
||||||
background: linear-gradient(#d42043 20%, #94132e 100%);
|
background: linear-gradient(#d42043 20%, #94132e 100%);
|
||||||
}
|
}
|
||||||
input[type=button].blue {
|
input[type=button].blue, button.hifi-edit-button.blue {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #1080b8;
|
background-color: #1080b8;
|
||||||
background: linear-gradient(#00b4ef 20%, #1080b8 100%);
|
background: linear-gradient(#00b4ef 20%, #1080b8 100%);
|
||||||
}
|
}
|
||||||
input[type=button].white {
|
input[type=button].white, button.hifi-edit-button.white {
|
||||||
color: #121212;
|
color: #121212;
|
||||||
background-color: #afafaf;
|
background-color: #afafaf;
|
||||||
background: linear-gradient(#fff 20%, #afafaf 100%);
|
background: linear-gradient(#fff 20%, #afafaf 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button]:enabled:hover {
|
input[type=button]:enabled:hover, button.hifi-edit-button:enabled:hover {
|
||||||
background: linear-gradient(#000, #000);
|
background: linear-gradient(#000, #000);
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
input[type=button].red:enabled:hover {
|
input[type=button].red:enabled:hover, button.hifi-edit-button.red:enabled:hover {
|
||||||
background: linear-gradient(#d42043, #d42043);
|
background: linear-gradient(#d42043, #d42043);
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
input[type=button].blue:enabled:hover {
|
input[type=button].blue:enabled:hover, button.hifi-edit-button.blue:enabled:hover {
|
||||||
background: linear-gradient(#00b4ef, #00b4ef);
|
background: linear-gradient(#00b4ef, #00b4ef);
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
input[type=button].white:enabled:hover {
|
input[type=button].white:enabled:hover, button.hifi-edit-button.white:enabled:hover {
|
||||||
background: linear-gradient(#fff, #fff);
|
background: linear-gradient(#fff, #fff);
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button]:active {
|
input[type=button]:active, button.hifi-edit-button:active {
|
||||||
background: linear-gradient(#343434, #343434);
|
background: linear-gradient(#343434, #343434);
|
||||||
}
|
}
|
||||||
input[type=button].red:active {
|
input[type=button].red:active, button.hifi-edit-button.red:active {
|
||||||
background: linear-gradient(#94132e, #94132e);
|
background: linear-gradient(#94132e, #94132e);
|
||||||
}
|
}
|
||||||
input[type=button].blue:active {
|
input[type=button].blue:active, button.hifi-edit-button.blue:active {
|
||||||
background: linear-gradient(#1080b8, #1080b8);
|
background: linear-gradient(#1080b8, #1080b8);
|
||||||
}
|
}
|
||||||
input[type=button].white:active {
|
input[type=button].white:active, button.hifi-edit-button.white:active {
|
||||||
background: linear-gradient(#afafaf, #afafaf);
|
background: linear-gradient(#afafaf, #afafaf);
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button]:disabled {
|
input[type=button]:disabled, button.hifi-edit-button:disabled {
|
||||||
color: #252525;
|
color: #252525;
|
||||||
background: linear-gradient(#575757 20%, #252525 100%);
|
background: linear-gradient(#575757 20%, #252525 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button][pressed=pressed] {
|
input[type=button][pressed=pressed], button.hifi-edit-button[pressed=pressed] {
|
||||||
color: #00b4ef;
|
color: #00b4ef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ input[type=checkbox]:checked + label:hover {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 6px;
|
left: 6px;
|
||||||
top: -2px;
|
top: -2px;
|
||||||
font-family: hifi-glyphs;
|
font-family: HiFi-Glyphs;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
color: #afafaf;
|
color: #afafaf;
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1100,6 @@ body#entity-list-body {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
background-color: #ff0000;
|
background-color: #ff0000;
|
||||||
min-width: 90px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#entity-list {
|
#entity-list {
|
||||||
|
@ -1129,7 +1128,7 @@ body#entity-list-body {
|
||||||
#filter-type-checkboxes span {
|
#filter-type-checkboxes span {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 3px;
|
top: 3px;
|
||||||
font-family: hifi-glyphs;
|
font-family: HiFi-Glyphs;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
padding-left: 6px;
|
padding-left: 6px;
|
||||||
|
@ -1173,7 +1172,7 @@ body#entity-list-body {
|
||||||
|
|
||||||
#filter-in-view {
|
#filter-in-view {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0;
|
||||||
right: 126px;
|
right: 126px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,7 +1452,7 @@ th#entity-hasScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
#properties-base #property-type-icon {
|
#properties-base #property-type-icon {
|
||||||
font-family: hifi-glyphs;
|
font-family: HiFi-Glyphs;
|
||||||
font-size: 31px;
|
font-size: 31px;
|
||||||
color: #00b4ef;
|
color: #00b4ef;
|
||||||
margin: -4px 12px -4px -2px;
|
margin: -4px 12px -4px -2px;
|
||||||
|
@ -1620,3 +1619,21 @@ input.rename-entity {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toggle-space-mode::before {
|
||||||
|
font-family: HiFi-Glyphs;
|
||||||
|
font-size: 20px;
|
||||||
|
text-transform: none;
|
||||||
|
min-width: 32px;
|
||||||
|
padding-right: 4px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#toggle-space-mode.space-mode-local::before {
|
||||||
|
content: "m";
|
||||||
|
}
|
||||||
|
|
||||||
|
#toggle-space-mode.space-mode-world::before {
|
||||||
|
content: "\e02c";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,9 +139,9 @@ input[type=radio]:active + label > span > span{
|
||||||
font-family: Raleway-Bold;
|
font-family: Raleway-Bold;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: black;
|
color: black;
|
||||||
padding: 0px 10px;
|
padding: 0 10px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
border-width: 0px;
|
border-width: 0;
|
||||||
background-image: linear-gradient(#FFFFFF, #AFAFAF);
|
background-image: linear-gradient(#FFFFFF, #AFAFAF);
|
||||||
min-height: 30px;
|
min-height: 30px;
|
||||||
}
|
}
|
||||||
|
@ -158,9 +158,9 @@ input[type=radio]:active + label > span > span{
|
||||||
font-family: Raleway-Bold;
|
font-family: Raleway-Bold;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 0px 10px;
|
padding: 0 10px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
border-width: 0px;
|
border-width: 0;
|
||||||
background-image: linear-gradient(#00B4EF, #1080B8);
|
background-image: linear-gradient(#00B4EF, #1080B8);
|
||||||
min-height: 30px;
|
min-height: 30px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
-->
|
-->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<title>Entity List</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<link rel="stylesheet" type="text/css" href="css/edit-style.css">
|
<link rel="stylesheet" type="text/css" href="css/edit-style.css">
|
||||||
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||||
|
@ -27,7 +28,8 @@
|
||||||
<input type="button" id="visible" class="glyph" value="" />
|
<input type="button" id="visible" class="glyph" value="" />
|
||||||
</div>
|
</div>
|
||||||
<input type="button" id="pal" class="glyph" value="" />
|
<input type="button" id="pal" class="glyph" value="" />
|
||||||
<input type="button" class="red" id="delete" value="Delete" />
|
<button id="toggle-space-mode" class="hifi-edit-button space-mode-local">Local</button>
|
||||||
|
<input type="button" class="red glyph" id="delete" value="{" />
|
||||||
</div>
|
</div>
|
||||||
<div id="entity-list">
|
<div id="entity-list">
|
||||||
<div id="filter-area">
|
<div id="filter-area">
|
||||||
|
|
|
@ -23,7 +23,6 @@ const FILTER_IN_VIEW_ATTRIBUTE = "pressed";
|
||||||
const WINDOW_NONVARIABLE_HEIGHT = 227;
|
const WINDOW_NONVARIABLE_HEIGHT = 227;
|
||||||
const NUM_COLUMNS = 12;
|
const NUM_COLUMNS = 12;
|
||||||
const EMPTY_ENTITY_ID = "0";
|
const EMPTY_ENTITY_ID = "0";
|
||||||
const MAX_LENGTH_RADIUS = 9;
|
|
||||||
const DELETE = 46; // Key code for the delete key.
|
const DELETE = 46; // Key code for the delete key.
|
||||||
const KEY_P = 80; // Key code for letter p used for Parenting hotkey.
|
const KEY_P = 80; // Key code for letter p used for Parenting hotkey.
|
||||||
|
|
||||||
|
@ -85,29 +84,52 @@ const ICON_FOR_TYPE = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// List of all entities
|
// List of all entities
|
||||||
var entities = [];
|
let entities = [];
|
||||||
// List of all entities, indexed by Entity ID
|
// List of all entities, indexed by Entity ID
|
||||||
var entitiesByID = {};
|
let entitiesByID = {};
|
||||||
// The filtered and sorted list of entities passed to ListView
|
// The filtered and sorted list of entities passed to ListView
|
||||||
var visibleEntities = [];
|
let visibleEntities = [];
|
||||||
// List of all entities that are currently selected
|
// List of all entities that are currently selected
|
||||||
var selectedEntities = [];
|
let selectedEntities = [];
|
||||||
|
|
||||||
var entityList = null; // The ListView
|
let entityList = null; // The ListView
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type EntityListContextMenu
|
* @type EntityListContextMenu
|
||||||
*/
|
*/
|
||||||
var entityListContextMenu = null;
|
let entityListContextMenu = null;
|
||||||
|
|
||||||
var currentSortColumn = 'type';
|
let currentSortColumn = 'type';
|
||||||
var currentSortOrder = ASCENDING_SORT;
|
let currentSortOrder = ASCENDING_SORT;
|
||||||
var typeFilters = [];
|
let typeFilters = [];
|
||||||
var isFilterInView = false;
|
let isFilterInView = false;
|
||||||
var showExtraInfo = false;
|
let showExtraInfo = false;
|
||||||
|
|
||||||
|
let elEntityTable,
|
||||||
|
elEntityTableBody,
|
||||||
|
elEntityTableScroll,
|
||||||
|
elEntityTableHeaderRow,
|
||||||
|
elRefresh,
|
||||||
|
elToggleLocked,
|
||||||
|
elToggleVisible,
|
||||||
|
elDelete,
|
||||||
|
elFilterTypeSelectBox,
|
||||||
|
elFilterTypeText,
|
||||||
|
elFilterTypeCheckboxes,
|
||||||
|
elFilterSearch,
|
||||||
|
elFilterInView,
|
||||||
|
elFilterRadius,
|
||||||
|
elExport,
|
||||||
|
elPal,
|
||||||
|
elInfoToggle,
|
||||||
|
elInfoToggleGlyph,
|
||||||
|
elSelectedEntitiesCount,
|
||||||
|
elVisibleEntitiesCount,
|
||||||
|
elNoEntitiesMessage,
|
||||||
|
elToggleSpaceMode;
|
||||||
|
|
||||||
const ENABLE_PROFILING = false;
|
const ENABLE_PROFILING = false;
|
||||||
var profileIndent = '';
|
let profileIndent = '';
|
||||||
const PROFILE_NOOP = function(_name, fn, args) {
|
const PROFILE_NOOP = function(_name, fn, args) {
|
||||||
fn.apply(this, args);
|
fn.apply(this, args);
|
||||||
} ;
|
} ;
|
||||||
|
@ -140,7 +162,7 @@ function loaded() {
|
||||||
elFilterTypeText = document.getElementById("filter-type-text");
|
elFilterTypeText = document.getElementById("filter-type-text");
|
||||||
elFilterTypeCheckboxes = document.getElementById("filter-type-checkboxes");
|
elFilterTypeCheckboxes = document.getElementById("filter-type-checkboxes");
|
||||||
elFilterSearch = document.getElementById("filter-search");
|
elFilterSearch = document.getElementById("filter-search");
|
||||||
elFilterInView = document.getElementById("filter-in-view")
|
elFilterInView = document.getElementById("filter-in-view");
|
||||||
elFilterRadius = document.getElementById("filter-radius");
|
elFilterRadius = document.getElementById("filter-radius");
|
||||||
elExport = document.getElementById("export");
|
elExport = document.getElementById("export");
|
||||||
elPal = document.getElementById("pal");
|
elPal = document.getElementById("pal");
|
||||||
|
@ -149,6 +171,7 @@ function loaded() {
|
||||||
elSelectedEntitiesCount = document.getElementById("selected-entities-count");
|
elSelectedEntitiesCount = document.getElementById("selected-entities-count");
|
||||||
elVisibleEntitiesCount = document.getElementById("visible-entities-count");
|
elVisibleEntitiesCount = document.getElementById("visible-entities-count");
|
||||||
elNoEntitiesMessage = document.getElementById("no-entities");
|
elNoEntitiesMessage = document.getElementById("no-entities");
|
||||||
|
elToggleSpaceMode = document.getElementById('toggle-space-mode');
|
||||||
|
|
||||||
document.body.onclick = onBodyClick;
|
document.body.onclick = onBodyClick;
|
||||||
document.getElementById("entity-name").onclick = function() {
|
document.getElementById("entity-name").onclick = function() {
|
||||||
|
@ -205,6 +228,10 @@ function loaded() {
|
||||||
elDelete.onclick = function() {
|
elDelete.onclick = function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
|
||||||
};
|
};
|
||||||
|
elToggleSpaceMode.onclick = function() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleSpaceMode' }));
|
||||||
|
};
|
||||||
|
|
||||||
elFilterTypeSelectBox.onclick = onToggleTypeDropdown;
|
elFilterTypeSelectBox.onclick = onToggleTypeDropdown;
|
||||||
elFilterSearch.onkeyup = refreshEntityList;
|
elFilterSearch.onkeyup = refreshEntityList;
|
||||||
elFilterSearch.onsearch = refreshEntityList;
|
elFilterSearch.onsearch = refreshEntityList;
|
||||||
|
@ -646,6 +673,8 @@ function loaded() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elToggleSpaceMode.disabled = selectedIDs.length > 1;
|
||||||
|
|
||||||
refreshFooter();
|
refreshFooter();
|
||||||
|
|
||||||
return notFound;
|
return notFound;
|
||||||
|
@ -828,6 +857,16 @@ function loaded() {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSpaceMode(spaceMode) {
|
||||||
|
if (spaceMode === "local") {
|
||||||
|
elToggleSpaceMode.className = "space-mode-local hifi-edit-button";
|
||||||
|
elToggleSpaceMode.innerText = "Local";
|
||||||
|
} else {
|
||||||
|
elToggleSpaceMode.className = "space-mode-world hifi-edit-button";
|
||||||
|
elToggleSpaceMode.innerText = "World";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("keydown", function (keyDownEvent) {
|
document.addEventListener("keydown", function (keyDownEvent) {
|
||||||
if (keyDownEvent.target.nodeName === "INPUT") {
|
if (keyDownEvent.target.nodeName === "INPUT") {
|
||||||
return;
|
return;
|
||||||
|
@ -866,12 +905,15 @@ function loaded() {
|
||||||
updateSelectedEntities(data.selectedIDs, true);
|
updateSelectedEntities(data.selectedIDs, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setSpaceMode(data.spaceMode);
|
||||||
});
|
});
|
||||||
} else if (data.type === "removeEntities" && data.deletedIDs !== undefined && data.selectedIDs !== undefined) {
|
} else if (data.type === "removeEntities" && data.deletedIDs !== undefined && data.selectedIDs !== undefined) {
|
||||||
removeEntities(data.deletedIDs);
|
removeEntities(data.deletedIDs);
|
||||||
updateSelectedEntities(data.selectedIDs, true);
|
updateSelectedEntities(data.selectedIDs, true);
|
||||||
} else if (data.type === "deleted" && data.ids) {
|
} else if (data.type === "deleted" && data.ids) {
|
||||||
removeEntities(data.ids);
|
removeEntities(data.ids);
|
||||||
|
} else if (data.type === "setSpaceMode") {
|
||||||
|
setSpaceMode(data.spaceMode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,12 @@ const DEGREES_TO_RADIANS = Math.PI / 180.0;
|
||||||
|
|
||||||
const NO_SELECTION = "<i>No selection</i>";
|
const NO_SELECTION = "<i>No selection</i>";
|
||||||
|
|
||||||
|
const PROPERTY_SPACE_MODE = {
|
||||||
|
ALL: 0,
|
||||||
|
LOCAL: 1,
|
||||||
|
WORLD: 2
|
||||||
|
};
|
||||||
|
|
||||||
const GROUPS = [
|
const GROUPS = [
|
||||||
{
|
{
|
||||||
id: "base",
|
id: "base",
|
||||||
|
@ -662,7 +668,7 @@ const GROUPS = [
|
||||||
propertyID: "speedSpread",
|
propertyID: "speedSpread",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Emit Dimension",
|
label: "Emit Dimensions",
|
||||||
type: "vec3",
|
type: "vec3",
|
||||||
vec3Type: "xyz",
|
vec3Type: "xyz",
|
||||||
min: 0,
|
min: 0,
|
||||||
|
@ -957,6 +963,17 @@ const GROUPS = [
|
||||||
subLabels: [ "x", "y", "z" ],
|
subLabels: [ "x", "y", "z" ],
|
||||||
unit: "m",
|
unit: "m",
|
||||||
propertyID: "position",
|
propertyID: "position",
|
||||||
|
spaceMode: PROPERTY_SPACE_MODE.WORLD,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Local Position",
|
||||||
|
type: "vec3",
|
||||||
|
vec3Type: "xyz",
|
||||||
|
decimals: 4,
|
||||||
|
subLabels: [ "x", "y", "z" ],
|
||||||
|
unit: "m",
|
||||||
|
propertyID: "localPosition",
|
||||||
|
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Rotation",
|
label: "Rotation",
|
||||||
|
@ -967,9 +984,21 @@ const GROUPS = [
|
||||||
subLabels: [ "pitch", "yaw", "roll" ],
|
subLabels: [ "pitch", "yaw", "roll" ],
|
||||||
unit: "deg",
|
unit: "deg",
|
||||||
propertyID: "rotation",
|
propertyID: "rotation",
|
||||||
|
spaceMode: PROPERTY_SPACE_MODE.WORLD,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Dimension",
|
label: "Local Rotation",
|
||||||
|
type: "vec3",
|
||||||
|
vec3Type: "pyr",
|
||||||
|
step: 0.1,
|
||||||
|
decimals: 4,
|
||||||
|
subLabels: [ "pitch", "yaw", "roll" ],
|
||||||
|
unit: "deg",
|
||||||
|
propertyID: "localRotation",
|
||||||
|
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Dimensions",
|
||||||
type: "vec3",
|
type: "vec3",
|
||||||
vec3Type: "xyz",
|
vec3Type: "xyz",
|
||||||
min: 0,
|
min: 0,
|
||||||
|
@ -978,6 +1007,19 @@ const GROUPS = [
|
||||||
subLabels: [ "x", "y", "z" ],
|
subLabels: [ "x", "y", "z" ],
|
||||||
unit: "m",
|
unit: "m",
|
||||||
propertyID: "dimensions",
|
propertyID: "dimensions",
|
||||||
|
spaceMode: PROPERTY_SPACE_MODE.WORLD,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Local Dimensions",
|
||||||
|
type: "vec3",
|
||||||
|
vec3Type: "xyz",
|
||||||
|
min: 0,
|
||||||
|
step: 0.1,
|
||||||
|
decimals: 4,
|
||||||
|
subLabels: [ "x", "y", "z" ],
|
||||||
|
unit: "m",
|
||||||
|
propertyID: "localDimensions",
|
||||||
|
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Scale",
|
label: "Scale",
|
||||||
|
@ -1174,7 +1216,7 @@ const GROUPS = [
|
||||||
decimals: 4,
|
decimals: 4,
|
||||||
subLabels: [ "x", "y", "z" ],
|
subLabels: [ "x", "y", "z" ],
|
||||||
unit: "m/s",
|
unit: "m/s",
|
||||||
propertyID: "velocity",
|
propertyID: "localVelocity",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Linear Damping",
|
label: "Linear Damping",
|
||||||
|
@ -1190,7 +1232,7 @@ const GROUPS = [
|
||||||
decimals: 4,
|
decimals: 4,
|
||||||
subLabels: [ "pitch", "yaw", "roll" ],
|
subLabels: [ "pitch", "yaw", "roll" ],
|
||||||
unit: "deg/s",
|
unit: "deg/s",
|
||||||
propertyID: "angularVelocity",
|
propertyID: "localAngularVelocity",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Angular Damping",
|
label: "Angular Damping",
|
||||||
|
@ -1317,6 +1359,7 @@ var particlePropertyUpdates = {};
|
||||||
var selectedEntityProperties;
|
var selectedEntityProperties;
|
||||||
var lastEntityID = null;
|
var lastEntityID = null;
|
||||||
var createAppTooltip = new CreateAppTooltip();
|
var createAppTooltip = new CreateAppTooltip();
|
||||||
|
let currentSpaceMode = PROPERTY_SPACE_MODE.LOCAL;
|
||||||
|
|
||||||
function debugPrint(message) {
|
function debugPrint(message) {
|
||||||
EventBridge.emitWebEvent(
|
EventBridge.emitWebEvent(
|
||||||
|
@ -2666,7 +2709,17 @@ function showParentMaterialNameBox(number, elNumber, elString) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateVisibleSpaceModeProperties() {
|
||||||
|
for (let propertyID in properties) {
|
||||||
|
if (properties.hasOwnProperty(propertyID)) {
|
||||||
|
let property = properties[propertyID];
|
||||||
|
let propertySpaceMode = property.spaceMode;
|
||||||
|
if (propertySpaceMode !== PROPERTY_SPACE_MODE.ALL) {
|
||||||
|
showPropertyElement(propertyID, propertySpaceMode === currentSpaceMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function loaded() {
|
function loaded() {
|
||||||
openEventBridge(function() {
|
openEventBridge(function() {
|
||||||
|
@ -2700,6 +2753,7 @@ function loaded() {
|
||||||
let propertyType = propertyData.type;
|
let propertyType = propertyData.type;
|
||||||
let propertyID = propertyData.propertyID;
|
let propertyID = propertyData.propertyID;
|
||||||
let propertyName = propertyData.propertyName !== undefined ? propertyData.propertyName : propertyID;
|
let propertyName = propertyData.propertyName !== undefined ? propertyData.propertyName : propertyID;
|
||||||
|
let propertySpaceMode = propertyData.spaceMode !== undefined ? propertyData.spaceMode : PROPERTY_SPACE_MODE.ALL;
|
||||||
let propertyElementID = "property-" + propertyID;
|
let propertyElementID = "property-" + propertyID;
|
||||||
propertyElementID = propertyElementID.replace('.', '-');
|
propertyElementID = propertyElementID.replace('.', '-');
|
||||||
|
|
||||||
|
@ -2746,7 +2800,8 @@ function loaded() {
|
||||||
elementID: propertyElementID,
|
elementID: propertyElementID,
|
||||||
name: propertyName,
|
name: propertyName,
|
||||||
isParticleProperty: group.id.includes("particles"),
|
isParticleProperty: group.id.includes("particles"),
|
||||||
elProperty: elProperty
|
elProperty,
|
||||||
|
spaceMode: propertySpaceMode,
|
||||||
};
|
};
|
||||||
properties[propertyID] = property;
|
properties[propertyID] = property;
|
||||||
|
|
||||||
|
@ -2841,6 +2896,8 @@ function loaded() {
|
||||||
elGroups[group.id] = elGroup;
|
elGroups[group.id] = elGroup;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateVisibleSpaceModeProperties();
|
||||||
|
|
||||||
if (window.EventBridge !== undefined) {
|
if (window.EventBridge !== undefined) {
|
||||||
EventBridge.scriptEventReceived.connect(function(data) {
|
EventBridge.scriptEventReceived.connect(function(data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
@ -2860,6 +2917,9 @@ function loaded() {
|
||||||
elServerScriptStatus.innerText = NOT_RUNNING_SCRIPT_STATUS;
|
elServerScriptStatus.innerText = NOT_RUNNING_SCRIPT_STATUS;
|
||||||
}
|
}
|
||||||
} else if (data.type === "update" && data.selections) {
|
} else if (data.type === "update" && data.selections) {
|
||||||
|
if (data.spaceMode !== undefined) {
|
||||||
|
currentSpaceMode = data.spaceMode === "local" ? PROPERTY_SPACE_MODE.LOCAL : PROPERTY_SPACE_MODE.WORLD;
|
||||||
|
}
|
||||||
if (data.selections.length === 0) {
|
if (data.selections.length === 0) {
|
||||||
if (lastEntityID !== null) {
|
if (lastEntityID !== null) {
|
||||||
if (editor !== null) {
|
if (editor !== null) {
|
||||||
|
@ -3083,6 +3143,8 @@ function loaded() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateVisibleSpaceModeProperties();
|
||||||
|
|
||||||
if (selectedEntityProperties.type === "Image") {
|
if (selectedEntityProperties.type === "Image") {
|
||||||
let imageLink = JSON.parse(selectedEntityProperties.textures)["tex.picture"];
|
let imageLink = JSON.parse(selectedEntityProperties.textures)["tex.picture"];
|
||||||
getPropertyInputElement("image").value = imageLink;
|
getPropertyInputElement("image").value = imageLink;
|
||||||
|
@ -3167,6 +3229,9 @@ function loaded() {
|
||||||
createAppTooltip.setTooltipData(data.tooltips);
|
createAppTooltip.setTooltipData(data.tooltips);
|
||||||
} else if (data.type === 'hmdActiveChanged') {
|
} else if (data.type === 'hmdActiveChanged') {
|
||||||
createAppTooltip.setIsEnabled(!data.hmdActive);
|
createAppTooltip.setIsEnabled(!data.hmdActive);
|
||||||
|
} else if (data.type === 'setSpaceMode') {
|
||||||
|
currentSpaceMode = data.spaceMode === "local" ? PROPERTY_SPACE_MODE.LOCAL : PROPERTY_SPACE_MODE.WORLD;
|
||||||
|
updateVisibleSpaceModeProperties();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,13 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
that.setSpaceMode = function(spaceMode) {
|
||||||
|
emitJSONScriptEvent({
|
||||||
|
type: 'setSpaceMode',
|
||||||
|
spaceMode: spaceMode
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
that.clearEntityList = function() {
|
that.clearEntityList = function() {
|
||||||
emitJSONScriptEvent({
|
emitJSONScriptEvent({
|
||||||
type: 'clearEntityList'
|
type: 'clearEntityList'
|
||||||
|
@ -200,6 +207,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
||||||
type: "update",
|
type: "update",
|
||||||
entities: entities,
|
entities: entities,
|
||||||
selectedIDs: selectedIDs,
|
selectedIDs: selectedIDs,
|
||||||
|
spaceMode: SelectionDisplay.getSpaceMode(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -288,6 +296,8 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
||||||
Entities.editEntity(data.entityID, {name: data.name});
|
Entities.editEntity(data.entityID, {name: data.name});
|
||||||
// make sure that the name also gets updated in the properties window
|
// make sure that the name also gets updated in the properties window
|
||||||
SelectionManager._update();
|
SelectionManager._update();
|
||||||
|
} else if (data.type === "toggleSpaceMode") {
|
||||||
|
SelectionDisplay.toggleSpaceMode();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ SelectionManager = (function() {
|
||||||
var actionArguments = Entities.getActionArguments(properties.id, actionID);
|
var actionArguments = Entities.getActionArguments(properties.id, actionID);
|
||||||
if (actionArguments) {
|
if (actionArguments) {
|
||||||
var type = actionArguments.type;
|
var type = actionArguments.type;
|
||||||
if (type == 'hold' || type == 'far-grab') {
|
if (type === 'hold' || type === 'far-grab') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
delete actionArguments.ttl;
|
delete actionArguments.ttl;
|
||||||
|
@ -500,7 +500,7 @@ SelectionManager = (function() {
|
||||||
that.entityType = properties.type;
|
that.entityType = properties.type;
|
||||||
|
|
||||||
if (selectionUpdated) {
|
if (selectionUpdated) {
|
||||||
SelectionDisplay.setSpaceMode(SPACE_LOCAL);
|
SelectionDisplay.useDesiredSpaceMode();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
properties = Entities.getEntityProperties(that.selections[0], ['type', 'boundingBox']);
|
properties = Entities.getEntityProperties(that.selections[0], ['type', 'boundingBox']);
|
||||||
|
@ -537,7 +537,7 @@ SelectionManager = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// For 1+ selections we can only modify selections in world space
|
// For 1+ selections we can only modify selections in world space
|
||||||
SelectionDisplay.setSpaceMode(SPACE_WORLD);
|
SelectionDisplay.setSpaceMode(SPACE_WORLD, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < listeners.length; j++) {
|
for (var j = 0; j < listeners.length; j++) {
|
||||||
|
@ -633,24 +633,26 @@ SelectionDisplay = (function() {
|
||||||
ALL: 3
|
ALL: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
const SCALE_DIRECTION = {
|
|
||||||
LBN: 0,
|
|
||||||
RBN: 1,
|
|
||||||
LBF: 2,
|
|
||||||
RBF: 3,
|
|
||||||
LTN: 4,
|
|
||||||
RTN: 5,
|
|
||||||
LTF: 6,
|
|
||||||
RTF: 7
|
|
||||||
};
|
|
||||||
|
|
||||||
const ROTATE_DIRECTION = {
|
const ROTATE_DIRECTION = {
|
||||||
PITCH: 0,
|
PITCH: 0,
|
||||||
YAW: 1,
|
YAW: 1,
|
||||||
ROLL: 2
|
ROLL: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current space mode, this could have been a forced space mode since we do not support multi selection while in
|
||||||
|
* local space mode.
|
||||||
|
* @type {string} - should only be set to SPACE_LOCAL or SPACE_WORLD
|
||||||
|
*/
|
||||||
var spaceMode = SPACE_LOCAL;
|
var spaceMode = SPACE_LOCAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The desired space mode, this is the user set space mode, which should be respected whenever it is possible. In the case
|
||||||
|
* of multi entity selection this space mode may differ from the actual spaceMode.
|
||||||
|
* @type {string} - should only be set to SPACE_LOCAL or SPACE_WORLD
|
||||||
|
*/
|
||||||
|
var desiredSpaceMode = SPACE_LOCAL;
|
||||||
|
|
||||||
var overlayNames = [];
|
var overlayNames = [];
|
||||||
var lastControllerPoses = [
|
var lastControllerPoses = [
|
||||||
getControllerWorldLocation(Controller.Standard.LeftHand, true),
|
getControllerWorldLocation(Controller.Standard.LeftHand, true),
|
||||||
|
@ -1340,7 +1342,7 @@ SelectionDisplay = (function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function controllerComputePickRay(hand) {
|
function controllerComputePickRay() {
|
||||||
var hand = that.triggered() ? that.triggeredHand : that.pressedHand;
|
var hand = that.triggered() ? that.triggeredHand : that.pressedHand;
|
||||||
var controllerPose = getControllerWorldLocation(hand, true);
|
var controllerPose = getControllerWorldLocation(hand, true);
|
||||||
if (controllerPose.valid) {
|
if (controllerPose.valid) {
|
||||||
|
@ -1400,8 +1402,21 @@ SelectionDisplay = (function() {
|
||||||
that.updateHandles();
|
that.updateHandles();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This callback is used for spaceMode changes.
|
||||||
|
* @callback spaceModeChangedCallback
|
||||||
|
* @param {string} spaceMode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set this property with a callback to keep track of spaceMode changes.
|
||||||
|
* @type {spaceModeChangedCallback}
|
||||||
|
*/
|
||||||
|
that.onSpaceModeChange = null;
|
||||||
|
|
||||||
// FUNCTION: SET SPACE MODE
|
// FUNCTION: SET SPACE MODE
|
||||||
that.setSpaceMode = function(newSpaceMode) {
|
that.setSpaceMode = function(newSpaceMode, isDesiredChange) {
|
||||||
var wantDebug = false;
|
var wantDebug = false;
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("======> SetSpaceMode called. ========");
|
print("======> SetSpaceMode called. ========");
|
||||||
|
@ -1411,7 +1426,15 @@ SelectionDisplay = (function() {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print(" Updating SpaceMode From: " + spaceMode + " To: " + newSpaceMode);
|
print(" Updating SpaceMode From: " + spaceMode + " To: " + newSpaceMode);
|
||||||
}
|
}
|
||||||
|
if (isDesiredChange) {
|
||||||
|
desiredSpaceMode = newSpaceMode;
|
||||||
|
}
|
||||||
spaceMode = newSpaceMode;
|
spaceMode = newSpaceMode;
|
||||||
|
|
||||||
|
if (that.onSpaceModeChange !== null) {
|
||||||
|
that.onSpaceModeChange(newSpaceMode);
|
||||||
|
}
|
||||||
|
|
||||||
that.updateHandles();
|
that.updateHandles();
|
||||||
} else if (wantDebug) {
|
} else if (wantDebug) {
|
||||||
print("WARNING: entitySelectionTool.setSpaceMode - Can't update SpaceMode. CurrentMode: " +
|
print("WARNING: entitySelectionTool.setSpaceMode - Can't update SpaceMode. CurrentMode: " +
|
||||||
|
@ -1437,14 +1460,36 @@ SelectionDisplay = (function() {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("PreToggle: " + spaceMode);
|
print("PreToggle: " + spaceMode);
|
||||||
}
|
}
|
||||||
spaceMode = (spaceMode === SPACE_LOCAL) ? SPACE_WORLD : SPACE_LOCAL;
|
that.setSpaceMode((spaceMode === SPACE_LOCAL) ? SPACE_WORLD : SPACE_LOCAL, true);
|
||||||
that.updateHandles();
|
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("PostToggle: " + spaceMode);
|
print("PostToggle: " + spaceMode);
|
||||||
print("======== ToggleSpaceMode called. <=========");
|
print("======== ToggleSpaceMode called. <=========");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switches the display mode back to the set desired display mode
|
||||||
|
*/
|
||||||
|
that.useDesiredSpaceMode = function() {
|
||||||
|
var wantDebug = false;
|
||||||
|
if (wantDebug) {
|
||||||
|
print("========> UseDesiredSpaceMode called. =========");
|
||||||
|
}
|
||||||
|
that.setSpaceMode(desiredSpaceMode, false);
|
||||||
|
if (wantDebug) {
|
||||||
|
print("PostToggle: " + spaceMode);
|
||||||
|
print("======== UseDesiredSpaceMode called. <=========");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the currently set SpaceMode
|
||||||
|
* @returns {string} spaceMode
|
||||||
|
*/
|
||||||
|
that.getSpaceMode = function() {
|
||||||
|
return spaceMode;
|
||||||
|
};
|
||||||
|
|
||||||
function addHandleTool(overlay, tool) {
|
function addHandleTool(overlay, tool) {
|
||||||
handleTools[overlay] = tool;
|
handleTools[overlay] = tool;
|
||||||
return tool;
|
return tool;
|
||||||
|
@ -1787,7 +1832,7 @@ SelectionDisplay = (function() {
|
||||||
!isActiveTool(handleRotateYawRing) &&
|
!isActiveTool(handleRotateYawRing) &&
|
||||||
!isActiveTool(handleRotateRollRing)));
|
!isActiveTool(handleRotateRollRing)));
|
||||||
|
|
||||||
// keep duplicator always hidden for now since you can hold Alt to duplciate while
|
// keep duplicator always hidden for now since you can hold Alt to duplicate while
|
||||||
// translating an entity - we may bring duplicator back for HMD only later
|
// translating an entity - we may bring duplicator back for HMD only later
|
||||||
// that.setHandleDuplicatorVisible(!activeTool || isActiveTool(handleDuplicator));
|
// that.setHandleDuplicatorVisible(!activeTool || isActiveTool(handleDuplicator));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue