mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 21:26:25 +02:00
Updated edit.js and selection tool
Last selected entity will now be yellow instead of orange
This commit is contained in:
parent
ff2c344eaa
commit
d96f95a7e9
2 changed files with 14 additions and 16 deletions
|
@ -1115,7 +1115,6 @@ function recursiveDelete(entities, childrenList) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function unparentSelectedEntities() {
|
function unparentSelectedEntities() {
|
||||||
print("unparenting2 Selected Entities");
|
|
||||||
if (SelectionManager.hasSelection()) {
|
if (SelectionManager.hasSelection()) {
|
||||||
var selectedEntities = selectionManager.selections;
|
var selectedEntities = selectionManager.selections;
|
||||||
selectedEntities.forEach(function (id, index) {
|
selectedEntities.forEach(function (id, index) {
|
||||||
|
@ -1128,7 +1127,6 @@ function unparentSelectedEntities() {
|
||||||
|
|
||||||
}
|
}
|
||||||
function parentSelectedEntities() {
|
function parentSelectedEntities() {
|
||||||
print("parenting selected Entities");
|
|
||||||
if (SelectionManager.hasSelection()) {
|
if (SelectionManager.hasSelection()) {
|
||||||
var selectedEntities = selectionManager.selections;
|
var selectedEntities = selectionManager.selections;
|
||||||
if (selectedEntities.length <= 1) {
|
if (selectedEntities.length <= 1) {
|
||||||
|
@ -1137,16 +1135,12 @@ function parentSelectedEntities() {
|
||||||
}
|
}
|
||||||
var lastEntityId = selectedEntities[selectedEntities.length-1];
|
var lastEntityId = selectedEntities[selectedEntities.length-1];
|
||||||
|
|
||||||
print("last " + lastEntityId);
|
|
||||||
selectedEntities.forEach(function (id, index) {
|
selectedEntities.forEach(function (id, index) {
|
||||||
if (lastEntityId !== id) {
|
if (lastEntityId !== id) {
|
||||||
print("iterating2 " + id);
|
|
||||||
|
|
||||||
// OK time to check why this breaks!
|
// OK time to check why this breaks!
|
||||||
Entities.editEntity(id, {parentID: lastEntityId})
|
Entities.editEntity(id, {parentID: lastEntityId})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Window.notify("Entities Parented");
|
Window.notify("Entities Parented");
|
||||||
} else {
|
} else {
|
||||||
Window.notifyEditError("You have nothing selected")
|
Window.notifyEditError("You have nothing selected")
|
||||||
|
@ -1384,7 +1378,7 @@ Controller.keyReleaseEvent.connect(function (event) {
|
||||||
grid.setPosition(newPosition);
|
grid.setPosition(newPosition);
|
||||||
}
|
}
|
||||||
} else if (event.text === 'p' && event.isControl ) {
|
} else if (event.text === 'p' && event.isControl ) {
|
||||||
if (event.isShifted) {
|
if (event.isAlt) {
|
||||||
unparentSelectedEntities();
|
unparentSelectedEntities();
|
||||||
} else {
|
} else {
|
||||||
parentSelectedEntities();
|
parentSelectedEntities();
|
||||||
|
|
|
@ -1170,14 +1170,14 @@ SelectionDisplay = (function() {
|
||||||
// determine which bottom corner we are closest to
|
// determine which bottom corner we are closest to
|
||||||
/*------------------------------
|
/*------------------------------
|
||||||
example:
|
example:
|
||||||
|
|
||||||
BRF +--------+ BLF
|
BRF +--------+ BLF
|
||||||
| |
|
| |
|
||||||
| |
|
| |
|
||||||
BRN +--------+ BLN
|
BRN +--------+ BLN
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
------------------------------*/
|
------------------------------*/
|
||||||
|
|
||||||
var cameraPosition = Camera.getPosition();
|
var cameraPosition = Camera.getPosition();
|
||||||
|
@ -2189,8 +2189,12 @@ SelectionDisplay = (function() {
|
||||||
offset = Vec3.multiplyQbyV(properties.rotation, offset);
|
offset = Vec3.multiplyQbyV(properties.rotation, offset);
|
||||||
var boxPosition = Vec3.sum(properties.position, offset);
|
var boxPosition = Vec3.sum(properties.position, offset);
|
||||||
|
|
||||||
|
var color = {red: 255, green: 153, blue: 0};
|
||||||
|
if (i >= selectionManager.selections.length - 1) color = {red: 255, green: 255, blue: 0};
|
||||||
|
|
||||||
Overlays.editOverlay(selectionBoxes[i], {
|
Overlays.editOverlay(selectionBoxes[i], {
|
||||||
position: boxPosition,
|
position: boxPosition,
|
||||||
|
color: color,
|
||||||
rotation: properties.rotation,
|
rotation: properties.rotation,
|
||||||
dimensions: properties.dimensions,
|
dimensions: properties.dimensions,
|
||||||
visible: true,
|
visible: true,
|
||||||
|
@ -2395,7 +2399,7 @@ SelectionDisplay = (function() {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("Start Elevation: " + translateXZTool.startingElevation + ", elevation: " + elevation);
|
print("Start Elevation: " + translateXZTool.startingElevation + ", elevation: " + elevation);
|
||||||
}
|
}
|
||||||
if ((translateXZTool.startingElevation > 0.0 && elevation < MIN_ELEVATION) ||
|
if ((translateXZTool.startingElevation > 0.0 && elevation < MIN_ELEVATION) ||
|
||||||
(translateXZTool.startingElevation < 0.0 && elevation > -MIN_ELEVATION)) {
|
(translateXZTool.startingElevation < 0.0 && elevation > -MIN_ELEVATION)) {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("too close to horizon!");
|
print("too close to horizon!");
|
||||||
|
@ -3857,7 +3861,7 @@ SelectionDisplay = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.mousePressEvent = function(event) {
|
that.mousePressEvent = function(event) {
|
||||||
var wantDebug = false;
|
var wantDebug = false;
|
||||||
if (!event.isLeftButton && !that.triggered) {
|
if (!event.isLeftButton && !that.triggered) {
|
||||||
// if another mouse button than left is pressed ignore it
|
// if another mouse button than left is pressed ignore it
|
||||||
return false;
|
return false;
|
||||||
|
@ -3883,7 +3887,7 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
if (result.intersects) {
|
if (result.intersects) {
|
||||||
|
|
||||||
|
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("something intersects... ");
|
print("something intersects... ");
|
||||||
print(" result.overlayID:" + result.overlayID + "[" + overlayNames[result.overlayID] + "]");
|
print(" result.overlayID:" + result.overlayID + "[" + overlayNames[result.overlayID] + "]");
|
||||||
|
@ -3983,7 +3987,7 @@ SelectionDisplay = (function() {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("rotate handle case...");
|
print("rotate handle case...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// After testing our stretch handles, then check out rotate handles
|
// After testing our stretch handles, then check out rotate handles
|
||||||
Overlays.editOverlay(yawHandle, {
|
Overlays.editOverlay(yawHandle, {
|
||||||
|
@ -4205,7 +4209,7 @@ SelectionDisplay = (function() {
|
||||||
case selectionBox:
|
case selectionBox:
|
||||||
activeTool = translateXZTool;
|
activeTool = translateXZTool;
|
||||||
translateXZTool.pickPlanePosition = result.intersection;
|
translateXZTool.pickPlanePosition = result.intersection;
|
||||||
translateXZTool.greatestDimension = Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y),
|
translateXZTool.greatestDimension = Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y),
|
||||||
SelectionManager.worldDimensions.z);
|
SelectionManager.worldDimensions.z);
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("longest dimension: " + translateXZTool.greatestDimension);
|
print("longest dimension: " + translateXZTool.greatestDimension);
|
||||||
|
@ -4214,7 +4218,7 @@ SelectionDisplay = (function() {
|
||||||
translateXZTool.startingElevation = translateXZTool.elevation(pickRay.origin, translateXZTool.pickPlanePosition);
|
translateXZTool.startingElevation = translateXZTool.elevation(pickRay.origin, translateXZTool.pickPlanePosition);
|
||||||
print(" starting elevation: " + translateXZTool.startingElevation);
|
print(" starting elevation: " + translateXZTool.startingElevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = translateXZTool.mode;
|
mode = translateXZTool.mode;
|
||||||
activeTool.onBegin(event);
|
activeTool.onBegin(event);
|
||||||
somethingClicked = 'selectionBox';
|
somethingClicked = 'selectionBox';
|
||||||
|
|
Loading…
Reference in a new issue