public void update() { GuiControl GuiEditorContent = "GuiEditorContent"; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; SimObject obj = GuiEditorContent.getObject(0); if (!obj.isObject()) { this.clear(); } else { // Open inspector tree. this.open(obj); // Sync selection with GuiEditor. this.clearSelection(); SimSet selection = GuiEditor.getSelection(); int count = selection.getCount(); for (uint i = 0; i < count; i++) { this.addSelection(selection.getObject(i).AsInt(), false); } } }
public string createObject(string cmd) { SimGroup MissionGroup = "MissionGroup"; if (!bGlobal["$missionRunning"]) { return(""); } if (!this.objectGroup.isObject()) { this.setNewObjectGroup(MissionGroup); } Util.pushInstantGroup(); SimObject objId = Util.eval(cmd); Util.popInstantGroup(); if (objId.isObject()) { this.onFinishCreateObject(objId); } return(objId); }
public override void onRightMouseUp(int itemId, string mousePos, SimObject objectx) { SimObject datablock = this.getItemValue(itemId); if (!datablock.isObject()) { return; } if (!((MenuBuilder)"DatablockEditorTreePopup").isObject()) { ObjectCreator ocf = new ObjectCreator("PopupMenu", "DatablockEditorTreePopup", typeof(MenuBuilder)); ocf["isPopup"] = true.AsString(); ocf["item[0]"] = "Delete" + '\t' + "" + '\t' + "DatablockEditorPlugin.selectDatablock( %this.datablockObject ); DatablockEditorPlugin.deleteDatablock( %this.datablockObject );"; ocf["item[1]"] = "Jump to Definition in Torsion" + '\t' + "" + '\t' + "EditorOpenDeclarationInTorsion( %this.datablockObject );"; ocf["datablockObject"] = ""; ocf.Create(); } ((PopupMenu)"DatablockEditorTreePopup")["datablockObject"] = datablock; ((PopupMenu)"DatablockEditorTreePopup").showPopup("Canvas"); }
public override void onDeactivated() { ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow"; ForestEditorGui.ForestEditorPalleteWindow ForestEditorPalleteWindow = "ForestEditorPalleteWindow"; ForestEditorGui ForestEditorGui = "ForestEditorGui"; PersistenceManager ForestDataManager = "ForestDataManager"; //Copyright Winterleaf Entertainment L.L.C. 2013 if (!this["isActive"].AsBool()) { return; } this["isActive"] = false.AsString(); //Copyright Winterleaf Entertainment L.L.C. 2013 ForestEditorGui.setVisible(false); ForestEditorPalleteWindow.setVisible(false); ForestEditorPropertiesWindow.setVisible(false); SimObject tool = ForestEditorGui.getActiveTool(); if (tool.isObject()) { tool.call("onDeactivated"); } // Also take this opportunity to save. ForestDataManager.saveDirty(); this.map.pop(); base.onDeactivated(); }
public void previewSelected(SimObject preview) { GuiTextListCtrl CL_levelList = "CL_levelList"; if (preview.isObject() && preview["levelIndex"] != "") { CL_levelList.setSelectedRow(preview["levelIndex"].AsInt()); } else { CL_levelList.setSelectedRow(-1); } // Set the large preview image if (preview.isObject() && preview["bitmap"] != "") { ((GuiBitmapCtrl)this.findObjectByInternalName("CurrentPreview", false)).setBitmapX(preview["bitmap"]); } else { ((GuiBitmapCtrl)this.findObjectByInternalName("CurrentPreview", false)).setBitmapX( "art/gui/no-preview"); } // Set the current level name if (preview.isObject() && preview["levelName"] != "") { ((GuiTextCtrl)this.findObjectByInternalName("LevelName", false)).setText(preview["levelName"]); } else { ((GuiTextCtrl)this.findObjectByInternalName("LevelName", false)).setText("Level"); } // Set the current level description if (preview.isObject() && preview["levelDesc"] != "") { ((GuiMLTextCtrl)this.findObjectByInternalName("LevelDescription", false)).setText( preview["levelDesc"]); } else { ((GuiMLTextCtrl)this.findObjectByInternalName("LevelDescription", false)).setText("A Torque Level"); } }
public override void onRemoveSelection(int itemOrObjectId) { DatablockEditorPlugin DatablockEditorPlugin = "DatablockEditorPlugin"; SimObject obj = this.getItemValue(itemOrObjectId); if (obj.isObject()) { DatablockEditorPlugin.unselectDatablock(obj, true); } }
public override void onAddSelection(int itemOrObjectId, bool isLastSelection) { DatablockEditorPlugin DatablockEditorPlugin = "DatablockEditorPlugin"; SimObject obj = this.getItemValue(itemOrObjectId); if (!obj.isObject()) { this.selectItem(itemOrObjectId, false); } else { DatablockEditorPlugin.selectDatablock(obj, true, true); } }
public void inspect(SimObject obj) { string name = ""; if (obj.isObject()) { name = obj.getName(); } else { ((GuiMLTextCtrl)"FieldInfoControl").setText(""); } base.inspect(obj); }
public void inspect(SimObject obj) { GuiMLTextCtrl MissionAreaFieldInfoControl = "MissionAreaFieldInfoControl"; string name = ""; if (obj.isObject()) { name = obj.getName(); } else { MissionAreaFieldInfoControl.setText(""); } //RiverInspectorNameEdit.setValue( %name ); base.inspect(obj); }
public void readSettings() { Settings EditorSettings = "EditorSettings"; GuiTabBookCtrl DatablockEditorTreeTabBook = "DatablockEditorTreeTabBook"; EditorSettings.beginGroup("DatablockEditor", true); DatablockEditorTreeTabBook.selectPage(EditorSettings.value("libraryTab").AsInt()); SimObject db = EditorSettings.value("selectedDatablock"); if (db.isObject() && db.isMemberOfClass("SimDatablock")) { this.selectDatablock(db); } EditorSettings.endGroup(); }
public static void GE_OpenGUIFile() { GuiCanvas Canvas = "Canvas"; string openFileName = omni.console.Call_Classname("GuiBuilder", "getOpenName"); if (openFileName == "") { return; } // Make sure the file is valid. if ((!omni.Util.isFile(openFileName)) && (!omni.Util.isFile(openFileName + ".dso"))) { return; } // Allow stomping objects while exec'ing the GUI file as we want to // pull the file's objects even if we have another version of the GUI // already loaded. string oldRedefineBehavior = omni.sGlobal["$Con::redefineBehavior"]; omni.sGlobal["$Con::redefineBehavior"] = "replaceExisting"; // Load up the level. SimObject guiContent = omni.Util.eval(openFileName); omni.sGlobal["$Con::redefineBehavior"] = oldRedefineBehavior; // The level file should have contained a scenegraph, which should now be in the instant // group. And, it should be the only thing in the group. //TODO if (!guiContent.isObject()) { omni.Util.messageBox(omni.console.Call("getEngineName"), "You have loaded a Gui file that was created before this version. It has been loaded but you must open it manually from the content list dropdown", "Ok", "Information"); GuiEditorGui.GuiEditContent(Canvas.getContent().AsString()); return; } GuiEditorGui.GuiEditContent(guiContent); }
public void setMaterialName(string newName) { GuiTreeViewCtrl matLibTree = this.findObjectByInternalName("matLibTree", true); SimObject mat = this["activeMat"]; if (mat.internalName != newName) { SimObject existingMat = ((SimSet)"TerrainMaterialSet").findObjectByInternalName(newName, true); if (existingMat.isObject()) { messageBox.MessageBoxOK("Error", "There already is a terrain material called '" + newName + "'."); } else { mat.setInternalName(newName); matLibTree.buildVisibleTree(false); } } }
public void onObjectCreated(SimObject objId) { EditorTree EditorTree = "EditorTree"; EWorldEditor EWorldEditor = "EWorldEditor"; // Can we submit an undo action? if (objId.isObject()) { Extendable.MECreateUndoAction.submit(objId); } EditorTree.clearSelection(); EWorldEditor.clearSelection(); EWorldEditor.selectObject(objId); // When we drop the selection don't store undo // state for it... the creation deals with it. EWorldEditor.dropSelection(true); }
public override void redo() { int numObjects = this.numObjects; for (int i = 0; i < numObjects; i++) { SimObject obj = this["objects[" + i + "]"]; SimObject group = this["newParents[" + i + "]"]; if (obj.isObject() && group.isObject()) { obj.parentGroup = group; } } if (this["treeView"].isObject()) { this["treeView"].call("update"); } }
public static void InspectApply() { GuiInspector InspectFields = "InspectFields"; GuiTextEditCtrl InspectObjectName = "InspectObjectName"; GuiTextEditCtrl InspectObjectInternalName = "InspectObjectInternalName"; SimObject obj = InspectObjectName["refObj"]; if (!obj.isObject()) { return; } // Update name and internal name obj.setName(InspectObjectName.getValue()); obj.setInternalName(InspectObjectInternalName.getValue()); // Update inspected object information. InspectFields.inspect(obj); }
public static void InspectDelete() { GuiInspector InspectFields = "InspectFields"; GuiTextEditCtrl InspectObjectName = "InspectObjectName"; GuiTextEditCtrl InspectObjectInternalName = "InspectObjectInternalName"; GuiTextCtrl InspectObjectSimID = "InspectObjectSimID"; SimObject obj = InspectObjectName["refObj"]; if (!obj.isObject()) { return; } obj.delete(); // Update inspected object information. InspectFields.inspect("0"); // Update selected object properties InspectObjectName.setValue(""); InspectObjectInternalName.setValue(""); InspectObjectSimID.setValue("0"); }
public void loadNewParticle(SimObject particle) { GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector"; ParticleData PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle"; if (particle.isObject()) { particle = particle.getId().AsString(); } else { particle = PEP_ParticleSelector.getSelected().AsString(); } this.currParticle = particle; particle.call("reload"); PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom(particle); PE_ParticleEditor_NotDirtyParticle["originalName"] = particle.getName(); this.guiSync(); this.setParticleNotDirty(); }
public override void onActivated() { EditorGui EditorGui = "EditorGui"; ForestEditorGui ForestEditorGui = "ForestEditorGui"; ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow"; ForestEditorGui.ForestEditorPalleteWindow ForestEditorPalleteWindow = "ForestEditorPalleteWindow"; ForestEditorGui.ForestEditMeshTree ForestEditMeshTree = "ForestEditMeshTree"; ForestEditorGui.ForestEditBrushTree ForestEditBrushTree = "ForestEditBrushTree"; ForestEditorGui.ForestEditTabBook ForestEditTabBook = "ForestEditTabBook"; SimGroup ForestBrushGroup = "ForestBrushGroup"; SimSet ForestItemDataSet = "ForestItemDataSet"; SimSet ForestTools = "ForestTools"; GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile"; GuiBitmapButtonCtrl ForestEditorPaintModeBtn = "ForestEditorPaintModeBtn"; GuiBitmapButtonCtrl ForestEditorSelectModeBtn = "ForestEditorSelectModeBtn"; GuiBitmapButtonCtrl ForestEditorMoveModeBtn = "ForestEditorMoveModeBtn"; GuiBitmapButtonCtrl ForestEditorRotateModeBtn = "ForestEditorRotateModeBtn"; GuiBitmapButtonCtrl ForestEditorScaleModeBtn = "ForestEditorScaleModeBtn"; GuiBitmapButtonCtrl ForestEditorEraseModeBtn = "ForestEditorEraseModeBtn"; GuiBitmapButtonCtrl ForestEditorEraseSelectedModeBtn = "ForestEditorEraseSelectedModeBtn"; GuiBitmapButtonCtrl ForestEditorDropToGroundModeBtn = "ForestEditorDropToGroundModeBtn"; ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool"); ForestBrushTool BrushTool = ForestTools.FOF("BrushTool"); string mode; //Copyright Winterleaf Entertainment L.L.C. 2013 this["isActive"] = true.AsString(); //Copyright Winterleaf Entertainment L.L.C. 2013 EditorGui.bringToFront(ForestEditorGui); ForestEditorGui.setVisible(true); ForestEditorPalleteWindow.setVisible(true); ForestEditorPropertiesWindow.setVisible(true); ForestEditorGui.makeFirstResponder(true); //ForestEditToolbar.setVisible( true ); this.map.push(); base.onActivated(); ForestEditBrushTree.open(ForestBrushGroup); ForestEditMeshTree.open(ForestItemDataSet); // Open the Brush tab. ForestEditTabBook.selectPage(0); // Sync the pallete button state // And toolbar. SimObject tool = ForestEditorGui.getActiveTool(); if (tool.isObject()) { tool.call("onActivated"); } if (!tool.isObject()) { ForestEditorPaintModeBtn.performClick(); if (ForestEditBrushTree.getItemCount() > 0) { ForestEditBrushTree.selectItem(0, true); } } else if (tool == SelectionTool) { mode = GlobalGizmoProfile["mode"]; switch (mode) { case "None": ForestEditorSelectModeBtn.performClick(); break; case "Move": ForestEditorMoveModeBtn.performClick(); break; case "Rotate": ForestEditorRotateModeBtn.performClick(); break; case "Scale": ForestEditorScaleModeBtn.performClick(); break; } } else if (tool == BrushTool) { mode = BrushTool["mode"]; switch (mode) { case "Paint": ForestEditorPaintModeBtn.performClick(); break; case "Erase": ForestEditorEraseModeBtn.performClick(); break; case "EraseSelected": ForestEditorEraseSelectedModeBtn.performClick(); break; case "DropToGround": ForestEditorDropToGroundModeBtn.performClick(); break; } } if (this["showError"].AsBool()) { messageBox.MessageBoxOK("Error", "Your art/forest folder does not contain a valid brushes.cs. Brushes you create will not be saved!"); } }