public override void onEditMenuSelect(string editMenu) { SimSet ForestTools = "ForestTools"; ForestEditorGui ForestEditorGui = "ForestEditorGui"; ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool"); bool hasSelection = false; ForestSelectionTool selTool = SelectionTool; if (ForestEditorGui.getActiveTool() == selTool._iID) { if (selTool.getSelectionCount() > 0) { hasSelection = true; } } ((PopupMenu)editMenu).enableItem(3, hasSelection); // Cut ((PopupMenu)editMenu).enableItem(4, hasSelection); // Copy ((PopupMenu)editMenu).enableItem(5, hasSelection); // Paste ((PopupMenu)editMenu).enableItem(6, hasSelection); // Delete ((PopupMenu)editMenu).enableItem(8, hasSelection); // Deselect }
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 static void initializeForestEditor() { Omni.self.Print(" % - Initializing Forest Editor"); gui.ForestEditor.initialize(); ForestEditorGui.initialize(); ForestEditToolbar.initialize(); ((ForestEditorGui)"ForestEditorGui").setVisible(false); ((GuiWindowCollapseCtrl)"ForestEditorPalleteWindow").setVisible(false); ((GuiWindowCollapseCtrl)"ForestEditorPropertiesWindow").setVisible(false); ((ForestEditToolbar)"ForestEditToolbar").setVisible(false); EditorGui EditorGui = "EditorGui"; EditorGui.add("ForestEditorGui"); EditorGui.add("ForestEditorPalleteWindow"); EditorGui.add("ForestEditorPropertiesWindow"); EditorGui.add("ForestEditToolbar"); ObjectCreator oc = new ObjectCreator("ScriptObject", "ForestEditorPlugin", typeof(ForestEditorPlugin)); oc["editorGui"] = "ForestEditorGui"; oc.Create(); ((ForestEditorPlugin)"ForestEditorPlugin").initialize(); }
public override bool isDirty() { ForestEditorGui ForestEditorGui = "ForestEditorGui"; bool dirty = this["dirty"].AsBool() || ForestEditorGui.isDirty(); return(dirty); }
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!"); } }