public override void onActivated() { readSettings(); // Set a global variable so everyone knows we're editing! bGlobal["$Nav::EditorOpen"] = true; // Start off in Select mode. GuiDynamicCtrlArrayControl ToolsPaletteArray = "ToolsPaletteArray"; GuiBitmapButtonCtrl NavEditorSelectMode = ToolsPaletteArray.FOT("NavEditorSelectMode"); NavEditorSelectMode.performClick(); EditorGui EditorGui = "EditorGui"; NavEditorGui NavEditorGui = "NavEditorGui"; EditorGui.bringToFront(NavEditorGui); NavEditorGui.setVisible(true); NavEditorGui.makeFirstResponder(true); GuiControl NavEditorToolbar = "NavEditorToolbar"; NavEditorToolbar.setVisible(true); GuiWindowCollapseCtrl NavEditorOptionsWindow = "NavEditorOptionsWindow"; GuiWindowCollapseCtrl NavEditorTreeWindow = "NavEditorTreeWindow"; NavEditorOptionsWindow.setVisible(true); NavEditorTreeWindow.setVisible(true); // Inspect the ServerNavMeshSet, which contains all the NavMesh objects // in the mission. SimSet ServerNavMeshSet = "ServerNavMeshSet"; if (!Util.isObject(ServerNavMeshSet)) { ServerNavMeshSet = new ObjectCreator("SimSet", "ServerNavMeshSet").Create(); } if (ServerNavMeshSet.getCount() == 0) { messageBox.MessageBoxYesNo("No NavMesh", "There is no NavMesh in this level. Would you like to create one?" + " " + "If not, please use the World Editor to create a new NavMesh.", "Canvas.pushDialog(CreateNewNavMeshDlg);"); } NavTreeView NavTreeView = "NavTreeView"; NavTreeView.open(ServerNavMeshSet, true); // Push our keybindings to the top. (See initializeNavEditor for where this // map was created.) map.push(); // Store this on a dynamic field // in order to restore whatever setting // the user had before. GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile"; prevGizmoAlignment = GlobalGizmoProfile.alignment; // Always use Object alignment. GlobalGizmoProfile.alignment = "Object"; // Set the status bar here until all tool have been hooked up EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar"; EditorGuiStatusBar.setInfo("Navigation editor."); EditorGuiStatusBar.setSelection(""); // Allow the Gui to setup. NavEditorGui.onEditorActivated(); base.onActivated(); }
public void open(string filename) { EditorGui EditorGui = "EditorGui"; ShapeEdPropWindow ShapeEdPropWindow = "ShapeEdPropWindow"; ShapeEdSelectWindow ShapeEdSelectWindow = "ShapeEdSelectWindow"; ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow"; ShapeEdAnimWindow ShapeEdAnimWindow = "ShapeEdAnimWindow"; ShapeEditorToolbar ShapeEditorToolbar = "ShapeEditorToolbar"; ShapeEditor.ShapeEdShapeView ShapeEdShapeView = "ShapeEdShapeView"; ShapeEditor.ShapeEdNodes ShapeEdNodes = "ShapeEdNodes"; Settings EditorSettings = "EditorSettings"; EWorldEditor EWorldEditor = "EWorldEditor"; GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile"; ShapeEditor.ShapeEdShapeTreeView ShapeEdShapeTreeView = "ShapeEdShapeTreeView"; ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui = "ShapeEdPreviewGui"; ShapeEditorActions.ShapeEdUndoManager ShapeEdUndoManager = "ShapeEdUndoManager"; SimGroup MissionGroup = "MissionGroup"; GuiDynamicCtrlArrayControl ToolsPaletteArray = "ToolsPaletteArray"; editor Editor = "Editor"; ShapeEditor.ShapeEdMaterials ShapeEdMaterials = "ShapeEdMaterials"; ShapeEditor ShapeEditor = "ShapeEditor"; GuiBitmapButtonCtrl wireframeMode = ShapeEditorToolbar.FOT("wireframeMode"); GuiBitmapButtonCtrl showAdvanced = ShapeEditorToolbar.FOT("showAdvanced"); GuiIconButtonCtrl worldTransform = ShapeEdNodes.FOT("worldTransform"); GuiIconButtonCtrl objectTransform = ShapeEdNodes.FOT("objectTransform"); GuiCheckBoxCtrl highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial"); GuiCanvas Canvas = "Canvas"; if (!this["isActivated"].AsBool()) { // Activate the Shape Editor EditorGui.setEditor(this, false); // Get editor settings (note the sun angle is not configured in the settings // dialog, so apply the settings here instead of in readSettings) this.readSettings(); ShapeEdShapeView["sunAngleX"] = EditorSettings.value("ShapeEditor/SunAngleX"); ShapeEdShapeView["sunAngleZ"] = EditorSettings.value("ShapeEditor/SunAngleZ"); EWorldEditor["forceLoadDAE"] = EditorSettings.value("forceLoadDAE"); bGlobal["$wasInWireFrameMode"] = bGlobal["$gfx::wireframe"]; wireframeMode.setStateOn(bGlobal["$gfx::wireframe"]); if (GlobalGizmoProfile.getFieldValue("alignment", -1) == "Object") { objectTransform.setStateOn(true); } else { worldTransform.setStateOn(true); } // Initialise and show the shape editor ShapeEdShapeTreeView.open(MissionGroup); ShapeEdShapeTreeView.buildVisibleTree(true); ShapeEdPreviewGui.setVisible(true); ShapeEdSelectWindow.setVisible(true); ShapeEdPropWindow.setVisible(true); ShapeEdAnimWindow.setVisible(true); ShapeEdAdvancedWindow.setVisible(showAdvanced.getValue().AsBool()); ShapeEditorToolbar.setVisible(true); EditorGui.bringToFront(ShapeEdPreviewGui); ((GuiBitmapButtonCtrl)ToolsPaletteArray.FOT("WorldEditorMove")).performClick(); this.map.push(); // Switch to the ShapeEditor UndoManager this["oldUndoMgr"] = Editor.getUndoManager(); Editor.setUndoManager(ShapeEdUndoManager); ShapeEdShapeView.setDisplayType(EditorGui["currentDisplayType"].AsInt()); this.initStatusBar(); // Customise menu bar this["oldCamFitCmd"] = this.replaceMenuCmd("Camera", "8", "ShapeEdShapeView.fitToShape();"); this["oldCamFitOrbitCmd"] = this.replaceMenuCmd("Camera", "9", "ShapeEdShapeView.fitToShape();"); base.onActivated(); } // Select the new shape if (ShapeEditor.shape.isObject() && (ShapeEditor.shape["baseShape"] == filename)) { // Shape is already selected => re-highlight the selected material if necessary ShapeEdMaterials.updateSelectedMaterial(highlightMaterial.getValue().AsBool()); } else if (filename != "") { ShapeEditor.selectShape(filename, ShapeEditor.isDirty()); // 'fitToShape' only works after the GUI has been rendered, so force a repaint first Canvas.repaint(0); ShapeEdShapeView.fitToShape(); } }