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 void setNewObjectGroup(string group) { EditorTree EditorTree = "EditorTree"; if (this.objectGroup != 0) { int oldItemId = EditorTree.findItemByObjectId(this.objectGroup); if (oldItemId > 0) { EditorTree.markItem(oldItemId, false); } } //group = group.getID().AsString(); if (group != "-1") { this.objectGroup = group; int itemId = EditorTree.findItemByObjectId(group.AsInt()); EditorTree.markItem(itemId); } }
public override void onSelectObjects(bool val, bool reuseExistingSet = false) { string sel = ""; // See if we should create an independent selection set. GuiCheckBoxCtrl createSelectionSet = this.findObjectByInternalName("createSelectionSet", true); if (createSelectionSet.isStateOn()) { string sname = ((GuiTextEditCtrl)this.findObjectByInternalName("selectionSetName", true)).getText(); // See if we should create or re-use a set. if (sname.isObject()) { SimObject name = sname; if (name.isMemberOfClass("WorldEditorSelection")) { messageBox.MessageBoxOK("Error", "An object called '" + name + "' already exists and is not a selection. Please choose a different name."); return; } else if (!reuseExistingSet) { messageBox.MessageBoxYesNo("Question", "A selection called '" + name + "' already exists. Modify the existing selection?", this + ".onSelectObjects( " + val + ", true );", ""); return; } else { sel = name; } } else { editor Editor = "Editor"; if (!Editor.validateObjectName(name, false)) { return; } // Create a new selection set. sel = console.Eval("%sel = new WorldEditorSelection( " + name + " ) { parentGroup = Selections; canSave = true; };return sel;", true); if (!sel.isObject()) { messageBox.MessageBoxOK("Error", "Could not create the selection set. Please look at the console.log for details."); return; } } this["selectionSet"] = sel; } else { this["selectionSet"] = ""; } base.onSelectObjects(val, false); // Refresh editor tree just in case. EditorTree EditorTree = "EditorTree"; EditorTree.buildVisibleTree(); }