mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:16:16 +02:00
make it so near grabbing while edit is active doesn't select a new entity
This commit is contained in:
parent
fead52f626
commit
44aa3e044b
3 changed files with 139 additions and 94 deletions
|
@ -2,6 +2,7 @@ import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.0
|
import QtQuick.Controls 1.0
|
||||||
import QtWebEngine 1.1
|
import QtWebEngine 1.1
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
import "../../controls"
|
import "../../controls"
|
||||||
import HFWebEngineProfile 1.0
|
import HFWebEngineProfile 1.0
|
||||||
|
|
||||||
|
@ -28,10 +29,11 @@ StackView {
|
||||||
id: editBasePage
|
id: editBasePage
|
||||||
TabView {
|
TabView {
|
||||||
id: editTabView
|
id: editTabView
|
||||||
anchors.fill: parent
|
// anchors.fill: parent
|
||||||
|
height: 60
|
||||||
|
|
||||||
Tab {
|
Tab {
|
||||||
title: "Create Entities"
|
title: "Create"
|
||||||
active: true
|
active: true
|
||||||
enabled: true
|
enabled: true
|
||||||
property string originalUrl: ""
|
property string originalUrl: ""
|
||||||
|
@ -133,7 +135,7 @@ StackView {
|
||||||
}
|
}
|
||||||
|
|
||||||
Tab {
|
Tab {
|
||||||
title: "Entity List"
|
title: "List"
|
||||||
active: true
|
active: true
|
||||||
enabled: true
|
enabled: true
|
||||||
property string originalUrl: ""
|
property string originalUrl: ""
|
||||||
|
@ -148,7 +150,7 @@ StackView {
|
||||||
}
|
}
|
||||||
|
|
||||||
Tab {
|
Tab {
|
||||||
title: "Entity Properties"
|
title: "Properties"
|
||||||
active: true
|
active: true
|
||||||
enabled: true
|
enabled: true
|
||||||
property string originalUrl: ""
|
property string originalUrl: ""
|
||||||
|
@ -178,7 +180,7 @@ StackView {
|
||||||
}
|
}
|
||||||
|
|
||||||
Tab {
|
Tab {
|
||||||
title: "Particle Explorer"
|
title: "Particles"
|
||||||
active: true
|
active: true
|
||||||
enabled: true
|
enabled: true
|
||||||
property string originalUrl: ""
|
property string originalUrl: ""
|
||||||
|
@ -191,6 +193,23 @@ StackView {
|
||||||
enabled: true
|
enabled: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
style: TabViewStyle {
|
||||||
|
frameOverlap: 1
|
||||||
|
tab: Rectangle {
|
||||||
|
color: styleData.selected ? "slategrey" :"grey"
|
||||||
|
implicitWidth: text.width + 25
|
||||||
|
implicitHeight: 60
|
||||||
|
radius: 2
|
||||||
|
Text {
|
||||||
|
id: text
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: styleData.title
|
||||||
|
color: styleData.selected ? "white" : "white"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
/* global getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
|
/* global getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
|
||||||
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset, setGrabCommunications,
|
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset,
|
||||||
Menu, HMD */
|
setGrabCommunications, Menu, HMD, isInEditMode */
|
||||||
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
@ -1667,6 +1667,15 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rayPickInfo.entityID) {
|
if (rayPickInfo.entityID) {
|
||||||
|
if (this.triggerSmoothedGrab() && isInEditMode()) {
|
||||||
|
this.searchIndicatorOn(rayPickInfo.searchRay);
|
||||||
|
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||||
|
method: "selectEntity",
|
||||||
|
entityID: rayPickInfo.entityID
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
entity = rayPickInfo.entityID;
|
entity = rayPickInfo.entityID;
|
||||||
name = entityPropertiesCache.getProps(entity).name;
|
name = entityPropertiesCache.getProps(entity).name;
|
||||||
if (this.entityWantsTrigger(entity)) {
|
if (this.entityWantsTrigger(entity)) {
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/* global HIFI_PUBLIC_BUCKET, SPACE_LOCAL, Script, SelectionManager */
|
||||||
|
|
||||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
|
||||||
SPACE_LOCAL = "local";
|
SPACE_LOCAL = "local";
|
||||||
|
@ -28,7 +30,7 @@ SelectionManager = (function() {
|
||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
function subscribeToUpdateMessages() {
|
function subscribeToUpdateMessages() {
|
||||||
Messages.subscribe('entityToolUpdates');
|
Messages.subscribe("entityToolUpdates");
|
||||||
Messages.messageReceived.connect(handleEntitySelectionToolUpdates);
|
Messages.messageReceived.connect(handleEntitySelectionToolUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +42,20 @@ SelectionManager = (function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message === 'callUpdate') {
|
var messageParsed;
|
||||||
that._update();
|
try {
|
||||||
|
messageParsed = JSON.parse(message);
|
||||||
|
} catch (err) {
|
||||||
|
print("error -- entitySelectionTool got malformed message: " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (message === 'callUpdate') {
|
||||||
|
// that._update();
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (messageParsed.method === "selectEntity") {
|
||||||
|
print("setting selection to " + messageParsed.entityID);
|
||||||
|
that.setSelections([messageParsed.entityID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,13 +163,14 @@ SelectionManager = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
that._update = function(selectionUpdated) {
|
that._update = function(selectionUpdated) {
|
||||||
if (that.selections.length == 0) {
|
var properties = null;
|
||||||
|
if (that.selections.length === 0) {
|
||||||
that.localDimensions = null;
|
that.localDimensions = null;
|
||||||
that.localPosition = null;
|
that.localPosition = null;
|
||||||
that.worldDimensions = null;
|
that.worldDimensions = null;
|
||||||
that.worldPosition = null;
|
that.worldPosition = null;
|
||||||
} else if (that.selections.length == 1) {
|
} else if (that.selections.length == 1) {
|
||||||
var properties = Entities.getEntityProperties(that.selections[0]);
|
properties = Entities.getEntityProperties(that.selections[0]);
|
||||||
that.localDimensions = properties.dimensions;
|
that.localDimensions = properties.dimensions;
|
||||||
that.localPosition = properties.position;
|
that.localPosition = properties.position;
|
||||||
that.localRotation = properties.rotation;
|
that.localRotation = properties.rotation;
|
||||||
|
@ -170,7 +185,7 @@ SelectionManager = (function() {
|
||||||
that.localDimensions = null;
|
that.localDimensions = null;
|
||||||
that.localPosition = null;
|
that.localPosition = null;
|
||||||
|
|
||||||
var properties = Entities.getEntityProperties(that.selections[0]);
|
properties = Entities.getEntityProperties(that.selections[0]);
|
||||||
|
|
||||||
var brn = properties.boundingBox.brn;
|
var brn = properties.boundingBox.brn;
|
||||||
var tfl = properties.boundingBox.tfl;
|
var tfl = properties.boundingBox.tfl;
|
||||||
|
@ -203,9 +218,9 @@ SelectionManager = (function() {
|
||||||
SelectionDisplay.setSpaceMode(SPACE_WORLD);
|
SelectionDisplay.setSpaceMode(SPACE_WORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < listeners.length; i++) {
|
for (var j = 0; j < listeners.length; j++) {
|
||||||
try {
|
try {
|
||||||
listeners[i](selectionUpdated === true);
|
listeners[j](selectionUpdated === true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("EntitySelectionTool got exception: " + JSON.stringify(e));
|
print("EntitySelectionTool got exception: " + JSON.stringify(e));
|
||||||
}
|
}
|
||||||
|
@ -229,8 +244,8 @@ function getRelativeCenterPosition(dimensions, registrationPoint) {
|
||||||
return {
|
return {
|
||||||
x: -dimensions.x * (registrationPoint.x - 0.5),
|
x: -dimensions.x * (registrationPoint.x - 0.5),
|
||||||
y: -dimensions.y * (registrationPoint.y - 0.5),
|
y: -dimensions.y * (registrationPoint.y - 0.5),
|
||||||
z: -dimensions.z * (registrationPoint.z - 0.5),
|
z: -dimensions.z * (registrationPoint.z - 0.5)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionDisplay = (function() {
|
SelectionDisplay = (function() {
|
||||||
|
@ -253,7 +268,7 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
var spaceMode = SPACE_LOCAL;
|
var spaceMode = SPACE_LOCAL;
|
||||||
var mode = "UNKNOWN";
|
var mode = "UNKNOWN";
|
||||||
var overlayNames = new Array();
|
var overlayNames = [];
|
||||||
var lastCameraPosition = Camera.getPosition();
|
var lastCameraPosition = Camera.getPosition();
|
||||||
var lastCameraOrientation = Camera.getOrientation();
|
var lastCameraOrientation = Camera.getOrientation();
|
||||||
|
|
||||||
|
@ -679,8 +694,7 @@ SelectionDisplay = (function() {
|
||||||
green: 0,
|
green: 0,
|
||||||
blue: 0
|
blue: 0
|
||||||
},
|
},
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true // always ignore this
|
||||||
visible: false,
|
|
||||||
});
|
});
|
||||||
var yRailOverlay = Overlays.addOverlay("line3d", {
|
var yRailOverlay = Overlays.addOverlay("line3d", {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
@ -700,8 +714,7 @@ SelectionDisplay = (function() {
|
||||||
green: 255,
|
green: 255,
|
||||||
blue: 0
|
blue: 0
|
||||||
},
|
},
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true // always ignore this
|
||||||
visible: false,
|
|
||||||
});
|
});
|
||||||
var zRailOverlay = Overlays.addOverlay("line3d", {
|
var zRailOverlay = Overlays.addOverlay("line3d", {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
@ -721,8 +734,7 @@ SelectionDisplay = (function() {
|
||||||
green: 0,
|
green: 0,
|
||||||
blue: 255
|
blue: 255
|
||||||
},
|
},
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true // always ignore this
|
||||||
visible: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var rotateZeroOverlay = Overlays.addOverlay("line3d", {
|
var rotateZeroOverlay = Overlays.addOverlay("line3d", {
|
||||||
|
@ -1016,44 +1028,46 @@ SelectionDisplay = (function() {
|
||||||
that.TRIGGER_OFF_VALUE = 0.15;
|
that.TRIGGER_OFF_VALUE = 0.15;
|
||||||
that.triggered = false;
|
that.triggered = false;
|
||||||
var activeHand = Controller.Standard.RightHand;
|
var activeHand = Controller.Standard.RightHand;
|
||||||
function makeTriggerHandler(hand) {
|
// function makeTriggerHandler(hand) {
|
||||||
return function (value) {
|
// return function (value) {
|
||||||
if (!that.triggered && (value > that.TRIGGER_GRAB_VALUE)) { // should we smooth?
|
// if (!that.triggered && (value > that.TRIGGER_GRAB_VALUE)) { // should we smooth?
|
||||||
that.triggered = true;
|
// that.triggered = true;
|
||||||
if (activeHand !== hand) {
|
// if (activeHand !== hand) {
|
||||||
// No switching while the other is already triggered, so no need to release.
|
// // No switching while the other is already triggered, so no need to release.
|
||||||
activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
// activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
||||||
}
|
// }
|
||||||
if (Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(Reticle.position)) {
|
// if (Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(Reticle.position)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
var eventResult = that.mousePressEvent({});
|
// var eventResult = that.mousePressEvent({});
|
||||||
if (!eventResult || (eventResult === 'selectionBox')) {
|
// if (!eventResult || (eventResult === 'selectionBox')) {
|
||||||
var pickRay = controllerComputePickRay();
|
// var pickRay = controllerComputePickRay();
|
||||||
if (pickRay) {
|
// if (pickRay) {
|
||||||
var entityIntersection = Entities.findRayIntersection(pickRay, true);
|
// var entityIntersection = Entities.findRayIntersection(pickRay, true);
|
||||||
|
|
||||||
|
|
||||||
var overlayIntersection = Overlays.findRayIntersection(pickRay);
|
// var overlayIntersection = Overlays.findRayIntersection(pickRay);
|
||||||
if (entityIntersection.intersects &&
|
// if (entityIntersection.intersects &&
|
||||||
(!overlayIntersection.intersects || (entityIntersection.distance < overlayIntersection.distance))) {
|
// (!overlayIntersection.intersects || (entityIntersection.distance < overlayIntersection.distance))) {
|
||||||
|
|
||||||
|
// if (HMD.tabletID === entityIntersection.entityID) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// selectionManager.setSelections([entityIntersection.entityID]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) {
|
||||||
|
// that.triggered = false;
|
||||||
|
// that.mouseReleaseEvent({});
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// that.triggerMapping.from(Controller.Standard.RT).peek().to(makeTriggerHandler(Controller.Standard.RightHand));
|
||||||
|
// that.triggerMapping.from(Controller.Standard.LT).peek().to(makeTriggerHandler(Controller.Standard.LeftHand));
|
||||||
|
|
||||||
if (HMD.tabletID === entityIntersection.entityID) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectionManager.setSelections([entityIntersection.entityID]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) {
|
|
||||||
that.triggered = false;
|
|
||||||
that.mouseReleaseEvent({});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
that.triggerMapping.from(Controller.Standard.RT).peek().to(makeTriggerHandler(Controller.Standard.RightHand));
|
|
||||||
that.triggerMapping.from(Controller.Standard.LT).peek().to(makeTriggerHandler(Controller.Standard.LeftHand));
|
|
||||||
function controllerComputePickRay() {
|
function controllerComputePickRay() {
|
||||||
var controllerPose = getControllerWorldLocation(activeHand, true);
|
var controllerPose = getControllerWorldLocation(activeHand, true);
|
||||||
if (controllerPose.valid && that.triggered) {
|
if (controllerPose.valid && that.triggered) {
|
||||||
|
@ -1072,7 +1086,7 @@ SelectionDisplay = (function() {
|
||||||
onBegin: tool.onBegin,
|
onBegin: tool.onBegin,
|
||||||
onMove: tool.onMove,
|
onMove: tool.onMove,
|
||||||
onEnd: tool.onEnd,
|
onEnd: tool.onEnd,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1080,8 +1094,8 @@ SelectionDisplay = (function() {
|
||||||
for (var i = 0; i < allOverlays.length; i++) {
|
for (var i = 0; i < allOverlays.length; i++) {
|
||||||
Overlays.deleteOverlay(allOverlays[i]);
|
Overlays.deleteOverlay(allOverlays[i]);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < selectionBoxes.length; i++) {
|
for (var j = 0; j < selectionBoxes.length; j++) {
|
||||||
Overlays.deleteOverlay(selectionBoxes[i]);
|
Overlays.deleteOverlay(selectionBoxes[j]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1125,7 +1139,7 @@ SelectionDisplay = (function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
that.updateHandles();
|
that.updateHandles();
|
||||||
}
|
};
|
||||||
|
|
||||||
that.updateRotationHandles = function() {
|
that.updateRotationHandles = function() {
|
||||||
var diagonal = (Vec3.length(selectionManager.worldDimensions) / 2) * 1.1;
|
var diagonal = (Vec3.length(selectionManager.worldDimensions) / 2) * 1.1;
|
||||||
|
@ -1572,7 +1586,7 @@ SelectionDisplay = (function() {
|
||||||
that.unselectAll = function() {};
|
that.unselectAll = function() {};
|
||||||
|
|
||||||
that.updateHandles = function() {
|
that.updateHandles = function() {
|
||||||
if (SelectionManager.selections.length == 0) {
|
if (SelectionManager.selections.length === 0) {
|
||||||
that.setOverlaysVisible(false);
|
that.setOverlaysVisible(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1608,7 +1622,8 @@ SelectionDisplay = (function() {
|
||||||
var bottom = -registrationPointDimensions.y;
|
var bottom = -registrationPointDimensions.y;
|
||||||
var top = dimensions.y - registrationPointDimensions.y;
|
var top = dimensions.y - registrationPointDimensions.y;
|
||||||
var near = -registrationPointDimensions.z;
|
var near = -registrationPointDimensions.z;
|
||||||
var front = far = dimensions.z - registrationPointDimensions.z;
|
var far = dimensions.z - registrationPointDimensions.z;
|
||||||
|
var front = far;
|
||||||
|
|
||||||
var worldTop = SelectionManager.worldDimensions.y / 2;
|
var worldTop = SelectionManager.worldDimensions.y / 2;
|
||||||
|
|
||||||
|
@ -1808,9 +1823,9 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
if (selectionManager.selections.length == 1) {
|
if (selectionManager.selections.length == 1) {
|
||||||
var properties = Entities.getEntityProperties(selectionManager.selections[0]);
|
var properties = Entities.getEntityProperties(selectionManager.selections[0]);
|
||||||
if (properties.type == "Light" && properties.isSpotlight == true) {
|
if (properties.type == "Light" && properties.isSpotlight === true) {
|
||||||
var stretchHandlesVisible = false;
|
stretchHandlesVisible = false;
|
||||||
var extendedStretchHandlesVisible = false;
|
extendedStretchHandlesVisible = false;
|
||||||
|
|
||||||
Overlays.editOverlay(grabberSpotLightCenter, {
|
Overlays.editOverlay(grabberSpotLightCenter, {
|
||||||
position: position,
|
position: position,
|
||||||
|
@ -1903,9 +1918,9 @@ SelectionDisplay = (function() {
|
||||||
Overlays.editOverlay(grabberPointLightN, {
|
Overlays.editOverlay(grabberPointLightN, {
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
} else if (properties.type == "Light" && properties.isSpotlight == false) {
|
} else if (properties.type == "Light" && properties.isSpotlight === false) {
|
||||||
var stretchHandlesVisible = false;
|
stretchHandlesVisible = false;
|
||||||
var extendedStretchHandlesVisible = false;
|
extendedStretchHandlesVisible = false;
|
||||||
Overlays.editOverlay(grabberPointLightT, {
|
Overlays.editOverlay(grabberPointLightT, {
|
||||||
position: TOP,
|
position: TOP,
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
|
@ -2171,28 +2186,28 @@ SelectionDisplay = (function() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var i = 0;
|
i = 0;
|
||||||
// Only show individual selections boxes if there is more than 1 selection
|
// Only show individual selections boxes if there is more than 1 selection
|
||||||
if (selectionManager.selections.length > 1) {
|
if (selectionManager.selections.length > 1) {
|
||||||
for (; i < selectionManager.selections.length; i++) {
|
for (; i < selectionManager.selections.length; i++) {
|
||||||
var properties = Entities.getEntityProperties(selectionManager.selections[i]);
|
var props = Entities.getEntityProperties(selectionManager.selections[i]);
|
||||||
|
|
||||||
// Adjust overlay position to take registrationPoint into account
|
// Adjust overlay position to take registrationPoint into account
|
||||||
// centeredRP = registrationPoint with range [-0.5, 0.5]
|
// centeredRP = registrationPoint with range [-0.5, 0.5]
|
||||||
var centeredRP = Vec3.subtract(properties.registrationPoint, {
|
var centeredRP = Vec3.subtract(props.registrationPoint, {
|
||||||
x: 0.5,
|
x: 0.5,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 0.5
|
z: 0.5
|
||||||
});
|
});
|
||||||
var offset = vec3Mult(properties.dimensions, centeredRP);
|
var offset = vec3Mult(props.dimensions, centeredRP);
|
||||||
offset = Vec3.multiply(-1, offset);
|
offset = Vec3.multiply(-1, offset);
|
||||||
offset = Vec3.multiplyQbyV(properties.rotation, offset);
|
offset = Vec3.multiplyQbyV(props.rotation, offset);
|
||||||
var boxPosition = Vec3.sum(properties.position, offset);
|
var boxPosition = Vec3.sum(props.position, offset);
|
||||||
|
|
||||||
Overlays.editOverlay(selectionBoxes[i], {
|
Overlays.editOverlay(selectionBoxes[i], {
|
||||||
position: boxPosition,
|
position: boxPosition,
|
||||||
rotation: properties.rotation,
|
rotation: props.rotation,
|
||||||
dimensions: properties.dimensions,
|
dimensions: props.dimensions,
|
||||||
visible: true,
|
visible: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2584,11 +2599,11 @@ SelectionDisplay = (function() {
|
||||||
y: v1.y * v2.y,
|
y: v1.y * v2.y,
|
||||||
z: v1.z * v2.z
|
z: v1.z * v2.z
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
// stretchMode - name of mode
|
// stretchMode - name of mode
|
||||||
// direction - direction to stretch in
|
// direction - direction to stretch in
|
||||||
// pivot - point to use as a pivot
|
// pivot - point to use as a pivot
|
||||||
// offset - the position of the overlay tool relative to the selections center position
|
// offset - the position of the overlay tool relative to the selections center position
|
||||||
var makeStretchTool = function(stretchMode, direction, pivot, offset, customOnMove) {
|
var makeStretchTool = function(stretchMode, direction, pivot, offset, customOnMove) {
|
||||||
var signs = {
|
var signs = {
|
||||||
x: direction.x < 0 ? -1 : (direction.x > 0 ? 1 : 0),
|
x: direction.x < 0 ? -1 : (direction.x > 0 ? 1 : 0),
|
||||||
|
@ -2640,7 +2655,7 @@ SelectionDisplay = (function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Scale pivot to be in the same range as registrationPoint
|
// Scale pivot to be in the same range as registrationPoint
|
||||||
var scaledPivot = Vec3.multiply(0.5, pivot)
|
var scaledPivot = Vec3.multiply(0.5, pivot);
|
||||||
deltaPivot = Vec3.subtract(centeredRP, scaledPivot);
|
deltaPivot = Vec3.subtract(centeredRP, scaledPivot);
|
||||||
|
|
||||||
var scaledOffset = Vec3.multiply(0.5, offset);
|
var scaledOffset = Vec3.multiply(0.5, offset);
|
||||||
|
@ -2652,14 +2667,16 @@ SelectionDisplay = (function() {
|
||||||
var scaledOffsetWorld = vec3Mult(initialDimensions, offsetRP);
|
var scaledOffsetWorld = vec3Mult(initialDimensions, offsetRP);
|
||||||
pickRayPosition = Vec3.sum(initialPosition, Vec3.multiplyQbyV(rotation, scaledOffsetWorld));
|
pickRayPosition = Vec3.sum(initialPosition, Vec3.multiplyQbyV(rotation, scaledOffsetWorld));
|
||||||
|
|
||||||
|
var start = null;
|
||||||
|
var end = null;
|
||||||
if (numDimensions == 1 && mask.x) {
|
if (numDimensions == 1 && mask.x) {
|
||||||
var start = Vec3.multiplyQbyV(rotation, {
|
start = Vec3.multiplyQbyV(rotation, {
|
||||||
x: -10000,
|
x: -10000,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: 0
|
z: 0
|
||||||
});
|
});
|
||||||
start = Vec3.sum(start, properties.position);
|
start = Vec3.sum(start, properties.position);
|
||||||
var end = Vec3.multiplyQbyV(rotation, {
|
end = Vec3.multiplyQbyV(rotation, {
|
||||||
x: 10000,
|
x: 10000,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: 0
|
z: 0
|
||||||
|
@ -2672,13 +2689,13 @@ SelectionDisplay = (function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (numDimensions == 1 && mask.y) {
|
if (numDimensions == 1 && mask.y) {
|
||||||
var start = Vec3.multiplyQbyV(rotation, {
|
start = Vec3.multiplyQbyV(rotation, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -10000,
|
y: -10000,
|
||||||
z: 0
|
z: 0
|
||||||
});
|
});
|
||||||
start = Vec3.sum(start, properties.position);
|
start = Vec3.sum(start, properties.position);
|
||||||
var end = Vec3.multiplyQbyV(rotation, {
|
end = Vec3.multiplyQbyV(rotation, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 10000,
|
y: 10000,
|
||||||
z: 0
|
z: 0
|
||||||
|
@ -2691,13 +2708,13 @@ SelectionDisplay = (function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (numDimensions == 1 && mask.z) {
|
if (numDimensions == 1 && mask.z) {
|
||||||
var start = Vec3.multiplyQbyV(rotation, {
|
start = Vec3.multiplyQbyV(rotation, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: -10000
|
z: -10000
|
||||||
});
|
});
|
||||||
start = Vec3.sum(start, properties.position);
|
start = Vec3.sum(start, properties.position);
|
||||||
var end = Vec3.multiplyQbyV(rotation, {
|
end = Vec3.multiplyQbyV(rotation, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: 10000
|
z: 10000
|
||||||
|
@ -2730,13 +2747,13 @@ SelectionDisplay = (function() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (numDimensions == 2) {
|
} else if (numDimensions == 2) {
|
||||||
if (mask.x == 0) {
|
if (mask.x === 0) {
|
||||||
planeNormal = {
|
planeNormal = {
|
||||||
x: 1,
|
x: 1,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: 0
|
z: 0
|
||||||
};
|
};
|
||||||
} else if (mask.y == 0) {
|
} else if (mask.y === 0) {
|
||||||
planeNormal = {
|
planeNormal = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 1,
|
y: 1,
|
||||||
|
@ -2894,7 +2911,7 @@ SelectionDisplay = (function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
SelectionManager._update();
|
SelectionManager._update();
|
||||||
};
|
}
|
||||||
|
|
||||||
function radiusStretchFunc(vector, change) {
|
function radiusStretchFunc(vector, change) {
|
||||||
var props = selectionManager.savedProperties[selectionManager.selections[0]];
|
var props = selectionManager.savedProperties[selectionManager.selections[0]];
|
||||||
|
@ -4413,7 +4430,7 @@ SelectionDisplay = (function() {
|
||||||
scale: handleSize / 1.25,
|
scale: handleSize / 1.25,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
Script.update.connect(that.updateHandleSizes);
|
Script.update.connect(that.updateHandleSizes);
|
||||||
|
|
||||||
that.mouseReleaseEvent = function(event) {
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
|
Loading…
Reference in a new issue