mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
fix multi-selection rotation yay!
This commit is contained in:
parent
55f55cd78b
commit
900669d937
2 changed files with 12 additions and 21 deletions
|
@ -1518,6 +1518,8 @@ AABox EntityItem::getAABox(bool& success) const {
|
||||||
} else {
|
} else {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
if (_cachedAABox.getCorner().x > -85.0f || _cachedAABox.getCorner().x < -86.0f)
|
||||||
|
qDebug() << "_cachedAABox corner " << _cachedAABox.getCorner().x << " " << _cachedAABox.getCorner().y << " " << _cachedAABox.getCorner().z;
|
||||||
return _cachedAABox;
|
return _cachedAABox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,6 +240,7 @@ SelectionDisplay = (function() {
|
||||||
var COLOR_BLUE = { red:0, green:147, blue:197 };
|
var COLOR_BLUE = { red:0, green:147, blue:197 };
|
||||||
var COLOR_RED = { red:183, green:10, blue:55 };
|
var COLOR_RED = { red:183, green:10, blue:55 };
|
||||||
var COLOR_HOVER = { red:227, green:227, blue:227 };
|
var COLOR_HOVER = { red:227, green:227, blue:227 };
|
||||||
|
var COLOR_ROTATE_CURRENT_RING = { red: 255, green: 99, blue: 9 };
|
||||||
var COLOR_SCALE_EDGE = { red:87, green:87, blue:87 };
|
var COLOR_SCALE_EDGE = { red:87, green:87, blue:87 };
|
||||||
var COLOR_SCALE_CUBE = { red:106, green:106, blue:106 };
|
var COLOR_SCALE_CUBE = { red:106, green:106, blue:106 };
|
||||||
var COLOR_SCALE_CUBE_SELECTED = { red:18, green:18, blue:18 };
|
var COLOR_SCALE_CUBE_SELECTED = { red:18, green:18, blue:18 };
|
||||||
|
@ -254,7 +255,7 @@ SelectionDisplay = (function() {
|
||||||
var ROTATE_CTRL_SNAP_ANGLE = 22.5;
|
var ROTATE_CTRL_SNAP_ANGLE = 22.5;
|
||||||
var ROTATE_DEFAULT_SNAP_ANGLE = 1;
|
var ROTATE_DEFAULT_SNAP_ANGLE = 1;
|
||||||
var ROTATE_DEFAULT_TICK_MARKS_ANGLE = 5;
|
var ROTATE_DEFAULT_TICK_MARKS_ANGLE = 5;
|
||||||
var ROTATE_RING_IDLE_INNER_RADIUS = 0.97;
|
var ROTATE_RING_IDLE_INNER_RADIUS = 0.95;
|
||||||
var ROTATE_RING_SELECTED_INNER_RADIUS = 0.9;
|
var ROTATE_RING_SELECTED_INNER_RADIUS = 0.9;
|
||||||
|
|
||||||
// These are multipliers for sizing the rotation degrees display while rotating an entity
|
// These are multipliers for sizing the rotation degrees display while rotating an entity
|
||||||
|
@ -384,7 +385,7 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
var handleRotateCurrentRing = Overlays.addOverlay("circle3d", {
|
var handleRotateCurrentRing = Overlays.addOverlay("circle3d", {
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
color: { red: 255, green: 99, blue: 9 },
|
color: COLOR_ROTATE_CURRENT_RING,
|
||||||
solid: true,
|
solid: true,
|
||||||
innerRadius: 0.9,
|
innerRadius: 0.9,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
@ -2122,14 +2123,14 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
// FUNCTION DEF: updateSelectionsRotation
|
// FUNCTION DEF: updateSelectionsRotation
|
||||||
// Helper func used by rotation handle tools
|
// Helper func used by rotation handle tools
|
||||||
function updateSelectionsRotation(rotationChange) {
|
function updateSelectionsRotation(rotationChange, initialPosition) {
|
||||||
if (!rotationChange) {
|
if (!rotationChange) {
|
||||||
print("ERROR: entitySelectionTool.updateSelectionsRotation - Invalid arg specified!!");
|
print("ERROR: entitySelectionTool.updateSelectionsRotation - Invalid arg specified!!");
|
||||||
|
|
||||||
// EARLY EXIT
|
// EARLY EXIT
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entities should only reposition if we are rotating multiple selections around
|
// Entities should only reposition if we are rotating multiple selections around
|
||||||
// the selections center point. Otherwise, the rotation will be around the entities
|
// the selections center point. Otherwise, the rotation will be around the entities
|
||||||
// registration point which does not need repositioning.
|
// registration point which does not need repositioning.
|
||||||
|
@ -2142,18 +2143,10 @@ SelectionDisplay = (function() {
|
||||||
rotation: Quat.multiply(rotationChange, initialProperties.rotation)
|
rotation: Quat.multiply(rotationChange, initialProperties.rotation)
|
||||||
};
|
};
|
||||||
|
|
||||||
Quat.print("OldRotation ", initialProperties.rotation);
|
|
||||||
Quat.print("NewRotation ", newProperties.rotation);
|
|
||||||
|
|
||||||
if (reposition) {
|
if (reposition) {
|
||||||
var dPos = Vec3.subtract(initialProperties.position, SelectionManager.worldPosition);
|
var dPos = Vec3.subtract(initialProperties.position, initialPosition);
|
||||||
Vec3.print("SelectionManager.worldPosition ", SelectionManager.worldPosition);
|
|
||||||
Vec3.print("initialProperties.position ", initialProperties.position);
|
|
||||||
Vec3.print("dPos 1 ", dPos);
|
|
||||||
dPos = Vec3.multiplyQbyV(rotationChange, dPos);
|
dPos = Vec3.multiplyQbyV(rotationChange, dPos);
|
||||||
Vec3.print("dPos 2 ", dPos);
|
newProperties.position = Vec3.sum(initialPosition, dPos);
|
||||||
newProperties.position = Vec3.sum(SelectionManager.worldPosition, dPos);
|
|
||||||
Vec3.print("newProperties.position ", newProperties.position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Entities.editEntity(entityID, newProperties);
|
Entities.editEntity(entityID, newProperties);
|
||||||
|
@ -2260,7 +2253,7 @@ SelectionDisplay = (function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var wantDebug = true;
|
var wantDebug = false;
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("================== "+ getMode() + "(addHandleRotateTool onMove) -> =======================");
|
print("================== "+ getMode() + "(addHandleRotateTool onMove) -> =======================");
|
||||||
Vec3.print(" rotationZero: ", rotationZero);
|
Vec3.print(" rotationZero: ", rotationZero);
|
||||||
|
@ -2286,12 +2279,8 @@ SelectionDisplay = (function() {
|
||||||
var angleFromZero = Vec3.orientedAngle(centerToZero, centerToIntersect, rotationNormal);
|
var angleFromZero = Vec3.orientedAngle(centerToZero, centerToIntersect, rotationNormal);
|
||||||
var snapAngle = ctrlPressed ? ROTATE_CTRL_SNAP_ANGLE : ROTATE_DEFAULT_SNAP_ANGLE;
|
var snapAngle = ctrlPressed ? ROTATE_CTRL_SNAP_ANGLE : ROTATE_DEFAULT_SNAP_ANGLE;
|
||||||
angleFromZero = Math.floor(angleFromZero / snapAngle) * snapAngle;
|
angleFromZero = Math.floor(angleFromZero / snapAngle) * snapAngle;
|
||||||
var rotChange = Quat.angleAxis(angleFromZero, rotationNormal);
|
var rotationChange = Quat.angleAxis(angleFromZero, rotationNormal);
|
||||||
if (wantDebug) {
|
updateSelectionsRotation(rotationChange, rotationCenter);
|
||||||
Quat.print(" rotChange: ", rotChange)
|
|
||||||
print(" angleFromZero: ", angleFromZero);
|
|
||||||
}
|
|
||||||
updateSelectionsRotation(rotChange);
|
|
||||||
updateRotationDegreesOverlay(-angleFromZero, rotationDegreesPosition);
|
updateRotationDegreesOverlay(-angleFromZero, rotationDegreesPosition);
|
||||||
|
|
||||||
var startAtCurrent = 0;
|
var startAtCurrent = 0;
|
||||||
|
|
Loading…
Reference in a new issue