public void onInspectorPreFieldModification(string fieldName, string arrayIndex) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; Util.pushInstantGroup(); //UndoManager undoManager = GuiEditor.getUndoManager(); SimObject objectx = this.getInspectObject(); string nameOrClass = objectx.getName(); if (nameOrClass == "") { nameOrClass = objectx.getClassName(); } ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = objectx.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = objectx.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt()); oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction action = oc.Create(); this.currentFieldEditAction = action; Util.popInstantGroup(); }
public static string GE_ScanGroupForGuis(string group, string text) { int count = ((SimSet)group).getCount(); for (uint i = 0; i < count; i++) { SimObject obj = ((SimSet)group).getObject(i); if (obj.getClassName() == "GuiCanvas") { text = text + GE_ScanGroupForGuis(obj, text); } else { string name = ""; if (obj.getName() == "") { name = "(unnamed) - " + obj; } else { name = obj.getName() + " - " + obj; } text = text + "<a:gamelink:" + obj + ">" + name + "</a><br>"; } } return(text); }
public void show(int matIndex, string terrMat, string onApplyCallback) { ((GuiCanvas)"Canvas").pushDialog(this); this.matIndex = matIndex; this.onApplyCallback = onApplyCallback; GuiTreeViewCtrl matLibTree = this.findObjectByInternalName("matLibTree", true); int item = matLibTree.findItemByObjectId(terrMat.AsInt()); if (item != -1) { matLibTree.selectItem(item); matLibTree.scrollVisible(item); } else { for (int i = 1; i < matLibTree.getItemCount(); i++) { SimObject oterrMat = matLibTree.getItemValue(i); if (oterrMat.getClassName() == "TerrainMaterial") { matLibTree.selectItem(i, true); matLibTree.scrollVisible(i); break; } } } }
public void addShapeIcon(SimObject datablock) { GuiIconButtonCtrl ctrl = this.createIcon(); string name = datablock.getName(); string className = datablock.getClassName(); string cmd = className + "::create(" + name + ");"; string shapePath = (datablock["shapeFile"] != "") ? datablock["shapeFile"] : datablock["shapeName"]; string createCmd = "EWCreatorWindow.createObject( \\\"" + cmd + "\\\" );"; ctrl.altCommand = "ColladaImportDlg.showDialog( \"" + shapePath + "\", \"" + createCmd + "\" );"; ctrl.iconBitmap = console.Call_Classname("EditorIconRegistry", "findIconByClassName", new string[] { className }); ctrl.text = name; //ctrl["class"] = "CreatorShapeIconBtn"; ctrl.tooltip = name; ctrl.buttonType = "RadioButton"; ctrl.groupNum = -1; this.contentCtrl.addGuiControl(ctrl); }
public void initFilterList(string selectFilter) { GuiPopUpMenuCtrl SFXParameterFilter = this.FOT("SFXParameterFilter"); SimSet SFXParameterGroup = "SFXParameterGroup"; GuiPopUpMenuCtrl filterList = SFXParameterFilter; filterList.clear(); filterList.add("", 0); for (uint i = 0; i < SFXParameterGroup.getCount(); i++) { SimObject obj = SFXParameterGroup.getObject(i); if (!Util.isMemberOfClass(obj.getClassName(), "SFXParameter")) { continue; } for (int idx = 0; obj["categories[" + idx + "]"] != ""; idx++) { string category = obj["categories[" + idx + "]"]; if (filterList.findText(category) == -1) { filterList.add(category, filterList.size()); } } } // Sort the filters. filterList.sort(); filterList.setSelected(filterList.findText(selectFilter), false); }
public override void onAction() { // NOTE: Though this is a GuiControl which exists on the client-side // we access and modify the server-side TimeOfDay object. This is acceptible // because this is a "tools" gui which is not intended for a real-game // or multiplayer situation. if (!this["tod"].isObject()) { if ("MissionGroup".isObject()) { SimSet MissionGroup = "MissionGroup"; for (uint i = 0; i < MissionGroup.getCount(); i++) { SimObject obj = MissionGroup.getObject(i); if (obj.getClassName() == "TimeOfDay") { this["tod"] = obj; break; } } } } if (!this["tod"].isObject()) { return; } TimeOfDay tod = this["tod"]; tod.time = this.getValue(); }
public void scanGroup(SimSet group) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; for (uint i = 0; i < group.getCount(); i++) { SimObject obj = group.getObject(i); if (obj.isMemberOfClass("GuiControl")) { if (obj.getClassName() == "GuiCanvas") { this.scanGroup((GuiCanvas)obj); } else { string name; if (obj.getName() == "") { name = "(unnamed) - " + obj; } else { name = obj.getName() + " - " + obj; } bool skip = false; foreach (string guiEntry in sGlobal["$GuiEditor::GuiFilterList"].Split('\t')) { if (obj.getName() == guiEntry) { skip = true; break; } } if (!skip) { this.add(name, obj); } } } else if (obj.isMemberOfClass("SimGroup") && ( //(%obj.internalName !$= "EditorGuiGroup" /* Copyright (C) 2013 WinterLeaf Entertainment LLC. */&& %obj.internalName !$= "IngameGuiGroup" ) // Don't put our editor's GUIs in the list /*||*/ GuiEditor["showEditorGuis"].AsBool())) // except if explicitly requested. { // Scan nested SimGroups for GuiControls. this.scanGroup((SimGroup)obj); } } }
public override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue) { SimObject obj = objectx; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; GuiEditorProfilesTree GuiEditorProfilesTree = "GuiEditorProfilesTree"; GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager"; ProfilePane ProfilePane = "ProfilePane"; GuiEditor.setProfileDirty(obj, true, false); // If it's the name field, make sure to sync up the treeview. if (fieldName == "name") { GuiEditorProfilesTree.onProfileRenamed(obj, newValue); } // Add change record. //GuiEditorProfileChangeManager.registerEdit(obj, fieldName, oldValue); GuiEditorProfileChangeManager.registerEdit(obj, fieldName, arrayIndex, oldValue); // Add undo. Util.pushInstantGroup(); string nameOrClass = obj.getName(); if (nameOrClass == "") { nameOrClass = obj.getClassName(); } ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = obj.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = oldValue; oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction action = oc.Create(); Util.popInstantGroup(); action.addToManager(ProfilePane.getUndoManager()); //GuiEditor.updateUndoMenu(); }
public override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue) { SimObject obj = objectx; editor Editor = "Editor"; // The instant group will try to add our // UndoAction if we don't disable it. Util.pushInstantGroup(); string nameOrClass = obj.getName(); if (nameOrClass == "") { nameOrClass = obj.getClassName(); } ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = obj.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = oldValue; oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction action = oc.Create(); // If it's a datablock, initiate a retransmit. Don't do so // immediately so as the actual field value will only be set // by the inspector code after this method has returned. if (obj.isMemberOfClass("SimDataBlock")) { obj.schedule("1", "reloadOnLocalClient"); } // Restore the instant group. Util.popInstantGroup(); action.addToManager(Editor.getUndoManager()); EWorldEditor EWorldEditor = "EWorldEditor"; EWorldEditor.isDirty = true; // Update the selection if (EWorldEditor.getSelectionSize() > 0 && (fieldName == "position" || fieldName == "rotation" || fieldName == "scale")) { EWorldEditor.invalidateSelectionCentroid(); } }
public void onInspectorPreFieldModification(string fieldName, string arrayIndex) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; Util.pushInstantGroup(); UndoManager undoManager = GuiEditor.getUndoManager(); string action = ""; int numObjects = this.getNumInspectObjects(); if (numObjects > 1) { action = undoManager.pushCompound("Multiple Field Edit"); } for (uint i = 0; i < numObjects; i++) { SimObject obj = this.getInspectObject(i); string nameOrClass = obj.getName(); if (nameOrClass == "") { nameOrClass = obj.getClassName(); } ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = obj.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = obj.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt()); oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction undo = oc.Create(); if (numObjects > 1) { undo.addToManager(undoManager); } else { action = undo; break; } } this.currentFieldEditAction = action; Util.popInstantGroup(); }
public void createDatablock() { GuiTreeViewCtrl DatablockEditorTypeTree = "DatablockEditorTypeTree"; GuiControl DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt"; string className = DatablockEditorTypeTree.getItemText(DatablockEditorTypeTree.getSelectedItem()); if (className != "") { // Need to prompt for a name. ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true)) .setText("Name"); ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true)) .selectAllText(); // Populate the copy source dropdown. GuiPopUpMenuCtrl list = DatablockEditorCreatePrompt.findObjectByInternalName("CopySourceDropdown", true); list.clear(); list.add("", 0); SimSet set = "DataBlockSet"; int count = set.getCount(); for (uint i = 0; i < count; i++) { SimObject datablock = set.getObject(i); string datablockClass = datablock.getClassName(); if (!Util.isMemberOfClass(datablockClass, className)) { continue; } list.add(datablock.getName(), ((int)i + 1)); } // Set up state of client-side checkbox. GuiCheckBoxCtrl clientSideCheckBox = DatablockEditorCreatePrompt.findObjectByInternalName("ClientSideCheckBox", true); bool canBeClientSide = this.canBeClientSideDatablock(className); clientSideCheckBox.setStateOn(canBeClientSide); clientSideCheckBox.setActive(canBeClientSide); // Show the dialog. ((GuiCanvas)"canvas").pushDialog(DatablockEditorCreatePrompt, 0, true); } }
public virtual bool objectMatchesCriteria(SimObject obj) { if (this["namePattern"] != "" && !Util.strIsMatchExpr(this["NamePattern"], obj.getName(), false)) { return(false); } // Check class. if (!isClassEnabled(obj.getClassName())) { return(false); } return(true); }
public void initList(string filter) { GuiStackControl SFXParametersStack = this.FOT("SFXParametersStack"); SimSet SFXParameterGroup = "SFXParameterGroup"; // Clear the current lists. SFXParametersStack.clear(); // Add each SFXParameter in SFXParameterGroup. for (uint i = 0; i < SFXParameterGroup.getCount(); i++) { SimObject obj = SFXParameterGroup.getObject(i); if (!Util.isMemberOfClass(obj.getClassName(), "SFXParameter")) { continue; } // If we have a filter, search for it in the parameter's // categories. bool matchesFilter = true; if (filter != "") { matchesFilter = false; for (int idx = 0; obj["categories[" + idx + "]"] != ""; idx++) { if (obj["categories[" + idx + "]"] == filter) { matchesFilter = true; break; } } } if (matchesFilter) { this.addParameter((SFXParameter)obj); } } // Init the filters. this.initFilterList(filter); }
public bool isValidDragTarget(int id, SimObject obj) { EWorldEditor EWorldEditor = "EWorldEditor"; if (obj.isMemberOfClass("Path")) { return(EWorldEditor.areAllSelectedObjectsOfType("Marker")); } if (obj.name == "CameraBookmarks") { return(EWorldEditor.areAllSelectedObjectsOfType("CameraBookmark")); } else { return(obj.getClassName() == "SimGroup"); } }
public int addExistingItem(SimObject datablock, bool dontSort) { GuiTreeViewCtrl tree = "DatablockEditorTree"; // Look up class at root level. Create if needed. string className = datablock.getClassName(); int parentID = tree.findItemByName(className); if (parentID == 0) { parentID = tree.insertItem(0, className, "", "", 0, 0); } // If the datablock is already there, don't // do anything. if (tree.findItemByValue(datablock.getId().AsString()).AsBool()) { return(0); } // It doesn't exist so add it. string name = datablock.getName(); if (this.PM.isDirty(datablock)) { name = name + " *"; } int id = tree.insertItem(parentID, name, datablock.getId().AsString(), "", 0, 0); if (!dontSort) { tree.sort(parentID, false, false, false); } return(id); }
public override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue) { SimObject obj = objectx; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; // The instant group will try to add our // UndoAction if we don't disable it. Util.pushInstantGroup(); string nameOrClass = obj.getName(); if (nameOrClass == "") { nameOrClass = obj.getClassName(); } ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = obj.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = oldValue; oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction action = oc.Create(); // Restore the instant group. Util.popInstantGroup(); action.addToManager(GuiEditor.getUndoManager()); GuiEditor.updateUndoMenu(); }