Merge pull request #3733 from huffman/inspect-tool-fixes

Inspect tool fixes
This commit is contained in:
Brad Hefta-Gaub 2014-11-04 10:13:59 -08:00
commit 37d95b7f82
2 changed files with 20 additions and 10 deletions

View file

@ -339,7 +339,6 @@ CameraManager = function() {
// Last mode that was first or third person // Last mode that was first or third person
var lastAvatarCameraMode = "first person"; var lastAvatarCameraMode = "first person";
Camera.modeUpdated.connect(function(newMode) { Camera.modeUpdated.connect(function(newMode) {
print("Camera mode has been updated: " + newMode);
if (newMode == "first person" || newMode == "third person") { if (newMode == "first person" || newMode == "third person") {
lastAvatarCameraMode = newMode; lastAvatarCameraMode = newMode;
that.disable(true); that.disable(true);

View file

@ -51,8 +51,11 @@ var wantEntityGlow = false;
var SPAWN_DISTANCE = 1; var SPAWN_DISTANCE = 1;
var DEFAULT_DIMENSION = 0.20; var DEFAULT_DIMENSION = 0.20;
var MENU_INSPECT_TOOL_ENABLED = 'Inspect Tool'; var MENU_INSPECT_TOOL_ENABLED = "Inspect Tool";
var MENU_EASE_ON_FOCUS = 'Ease Orientation on Focus'; var MENU_EASE_ON_FOCUS = "Ease Orientation on Focus";
var SETTING_INSPECT_TOOL_ENABLED = "inspectToolEnabled";
var SETTING_EASE_ON_FOCUS = "cameraEaseOnFocus";
var modelURLs = [ var modelURLs = [
HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX", HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
@ -497,10 +500,14 @@ function mousePressEvent(event) {
} }
} else if (Menu.isOptionChecked(MENU_INSPECT_TOOL_ENABLED)) { } else if (Menu.isOptionChecked(MENU_INSPECT_TOOL_ENABLED)) {
var result = findClickedEntity(event); var result = findClickedEntity(event);
if (result !== null && event.isRightButton) { if (event.isRightButton) {
var currentProperties = Entities.getEntityProperties(result.entityID); if (result !== null) {
cameraManager.enable(); var currentProperties = Entities.getEntityProperties(result.entityID);
cameraManager.focus(currentProperties.position, null, Menu.isOptionChecked(MENU_EASE_ON_FOCUS)); cameraManager.enable();
cameraManager.focus(currentProperties.position, null, Menu.isOptionChecked(MENU_EASE_ON_FOCUS));
cameraManager.mousePressEvent(event);
}
} else {
cameraManager.mousePressEvent(event); cameraManager.mousePressEvent(event);
} }
} }
@ -590,8 +597,10 @@ function setupModelMenus() {
Menu.addMenuItem({ menuName: "File", menuItemName: "Import Models", shortcutKey: "CTRL+META+I", afterItem: "Export Models" }); Menu.addMenuItem({ menuName: "File", menuItemName: "Import Models", shortcutKey: "CTRL+META+I", afterItem: "Export Models" });
Menu.addMenuItem({ menuName: "Developer", menuItemName: "Debug Ryans Rotation Problems", isCheckable: true }); Menu.addMenuItem({ menuName: "Developer", menuItemName: "Debug Ryans Rotation Problems", isCheckable: true });
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_INSPECT_TOOL_ENABLED, afterItem: "Edit Entities Help...", isCheckable: true }); Menu.addMenuItem({ menuName: "View", menuItemName: MENU_INSPECT_TOOL_ENABLED, afterItem: "Edit Entities Help...",
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_EASE_ON_FOCUS, afterItem: MENU_INSPECT_TOOL_ENABLED, isCheckable: true }); isCheckable: true, isChecked: Settings.getValue(SETTING_INSPECT_TOOL_ENABLED) == "true" });
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_EASE_ON_FOCUS, afterItem: MENU_INSPECT_TOOL_ENABLED,
isCheckable: true, isChecked: Settings.getValue(SETTING_EASE_ON_FOCUS) == "true" });
} }
setupModelMenus(); // do this when first running our script. setupModelMenus(); // do this when first running our script.
@ -619,6 +628,9 @@ function cleanupModelMenus() {
} }
Script.scriptEnding.connect(function() { Script.scriptEnding.connect(function() {
Settings.setValue(SETTING_INSPECT_TOOL_ENABLED, Menu.isOptionChecked(MENU_INSPECT_TOOL_ENABLED));
Settings.setValue(SETTING_EASE_ON_FOCUS, Menu.isOptionChecked(MENU_EASE_ON_FOCUS));
progressDialog.cleanup(); progressDialog.cleanup();
toolBar.cleanup(); toolBar.cleanup();
cleanupModelMenus(); cleanupModelMenus();
@ -820,7 +832,6 @@ function applyEntityProperties(data) {
var properties = data.createEntities[i].properties; var properties = data.createEntities[i].properties;
var newEntityID = Entities.addEntity(properties); var newEntityID = Entities.addEntity(properties);
DELETED_ENTITY_MAP[entityID.id] = newEntityID; DELETED_ENTITY_MAP[entityID.id] = newEntityID;
print(newEntityID.isKnownID);
if (data.selectCreated) { if (data.selectCreated) {
selectedEntityIDs.push(newEntityID); selectedEntityIDs.push(newEntityID);
} }