mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 06:53:46 +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() {
|
||||
print("unparenting2 Selected Entities");
|
||||
if (SelectionManager.hasSelection()) {
|
||||
var selectedEntities = selectionManager.selections;
|
||||
selectedEntities.forEach(function (id, index) {
|
||||
|
@ -1128,7 +1127,6 @@ function unparentSelectedEntities() {
|
|||
|
||||
}
|
||||
function parentSelectedEntities() {
|
||||
print("parenting selected Entities");
|
||||
if (SelectionManager.hasSelection()) {
|
||||
var selectedEntities = selectionManager.selections;
|
||||
if (selectedEntities.length <= 1) {
|
||||
|
@ -1137,16 +1135,12 @@ function parentSelectedEntities() {
|
|||
}
|
||||
var lastEntityId = selectedEntities[selectedEntities.length-1];
|
||||
|
||||
print("last " + lastEntityId);
|
||||
selectedEntities.forEach(function (id, index) {
|
||||
if (lastEntityId !== id) {
|
||||
print("iterating2 " + id);
|
||||
|
||||
// OK time to check why this breaks!
|
||||
Entities.editEntity(id, {parentID: lastEntityId})
|
||||
}
|
||||
});
|
||||
|
||||
Window.notify("Entities Parented");
|
||||
} else {
|
||||
Window.notifyEditError("You have nothing selected")
|
||||
|
@ -1384,7 +1378,7 @@ Controller.keyReleaseEvent.connect(function (event) {
|
|||
grid.setPosition(newPosition);
|
||||
}
|
||||
} else if (event.text === 'p' && event.isControl ) {
|
||||
if (event.isShifted) {
|
||||
if (event.isAlt) {
|
||||
unparentSelectedEntities();
|
||||
} else {
|
||||
parentSelectedEntities();
|
||||
|
|
|
@ -1170,14 +1170,14 @@ SelectionDisplay = (function() {
|
|||
// determine which bottom corner we are closest to
|
||||
/*------------------------------
|
||||
example:
|
||||
|
||||
|
||||
BRF +--------+ BLF
|
||||
| |
|
||||
| |
|
||||
BRN +--------+ BLN
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
------------------------------*/
|
||||
|
||||
var cameraPosition = Camera.getPosition();
|
||||
|
@ -2189,8 +2189,12 @@ SelectionDisplay = (function() {
|
|||
offset = Vec3.multiplyQbyV(properties.rotation, 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], {
|
||||
position: boxPosition,
|
||||
color: color,
|
||||
rotation: properties.rotation,
|
||||
dimensions: properties.dimensions,
|
||||
visible: true,
|
||||
|
@ -2395,7 +2399,7 @@ SelectionDisplay = (function() {
|
|||
if (wantDebug) {
|
||||
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)) {
|
||||
if (wantDebug) {
|
||||
print("too close to horizon!");
|
||||
|
@ -3857,7 +3861,7 @@ SelectionDisplay = (function() {
|
|||
};
|
||||
|
||||
that.mousePressEvent = function(event) {
|
||||
var wantDebug = false;
|
||||
var wantDebug = false;
|
||||
if (!event.isLeftButton && !that.triggered) {
|
||||
// if another mouse button than left is pressed ignore it
|
||||
return false;
|
||||
|
@ -3883,7 +3887,7 @@ SelectionDisplay = (function() {
|
|||
|
||||
if (result.intersects) {
|
||||
|
||||
|
||||
|
||||
if (wantDebug) {
|
||||
print("something intersects... ");
|
||||
print(" result.overlayID:" + result.overlayID + "[" + overlayNames[result.overlayID] + "]");
|
||||
|
@ -3983,7 +3987,7 @@ SelectionDisplay = (function() {
|
|||
if (wantDebug) {
|
||||
print("rotate handle case...");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// After testing our stretch handles, then check out rotate handles
|
||||
Overlays.editOverlay(yawHandle, {
|
||||
|
@ -4205,7 +4209,7 @@ SelectionDisplay = (function() {
|
|||
case selectionBox:
|
||||
activeTool = translateXZTool;
|
||||
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);
|
||||
if (wantDebug) {
|
||||
print("longest dimension: " + translateXZTool.greatestDimension);
|
||||
|
@ -4214,7 +4218,7 @@ SelectionDisplay = (function() {
|
|||
translateXZTool.startingElevation = translateXZTool.elevation(pickRay.origin, translateXZTool.pickPlanePosition);
|
||||
print(" starting elevation: " + translateXZTool.startingElevation);
|
||||
}
|
||||
|
||||
|
||||
mode = translateXZTool.mode;
|
||||
activeTool.onBegin(event);
|
||||
somethingClicked = 'selectionBox';
|
||||
|
|
Loading…
Reference in a new issue