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 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 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 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(); }