Update entity edit tools

Move editing functions into "tool" objects which contain onBegin,
onMove, and onEnd functions.
Add multi-selection
Add local and world editing modes
Fix XZ tool
This commit is contained in:
Ryan Huffman 2014-10-21 12:13:12 -07:00
parent 2a4092f287
commit d5c7c60553
3 changed files with 1267 additions and 1530 deletions

View file

@ -97,11 +97,12 @@ EntityCameraTool = function() {
that.focus = function(entityProperties) {
var dim = entityProperties.dimensions;
dim = SelectionManager.worldDimensions;
var size = Math.max(dim.x, Math.max(dim.y, dim.z));
that.targetZoomDistance = Math.max(size * FOCUS_ZOOM_SCALE, FOCUS_MIN_ZOOM);
that.setFocalPoint(entityProperties.position);
that.setFocalPoint(SelectionManager.worldPosition);//entityProperties.position);
that.updateCamera();
}
@ -184,7 +185,7 @@ EntityCameraTool = function() {
// Scale based on current zoom level
dZoom *= that.targetZoomDistance * ZOOM_SCALING;
that.targetZoomDistance = Math.max(Math.min(that.targetZoomDistance + dZoom, MAX_ZOOM_DISTANCE), MIN_ZOOM_DISTANCE);
that.targetZoomDistance = Math.max(that.targetZoomDistance + dZoom, MIN_ZOOM_DISTANCE);
that.updateCamera();
}

File diff suppressed because it is too large Load diff

View file

@ -21,6 +21,7 @@ Script.include("libraries/progressDialog.js");
Script.include("libraries/entitySelectionTool.js");
var selectionDisplay = SelectionDisplay;
var selectionManager = SelectionManager;
Script.include("libraries/ModelImporter.js");
var modelImporter = new ModelImporter();
@ -34,6 +35,8 @@ var entityPropertyDialogBox = EntityPropertyDialogBox;
Script.include("libraries/entityCameraTool.js");
var entityCameraTool = new EntityCameraTool();
selectionManager.setEventListener(selectionDisplay.updateHandles());
var windowDimensions = Controller.getViewportDimensions();
var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/";
var toolHeight = 50;
@ -440,6 +443,11 @@ function mousePressEvent(event) {
orientation = MyAvatar.orientation;
intersection = rayPlaneIntersection(pickRay, P, Quat.getFront(orientation));
if (!event.isShifted) {
selectionManager.clearSelections();
}
selectionManager.addEntity(foundEntity);
print("Model selected selectedEntityID:" + selectedEntityID.id);
}
@ -641,11 +649,16 @@ Menu.menuItemEvent.connect(handeMenuEvent);
Controller.keyReleaseEvent.connect(function (event) {
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
print(event.text);
if (event.text == "`") {
handeMenuEvent("Edit Properties...");
}
if (event.text == "BACKSPACE") {
handeMenuEvent("Delete");
} else if (event.text == "TAB") {
selectionDisplay.toggleSpaceMode();
} else if (event.text == "ESC") {
selectionDisplay.cancelTool();
} else if (event.text == "f") {
if (entitySelected) {
// Get latest properties