public void previousPreviews() { GuiDynamicCtrlArrayControl SmallPreviews = ((GuiDynamicCtrlArrayControl)((GuiWindowCtrl)"ChooseLevelWindow").findObjectByInternalName("SmallPreviews", false)); int prevHiddenIdx = SmallPreviews["firstVisible"].AsInt() - 1; if (prevHiddenIdx < 0) { return; } int lastVisibleIdx = SmallPreviews["lastVisible"].AsInt(); if (lastVisibleIdx >= SmallPreviews.getCount()) { return; } GuiControl prevHiddenObj = SmallPreviews.getObject((uint)prevHiddenIdx); GuiControl lastVisibleObj = SmallPreviews.getObject((uint)lastVisibleIdx); if (prevHiddenObj.isObject() && lastVisibleObj.isObject()) { SmallPreviews["firstVisible"] = (SmallPreviews["firstVisible"].AsInt() - 1).AsString(); SmallPreviews["lastVisible"] = (SmallPreviews["lastVisible"].AsInt() - 1).AsString(); prevHiddenObj.setVisible(true); lastVisibleObj.setVisible(false); } }
public void createTool(string tool, string cmd, GuiDynamicCtrlArrayControl toolsArray) { var oc1 = new ObjectCreator("GuiControl"); GuiControl container = oc1.Create(); var oc = new ObjectCreator("GuiBitmapButtonCtrl"); oc["Extent"] = "108 81"; oc["position"] = "35 0"; oc["bitmap"] = "art/gui/no-preview"; oc["altCommand"] = "ToolsDlg.execute(\\\"" + this["cwd"] + "/" + cmd + ".bat\\\");"; GuiBitmapButtonCtrl bitmap = oc.Create(); var oc2 = new ObjectCreator("GuiTextCtrl"); oc2["text"] = tool; oc2["Extent"] = "108 30"; oc2["position"] = "35 85"; GuiTextCtrl text = oc2.Create(); container.addGuiControl(bitmap); container.addGuiControl(text); toolsArray.addGuiControl(container); }
public void LoadControls(GuiControl obj, int paletteGroup) { GuiDynamicCtrlArrayControl ToolsPaletteArray = "ToolsPaletteArray"; for (int i = obj.getCount(); i != 0; i--) { ((GuiControl)obj.getObject(0)).visible = false; ((GuiControl)obj.getObject(0))["groupNum"] = paletteGroup.AsString(); ((GuiControl)obj.getObject(0))["paletteName"] = obj.getName(); ToolsPaletteArray.addGuiControl(obj.getObject(0)); } }
public void setListView(bool noupdate) { GuiDynamicCtrlArrayControl CreatorIconArray = "CreatorIconArray"; //CreatorIconArray.clear(); //CreatorIconArray.setVisible( false ); CreatorIconArray.setVisible(true); this.contentCtrl = CreatorIconArray; this.isList = true; if (noupdate) { this.navigate(this.address); } }
public override void onWake() { GuiDynamicCtrlArrayControl toolsArray = FOT("toolsDynamicArray"); toolsArray.clear(); var cwd = Util.getCurrentDirectory(); this["cwd"] = Util.filePath(cwd); createTool("Clean Shaders", "cleanShaders", toolsArray); createTool("Delete Cached DTSs", "DeleteCachedDTSs", toolsArray); createTool("Delete DSOs", "DeleteDSOs", toolsArray); createTool("Delete Prefs", "DeletePrefs", toolsArray); //toolsArray.addGuiControl(); }
public void togglePalette(string paletteName) { GuiDynamicCtrlArrayControl ToolsPaletteArray = "ToolsPaletteArray"; EWToolsPaletteWindow EWToolsPaletteWindow = "EWToolsPaletteWindow"; // since the palette window ctrl auto adjusts to child ctrls being visible, // loop through the array and pick out the children that belong to a certain tool // and label them visible or not visible for (uint i = 0; i < ToolsPaletteArray.getCount(); i++) { ((GuiControl)ToolsPaletteArray.getObject(i)).visible = false; } int windowMultiplier = 0; int paletteNameWordCount = Util.getWordCount(paletteName); for (int palatteNum = 0; palatteNum < paletteNameWordCount; palatteNum++) { string currentPalette = Util.getWord(paletteName, palatteNum); for (uint i = 0; i < ToolsPaletteArray.getCount(); i++) { if (((GuiControl)ToolsPaletteArray.getObject(i))["paletteName"] == currentPalette) { ((GuiControl)ToolsPaletteArray.getObject(i)).visible = true; windowMultiplier++; } } } // auto adjust the palette window extent according to how many // children controls we found; if none found, the palette window becomes invisible if (windowMultiplier == 0 || paletteName == "") { EWToolsPaletteWindow.visible = false; } else { EWToolsPaletteWindow.visible = true; EWToolsPaletteWindow.extent = new Point2I(EWToolsPaletteWindow.extent.x, (16 + 26 * windowMultiplier)); } }
public override void onWake() { GuiTextListCtrl CL_levelList = "CL_levelList"; CL_levelList.clear(); ChooseLevelWindow ChooseLevelWindow = "ChooseLevelWindow"; GuiDynamicCtrlArrayControl SmallPreviews = ((GuiDynamicCtrlArrayControl)((GuiWindowCtrl)"ChooseLevelWindow").findObjectByInternalName("SmallPreviews", false)); ((GuiDynamicCtrlArrayControl)ChooseLevelWindow.findObjectByInternalName("SmallPreviews", false)).clear(); string file = ""; for (file = Util.findFirstFile(sGlobal["$Server::MissionFileSpec"], true); file != ""; file = Util.findNextFile(sGlobal["$Server::MissionFileSpec"])) { // Skip our new level/mission if we arent choosing a level // to launch in the editor. if (!this["launchInEditor"].AsBool()) { if (Util.strstr(file, "newMission.mis") > -1) { continue; } if (Util.strstr(file, "newLevel.mis") > -1) { continue; } } addMissionFile(file); } // Also add the new level mission as defined in the world editor settings // if we are choosing a level to launch in the editor. if (this["launchInEditor"].AsBool()) { file = ((Settings)"EditorSettings").value("WorldEditor/newLevelFile"); if (file != "") { addMissionFile(file); } } // Sort our list CL_levelList.sort("0"); // Set the first row as the selected row CL_levelList.setSelectedRow(0); GuiBitmapButtonCtrl preview; for (int i = 0; i < CL_levelList.rowCount(); i++) { ObjectCreator oc = new ObjectCreator("GuiBitmapButtonCtrl"); oc["internalName"] = "SmallPreview" + i; oc["Extent"] = "108 81"; oc["bitmap"] = "art/gui/no-preview"; oc["command"] = "ChooseLevelWindow.previewSelected(ChooseLevelWindow->SmallPreviews->SmallPreview" + i + ");"; preview = oc.Create(); SmallPreviews.add(preview); // Set this small preview visible if (i > 5) { preview.setVisible(false); } // Set the level index preview["levelIndex"] = i.AsString(); // Get the name string name = Util.getField(CL_levelList.getRowText(i), 0); preview["levelName"] = name; file = Util.getField(CL_levelList.getRowText(i), 1); // Find the preview image string levelPreview = Util.filePath(file) + "/" + Util.fileBase(file) + "_preview"; // Test against all of the different image formats // This should probably be moved into an engine function if (Util.isFile(levelPreview + ".png") || Util.isFile(levelPreview + ".jpg") || Util.isFile(levelPreview + ".bmp") || Util.isFile(levelPreview + ".gif") || Util.isFile(levelPreview + ".jng") || Util.isFile(levelPreview + ".mng") || Util.isFile(levelPreview + ".tga")) { preview.setBitmap(levelPreview); } // Get the description String desc = Util.getField(CL_levelList.getRowText(i), 2); preview["levelDesc"] = desc; } SmallPreviews["firstVisible"] = "-1"; SmallPreviews["lastVisible"] = "-1"; if (SmallPreviews.getCount() > 0) { SmallPreviews["firstVisible"] = "0"; if (SmallPreviews.getCount() < 6) { SmallPreviews["lastVisible"] = (SmallPreviews.getCount() - 1).AsString(); } else { SmallPreviews["lastVisible"] = "4"; } } if (SmallPreviews.getCount() > 0) { ChooseLevelWindow.previewSelected(SmallPreviews.getObject(0)); } // If we have 5 or less previews then hide our next/previous buttons // and resize to fill their positions if (SmallPreviews.getCount() < 6) { ((GuiBitmapButtonCtrl)ChooseLevelWindow.findObjectByInternalName("PreviousSmallPreviews", false)).setVisible(false); ((GuiBitmapButtonCtrl)ChooseLevelWindow.findObjectByInternalName("NextSmallPreviews", false)).setVisible(false); Point2I previewPos = SmallPreviews.getPosition(); Point2I previousPos = ((GuiBitmapButtonCtrl)ChooseLevelWindow.findObjectByInternalName("PreviousSmallPreviews", false)).getPosition(); SmallPreviews.setPosition(previousPos.x, previewPos.y); SmallPreviews.colSpacing = 10; SmallPreviews.refresh(); } if (SmallPreviews.getCount() <= 1) { // Hide the small previews SmallPreviews.setVisible(false); // Shrink the ChooseLevelWindow so that we don't have a large blank space ChooseLevelWindow.setExtent(new Point2F(ChooseLevelWindow.getExtent().x + " " + SmallPreviews.getPosition().y)); ChooseLevelWindow.setExtent(new Point2F(ChooseLevelWindow.getExtent().x, SmallPreviews.getPosition().y)); } else { // Make sure the small previews are visible SmallPreviews.setVisible(true); int extentX = ChooseLevelWindow.getExtent().x; int extentY = SmallPreviews.getPosition().y; extentY = extentY + SmallPreviews.getExtent().y; extentY += 9; ChooseLevelWindow.setExtent(new Point2F(extentX, extentY)); } }
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 setViewTypeCategorized() { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; // Create rollouts for each class category we have and // record the classes in each category in a temporary array // on the rollout so we can later sort the class names before // creating the actual controls in the toolbox. string controls = Util.enumerateConsoleClassesByCategory("Gui"); foreach (string className in controls.Split('\t')) { if (GuiEditor.isFilteredClass(className) || !Util.isMemberOfClass(className, "GuiControl")) { continue; } // Get the class's next category under Gui. string category = Util.getWord(Util.getCategoryOfClass(className), 1); if (category == "") { continue; } // Find or create the rollout for the category. GuiRolloutCtrl rollout = this.getOrCreateRolloutForCategory(category); // Insert the item. if (!rollout["classes"].AsBool()) { rollout["classes"] = new ObjectCreator("ArrayObject").Create().AsString(); } ((ArrayObject)rollout["classes"]).push_back(className, ""); } // Go through the rollouts, sort the class names, and // create the toolbox controls. for (uint i = 0; i < this.getCount(); i++) { GuiRolloutCtrl rollout = this.getObject(i); if (!rollout.isMemberOfClass("GuiRolloutCtrl")) { continue; } // Get the array with the class names and sort it. // Sort in descending order to counter reversal of order // when we later add the controls to the stack. ArrayObject classes = rollout["classes"]; classes.sortk(true); // Add a control for each of the classes to the // rollout's stack control. GuiDynamicCtrlArrayControl stack = rollout.FOT("array"); int numClasses = classes.count(); for (int n = 0; n < numClasses; n++) { string className = classes.getKey(n); #region GuiIconButtonCtrl () oc_Newobject3 ObjectCreator oc_Newobject3 = new ObjectCreator("GuiIconButtonCtrl", "", typeof(GuiEditorToolboxButton)); oc_Newobject3["profile"] = "ToolsGuiIconButtonSmallProfile"; oc_Newobject3["extent"] = "128 18"; oc_Newobject3["text"] = className; oc_Newobject3["iconBitmap"] = console.Call_Classname("EditorIconRegistry", "findIconByClassName", new string[] { className }); oc_Newobject3["buttonMargin"] = "2 2"; oc_Newobject3["iconLocation"] = "left"; oc_Newobject3["textLocation"] = "left"; oc_Newobject3["textMargin"] = "24"; oc_Newobject3["AutoSize"] = new ObjectCreator.StringNoQuote("true"); oc_Newobject3["command"] = "GuiEditor.createControl( " + className + " );"; oc_Newobject3["useMouseEvents"] = new ObjectCreator.StringNoQuote("true"); //TODO doesn't work for every control. //oc_Newobject3["tooltip"] = className + '\n' + "\n" + Util.getDescriptionOfClass( className ); oc_Newobject3["tooltipProfile"] = "ToolsGuiToolTipProfile"; #endregion GuiIconButtonCtrl ctrl = oc_Newobject3.Create(); stack.add(ctrl); } // Delete the temporary array. rollout["classes"] = ""; classes.delete(); } this.currentViewType = "Categorized"; }
public void navigate(string address) { GuiDynamicCtrlArrayControl CreatorIconArray = "CreatorIconArray"; CreatorPopupMenu CreatorPopupMenu = "CreatorPopupMenu"; CreatorIconArray.frozen = true; CreatorIconArray.clear(); CreatorPopupMenu.clear(); if (this.tab.ToLower() == "Scripted".ToLower()) { string category = Util.getWord(address, 1); SimSet dataGroup = "DataBlockGroup"; for (uint i = 0; i < dataGroup.getCount(); i++) { SimObject obj = dataGroup.getObject(i); // echo ("Obj: " + obj.getName() + " - " + obj.category ); if (obj["category"] == "" && obj["category"].AsInt() == 0) { continue; } // Add category to popup menu if not there already if (CreatorPopupMenu.findText(obj["category"]) == -1) { CreatorPopupMenu.add(obj["category"]); } if (address == "") { string ctrl = this.findIconCtrl(obj["category"]); if (ctrl == "-1") { this.addFolderIcon(obj["category"]); } } else if (address.ToLower() == obj["category"].ToLower()) { string ctrl = this.findIconCtrl(obj.getName()); if (ctrl == "-1") { this.addShapeIcon(obj); } } } } if (this.tab.ToLower() == "Meshes".ToLower()) { string fullPath = Util.findFirstFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif", true); while (fullPath != "") { if (Util.strstr(fullPath, "cached.dts") != -1) { fullPath = Util.findNextFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif"); continue; } fullPath = Util.makeRelativePath(fullPath, Util.getMainDotCsDir()); string splitPath = Util.strreplace(fullPath, "/", " "); if (Util.getWord(splitPath, 0) == "tools") { fullPath = Util.findNextFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif"); continue; } int dirCount = Util.getWordCount(splitPath) - 1; string pathFolders = Util.getWords(splitPath, 0, dirCount - 1); // Add this file's path (parent folders) to the // popup menu if it isn't there yet. string temp = Util.strreplace(pathFolders, " ", "/"); int re = CreatorPopupMenu.findText(temp); if (re == -1) { CreatorPopupMenu.add(temp); } // Is this file in the current folder? if (Util.stricmp(pathFolders, address) == 0) { this.addStaticIcon(fullPath); } // Then is this file in a subfolder we need to add // a folder icon for? else { int wordIdx = 0; bool add = false; if (address == "") { add = true; wordIdx = 0; } else { for (; wordIdx < dirCount; wordIdx++) { temp = Util.getWords(splitPath, 0, wordIdx); if (Util.stricmp(temp, address) == 0) { add = true; wordIdx++; break; } } } if (add == true) { string folder = Util.getWord(splitPath, wordIdx); SimObject ctrl = this.findIconCtrl(folder); if (ctrl == 0) { this.addFolderIcon(folder); } } } fullPath = Util.findNextFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif"); } } if (this.tab.ToLower() == "Level".ToLower()) { // Add groups to popup menu array = this.array; array.sortk(false); int count = array.count(); if (count > 0) { string lastGroup = ""; for (int i = 0; i < count; i++) { string group = array.getKey(i); if (group != lastGroup) { CreatorPopupMenu.add(group); if (address == "") { this.addFolderIcon(group); } } if (address.ToLower() == group.ToLower()) { ScriptObject args = array.getValue(i); string className = args["val[0]"]; string name = args["val[1]"]; string func = args["val[2]"]; this.addMissionObjectIcon(className, name, func); } lastGroup = group; } } } if (this.tab.ToLower() == "Prefabs".ToLower()) { string expr = "*.prefab"; string fullPath = Util.findFirstFile(expr); while (fullPath != "") { fullPath = Util.makeRelativePath(fullPath, Util.getMainDotCsDir()); string splitPath = Util.strreplace(fullPath, "/", " "); if (Util.getWord(splitPath, 0) == "tools") { fullPath = Util.findNextFile(expr); continue; } int dirCount = Util.getWordCount(splitPath) - 1; string pathFolders = Util.getWords(splitPath, 0, dirCount - 1); // Add this file's path (parent folders) to the // popup menu if it isn't there yet. string temp = Util.strreplace(pathFolders, " ", "/"); int re = CreatorPopupMenu.findText(temp); if (re == -1) { CreatorPopupMenu.add(temp); } // Is this file in the current folder? if (Util.stricmp(pathFolders, address) == 0) { this.addPrefabIcon(fullPath); } // Then is this file in a subfolder we need to add // a folder icon for? else { int wordIdx = 0; bool add = false; if (address == "") { add = true; wordIdx = 0; } else { for (; wordIdx < dirCount; wordIdx++) { temp = Util.getWords(splitPath, 0, wordIdx); if (Util.stricmp(temp, address) == 0) { add = true; wordIdx++; break; } } } if (add == true) { string folder = Util.getWord(splitPath, wordIdx); SimObject ctrl = this.findIconCtrl(folder); if (ctrl == 0) { this.addFolderIcon(folder); } } } fullPath = Util.findNextFile(expr); } } CreatorIconArray.sort("alphaIconCompare"); for (uint i = 0; i < CreatorIconArray.getCount(); i++) { ((SimObject)CreatorIconArray.getObject(i))["autoSize"] = false.AsString(); } CreatorIconArray.frozen = false; CreatorIconArray.refresh(); // Recalculate the array for the parent guiScrollCtrl CreatorIconArray.getParent().call("computeSizes"); this.address = address; CreatorPopupMenu.sort(); string str = Util.strreplace(address, " ", "/"); if (str != "") { int r = CreatorPopupMenu.findText(str); if (r != -1) { CreatorPopupMenu.setSelected(r, false); } else { CreatorPopupMenu.setText(str); } } else { CreatorPopupMenu.setText(""); } CreatorPopupMenu.tooltip = str; }
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(); } }