mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Move edit.js to new toolbar API
This commit is contained in:
parent
fdcbf71623
commit
1adf96c8df
1 changed files with 132 additions and 307 deletions
|
@ -16,7 +16,6 @@ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
Script.include([
|
Script.include([
|
||||||
"libraries/stringHelpers.js",
|
"libraries/stringHelpers.js",
|
||||||
"libraries/dataViewHelpers.js",
|
"libraries/dataViewHelpers.js",
|
||||||
"libraries/toolBars.js",
|
|
||||||
"libraries/progressDialog.js",
|
"libraries/progressDialog.js",
|
||||||
|
|
||||||
"libraries/entitySelectionTool.js",
|
"libraries/entitySelectionTool.js",
|
||||||
|
@ -50,11 +49,6 @@ selectionManager.addEventListener(function() {
|
||||||
lightOverlayManager.updatePositions();
|
lightOverlayManager.updatePositions();
|
||||||
});
|
});
|
||||||
|
|
||||||
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
|
||||||
var toolHeight = 50;
|
|
||||||
var toolWidth = 50;
|
|
||||||
var TOOLBAR_MARGIN_Y = 0;
|
|
||||||
|
|
||||||
var DEGREES_TO_RADIANS = Math.PI / 180.0;
|
var DEGREES_TO_RADIANS = Math.PI / 180.0;
|
||||||
var RADIANS_TO_DEGREES = 180.0 / Math.PI;
|
var RADIANS_TO_DEGREES = 180.0 / Math.PI;
|
||||||
var epsilon = 0.001;
|
var epsilon = 0.001;
|
||||||
|
@ -104,6 +98,7 @@ IMPORTING_SVO_OVERLAY_WIDTH = 144;
|
||||||
IMPORTING_SVO_OVERLAY_HEIGHT = 30;
|
IMPORTING_SVO_OVERLAY_HEIGHT = 30;
|
||||||
IMPORTING_SVO_OVERLAY_MARGIN = 5;
|
IMPORTING_SVO_OVERLAY_MARGIN = 5;
|
||||||
IMPORTING_SVO_OVERLAY_LEFT_MARGIN = 34;
|
IMPORTING_SVO_OVERLAY_LEFT_MARGIN = 34;
|
||||||
|
|
||||||
var importingSVOImageOverlay = Overlays.addOverlay("image", {
|
var importingSVOImageOverlay = Overlays.addOverlay("image", {
|
||||||
imageURL: Script.resolvePath("assets") + "/images/hourglass.svg",
|
imageURL: Script.resolvePath("assets") + "/images/hourglass.svg",
|
||||||
width: 20,
|
width: 20,
|
||||||
|
@ -168,241 +163,19 @@ function toggleMarketplace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var toolBar = (function() {
|
var toolBar = (function() {
|
||||||
|
var EDIT_SETTING = "io.highfidelity.isEditting"; // for communication with other scripts
|
||||||
|
var TOOL_ICON_URL = Script.resolvePath("assets/images/tools/");
|
||||||
var that = {},
|
var that = {},
|
||||||
toolBar,
|
toolBar,
|
||||||
activeButton,
|
systemToolbar,
|
||||||
newModelButton,
|
activeButton;
|
||||||
newCubeButton,
|
|
||||||
newSphereButton,
|
|
||||||
newLightButton,
|
|
||||||
newTextButton,
|
|
||||||
newWebButton,
|
|
||||||
newZoneButton,
|
|
||||||
newParticleButton
|
|
||||||
|
|
||||||
function initialize() {
|
|
||||||
toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.edit.toolbar", function(windowDimensions, toolbar) {
|
|
||||||
return {
|
|
||||||
x: (windowDimensions.x / 2) + (Tool.IMAGE_WIDTH * 2),
|
|
||||||
y: windowDimensions.y
|
|
||||||
};
|
|
||||||
}, {
|
|
||||||
x: toolWidth,
|
|
||||||
y: -TOOLBAR_MARGIN_Y - toolHeight
|
|
||||||
});
|
|
||||||
|
|
||||||
activeButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "edit.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
visible: true
|
|
||||||
}, true, false);
|
|
||||||
|
|
||||||
newModelButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "model-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newCubeButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "cube-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newSphereButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "sphere-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newLightButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "light-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newTextButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "text-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newWebButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "web-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newZoneButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "zone-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
newParticleButton = toolBar.addTool({
|
|
||||||
imageURL: toolIconUrl + "particle-01.svg",
|
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: Tool.IMAGE_WIDTH,
|
|
||||||
width: Tool.IMAGE_WIDTH,
|
|
||||||
height: Tool.IMAGE_HEIGHT
|
|
||||||
},
|
|
||||||
width: toolWidth,
|
|
||||||
height: toolHeight,
|
|
||||||
alpha: 0.9,
|
|
||||||
showButtonDown: true,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
that.setActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
that.clearEntityList = function() {
|
|
||||||
entityListTool.clearEntityList();
|
|
||||||
};
|
|
||||||
|
|
||||||
var EDIT_SETTING = "io.highfidelity.isEditting"; // for communication with other scripts
|
|
||||||
Settings.setValue(EDIT_SETTING, false);
|
|
||||||
that.setActive = function(active) {
|
|
||||||
if (active != isActive) {
|
|
||||||
if (active && !Entities.canRez() && !Entities.canRezTmp()) {
|
|
||||||
Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG);
|
|
||||||
} else {
|
|
||||||
Messages.sendLocalMessage("edit-events", JSON.stringify({
|
|
||||||
enabled: active
|
|
||||||
}));
|
|
||||||
isActive = active;
|
|
||||||
Settings.setValue(EDIT_SETTING, active);
|
|
||||||
if (!isActive) {
|
|
||||||
entityListTool.setVisible(false);
|
|
||||||
gridTool.setVisible(false);
|
|
||||||
grid.setEnabled(false);
|
|
||||||
propertiesTool.setVisible(false);
|
|
||||||
selectionManager.clearSelections();
|
|
||||||
cameraManager.disable();
|
|
||||||
selectionDisplay.triggerMapping.disable();
|
|
||||||
} else {
|
|
||||||
UserActivityLogger.enabledEdit();
|
|
||||||
hasShownPropertiesTool = false;
|
|
||||||
entityListTool.setVisible(true);
|
|
||||||
gridTool.setVisible(true);
|
|
||||||
grid.setEnabled(true);
|
|
||||||
propertiesTool.setVisible(true);
|
|
||||||
// Not sure what the following was meant to accomplish, but it currently causes
|
|
||||||
selectionDisplay.triggerMapping.enable();
|
|
||||||
// everybody else to think that Interface has lost focus overall. fogbugzid:558
|
|
||||||
// Window.setFocus();
|
|
||||||
}
|
|
||||||
that.showTools(isActive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toolBar.selectTool(activeButton, isActive);
|
|
||||||
lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE));
|
|
||||||
Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sets visibility of tool buttons, excluding the power button
|
|
||||||
that.showTools = function(doShow) {
|
|
||||||
toolBar.showTool(newModelButton, doShow);
|
|
||||||
toolBar.showTool(newCubeButton, doShow);
|
|
||||||
toolBar.showTool(newSphereButton, doShow);
|
|
||||||
toolBar.showTool(newLightButton, doShow);
|
|
||||||
toolBar.showTool(newTextButton, doShow);
|
|
||||||
toolBar.showTool(newWebButton, doShow);
|
|
||||||
toolBar.showTool(newZoneButton, doShow);
|
|
||||||
toolBar.showTool(newParticleButton, doShow);
|
|
||||||
};
|
|
||||||
|
|
||||||
var RESIZE_INTERVAL = 50;
|
|
||||||
var RESIZE_TIMEOUT = 120000; // 2 minutes
|
|
||||||
var RESIZE_MAX_CHECKS = RESIZE_TIMEOUT / RESIZE_INTERVAL;
|
|
||||||
|
|
||||||
function addModel(url) {
|
|
||||||
var entityID = createNewEntity({
|
|
||||||
type: "Model",
|
|
||||||
modelURL: url
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
if (entityID) {
|
|
||||||
print("Model added: " + url);
|
|
||||||
selectionManager.setSelections([entityID]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function createNewEntity(properties, dragOnCreate) {
|
function createNewEntity(properties, dragOnCreate) {
|
||||||
|
Settings.setValue(EDIT_SETTING, false);
|
||||||
|
|
||||||
// Default to true if not passed in
|
// Default to true if not passed in
|
||||||
dragOnCreate = dragOnCreate == undefined ? true : dragOnCreate;
|
// dragOnCreate = dragOnCreate == undefined ? true : dragOnCreate;
|
||||||
|
dragOnCreate = false;
|
||||||
|
|
||||||
var dimensions = properties.dimensions ? properties.dimensions : DEFAULT_DIMENSIONS;
|
var dimensions = properties.dimensions ? properties.dimensions : DEFAULT_DIMENSIONS;
|
||||||
var position = getPositionToCreateEntity();
|
var position = getPositionToCreateEntity();
|
||||||
|
@ -426,35 +199,69 @@ var toolBar = (function() {
|
||||||
return entityID;
|
return entityID;
|
||||||
}
|
}
|
||||||
|
|
||||||
that.mousePressEvent = function(event) {
|
function cleanup() {
|
||||||
var clickedOverlay,
|
that.setActive(false);
|
||||||
url,
|
}
|
||||||
file;
|
|
||||||
|
function addButton(name, image, handler) {
|
||||||
if (!event.isLeftButton) {
|
var imageUrl = TOOL_ICON_URL + image;
|
||||||
// if another mouse button than left is pressed ignore it
|
var button = toolBar.addButton({
|
||||||
return false;
|
objectName: name,
|
||||||
|
imageURL: imageUrl,
|
||||||
|
buttonState: 1,
|
||||||
|
alpha: 0.9,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
if (handler) {
|
||||||
|
button.clicked.connect(function(){
|
||||||
|
Script.setTimeout(handler, 100);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
clickedOverlay = Overlays.getOverlayAtPoint({
|
function initialize() {
|
||||||
x: event.x,
|
print("QQQ creating edit toolbar");
|
||||||
y: event.y
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
|
||||||
|
Window.domainChanged.connect(function() {
|
||||||
|
that.setActive(false);
|
||||||
|
that.clearEntityList();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (activeButton === toolBar.clicked(clickedOverlay)) {
|
Entities.canAdjustLocksChanged.connect(function(canAdjustLocks) {
|
||||||
that.setActive(!isActive);
|
if (isActive && !canAdjustLocks) {
|
||||||
return true;
|
that.setActive(false);
|
||||||
}
|
|
||||||
|
|
||||||
if (newModelButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
url = Window.prompt("Model URL");
|
|
||||||
if (url !== null && url !== "") {
|
|
||||||
addModel(url);
|
|
||||||
}
|
}
|
||||||
return true;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (newCubeButton === toolBar.clicked(clickedOverlay)) {
|
systemToolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
||||||
|
activeButton = systemToolbar.addButton({
|
||||||
|
objectName: "activeButton",
|
||||||
|
imageURL: TOOL_ICON_URL + "edit.svg",
|
||||||
|
visible: true,
|
||||||
|
buttonState: 1,
|
||||||
|
alpha: 0.9,
|
||||||
|
});
|
||||||
|
activeButton.clicked.connect(function(){
|
||||||
|
that.setActive(!isActive);
|
||||||
|
activeButton.writeProperty("buttonState", isActive ? 0 : 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.edit");
|
||||||
|
toolBar.writeProperty("shown", false);
|
||||||
|
|
||||||
|
addButton("newModelButton", "model-01.svg", function(){
|
||||||
|
var url = Window.prompt("Model URL");
|
||||||
|
if (url !== null && url !== "") {
|
||||||
|
createNewEntity({
|
||||||
|
type: "Model",
|
||||||
|
modelURL: url
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addButton("newCubeButton", "cube-01.svg", function(){
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Box",
|
type: "Box",
|
||||||
dimensions: DEFAULT_DIMENSIONS,
|
dimensions: DEFAULT_DIMENSIONS,
|
||||||
|
@ -464,11 +271,9 @@ var toolBar = (function() {
|
||||||
blue: 0
|
blue: 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
addButton("newSphereButton", "sphere-01.svg", function(){
|
||||||
}
|
|
||||||
|
|
||||||
if (newSphereButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Sphere",
|
type: "Sphere",
|
||||||
dimensions: DEFAULT_DIMENSIONS,
|
dimensions: DEFAULT_DIMENSIONS,
|
||||||
|
@ -478,11 +283,9 @@ var toolBar = (function() {
|
||||||
blue: 0
|
blue: 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
addButton("newLightButton", "light-01.svg", function(){
|
||||||
}
|
|
||||||
|
|
||||||
if (newLightButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Light",
|
type: "Light",
|
||||||
dimensions: DEFAULT_LIGHT_DIMENSIONS,
|
dimensions: DEFAULT_LIGHT_DIMENSIONS,
|
||||||
|
@ -499,11 +302,9 @@ var toolBar = (function() {
|
||||||
exponent: 0,
|
exponent: 0,
|
||||||
cutoff: 180, // in degrees
|
cutoff: 180, // in degrees
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
addButton("newTextButton", "text-01.svg", function(){
|
||||||
}
|
|
||||||
|
|
||||||
if (newTextButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Text",
|
type: "Text",
|
||||||
dimensions: {
|
dimensions: {
|
||||||
|
@ -524,11 +325,9 @@ var toolBar = (function() {
|
||||||
text: "some text",
|
text: "some text",
|
||||||
lineHeight: 0.06
|
lineHeight: 0.06
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
addButton("newWebButton", "web-01.svg", function(){
|
||||||
}
|
|
||||||
|
|
||||||
if (newWebButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Web",
|
type: "Web",
|
||||||
dimensions: {
|
dimensions: {
|
||||||
|
@ -538,11 +337,9 @@ var toolBar = (function() {
|
||||||
},
|
},
|
||||||
sourceUrl: "https://highfidelity.com/",
|
sourceUrl: "https://highfidelity.com/",
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
addButton("newZoneButton", "zone-01.svg", function(){
|
||||||
}
|
|
||||||
|
|
||||||
if (newZoneButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Zone",
|
type: "Zone",
|
||||||
dimensions: {
|
dimensions: {
|
||||||
|
@ -551,11 +348,9 @@ var toolBar = (function() {
|
||||||
z: 10
|
z: 10
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
addButton("newParticleButton", "particle-01.svg", function(){
|
||||||
}
|
|
||||||
|
|
||||||
if (newParticleButton === toolBar.clicked(clickedOverlay)) {
|
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
isEmitting: true,
|
isEmitting: true,
|
||||||
|
@ -577,33 +372,65 @@ var toolBar = (function() {
|
||||||
emitRate: 100,
|
emitRate: 100,
|
||||||
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
return false;
|
that.setActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
that.clearEntityList = function() {
|
||||||
|
entityListTool.clearEntityList();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.mouseReleaseEvent = function(event) {
|
that.setActive = function(active) {
|
||||||
return false;
|
if (active == isActive) {
|
||||||
}
|
return;
|
||||||
|
|
||||||
Window.domainChanged.connect(function() {
|
|
||||||
that.setActive(false);
|
|
||||||
that.clearEntityList();
|
|
||||||
});
|
|
||||||
|
|
||||||
Entities.canAdjustLocksChanged.connect(function(canAdjustLocks) {
|
|
||||||
if (isActive && !canAdjustLocks) {
|
|
||||||
that.setActive(false);
|
|
||||||
}
|
}
|
||||||
});
|
if (active && !Entities.canRez() && !Entities.canRezTmp()) {
|
||||||
|
Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG);
|
||||||
that.cleanup = function() {
|
return;
|
||||||
toolBar.cleanup();
|
}
|
||||||
|
Messages.sendLocalMessage("edit-events", JSON.stringify({
|
||||||
|
enabled: active
|
||||||
|
}));
|
||||||
|
isActive = active;
|
||||||
|
Settings.setValue(EDIT_SETTING, active);
|
||||||
|
if (!isActive) {
|
||||||
|
entityListTool.setVisible(false);
|
||||||
|
gridTool.setVisible(false);
|
||||||
|
grid.setEnabled(false);
|
||||||
|
propertiesTool.setVisible(false);
|
||||||
|
selectionManager.clearSelections();
|
||||||
|
cameraManager.disable();
|
||||||
|
selectionDisplay.triggerMapping.disable();
|
||||||
|
} else {
|
||||||
|
UserActivityLogger.enabledEdit();
|
||||||
|
hasShownPropertiesTool = false;
|
||||||
|
entityListTool.setVisible(true);
|
||||||
|
gridTool.setVisible(true);
|
||||||
|
grid.setEnabled(true);
|
||||||
|
propertiesTool.setVisible(true);
|
||||||
|
// Not sure what the following was meant to accomplish, but it currently causes
|
||||||
|
selectionDisplay.triggerMapping.enable();
|
||||||
|
// everybody else to think that Interface has lost focus overall. fogbugzid:558
|
||||||
|
// Window.setFocus();
|
||||||
|
}
|
||||||
|
// Sets visibility of tool buttons, excluding the power button
|
||||||
|
toolBar.writeProperty("shown", active);
|
||||||
|
var visible = toolBar.readProperty("visible");
|
||||||
|
if (active && !visible) {
|
||||||
|
toolBar.writeProperty("visible", false);
|
||||||
|
toolBar.writeProperty("shown", false);
|
||||||
|
toolBar.writeProperty("visible", true);
|
||||||
|
toolBar.writeProperty("shown", true);
|
||||||
|
}
|
||||||
|
//toolBar.selectTool(activeButton, isActive);
|
||||||
|
lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE));
|
||||||
|
Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE));
|
||||||
};
|
};
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
return that;
|
return that;
|
||||||
}());
|
})();
|
||||||
|
|
||||||
|
|
||||||
function isLocked(properties) {
|
function isLocked(properties) {
|
||||||
|
@ -712,7 +539,7 @@ function mousePressEvent(event) {
|
||||||
mouseHasMovedSincePress = false;
|
mouseHasMovedSincePress = false;
|
||||||
mouseCapturedByTool = false;
|
mouseCapturedByTool = false;
|
||||||
|
|
||||||
if (propertyMenu.mousePressEvent(event) || toolBar.mousePressEvent(event) || progressDialog.mousePressEvent(event)) {
|
if (propertyMenu.mousePressEvent(event) || progressDialog.mousePressEvent(event)) {
|
||||||
mouseCapturedByTool = true;
|
mouseCapturedByTool = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -796,8 +623,7 @@ function mouseReleaseEvent(event) {
|
||||||
mouseMove(lastMouseMoveEvent);
|
mouseMove(lastMouseMoveEvent);
|
||||||
lastMouseMoveEvent = null;
|
lastMouseMoveEvent = null;
|
||||||
}
|
}
|
||||||
if (propertyMenu.mouseReleaseEvent(event) || toolBar.mouseReleaseEvent(event)) {
|
if (propertyMenu.mouseReleaseEvent(event)) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (placingEntityID) {
|
if (placingEntityID) {
|
||||||
|
@ -1094,7 +920,6 @@ Script.scriptEnding.connect(function() {
|
||||||
Settings.setValue(SETTING_SHOW_ZONES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE));
|
Settings.setValue(SETTING_SHOW_ZONES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE));
|
||||||
|
|
||||||
progressDialog.cleanup();
|
progressDialog.cleanup();
|
||||||
toolBar.cleanup();
|
|
||||||
cleanupModelMenus();
|
cleanupModelMenus();
|
||||||
tooltip.cleanup();
|
tooltip.cleanup();
|
||||||
selectionDisplay.cleanup();
|
selectionDisplay.cleanup();
|
||||||
|
|
Loading…
Reference in a new issue