public void onInspectorPostFieldModification() { GuiEditorProfilesTree GuiEditorProfilesTree = "GuiEditorProfilesTree"; GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager"; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; ProfilePane ProfilePane = "ProfilePane"; UndoAction action = this.currentFieldEditAction; SimObject objectx = action["objectId"]; string fieldName = action["fieldName"]; string arrayIndex = action["arrayIndex"]; string oldValue = action["fieldValue"]; string newValue = objectx.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt()); // If it's the name field, make sure to sync up the treeview. if (action["fieldName"] == "name") { GuiEditorProfilesTree.onProfileRenamed(objectx, newValue); } ProfilePane.onProfileSelected(); // Add change record. GuiEditorProfileChangeManager.registerEdit(objectx, fieldName, arrayIndex, oldValue); this.currentFieldEditAction.addToManager(ProfilePane.getUndoManager()); this.currentFieldEditAction = ""; //GuiEditor.updateUndoMenu(); GuiEditor.setProfileDirty(objectx, true, false); }
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 void updateEmitter(string propertyField, string value, bool isSlider, bool onMouseUp) { ParticleEditor ParticleEditor = "ParticleEditor"; editor Editor = "Editor"; this.setEmitterDirty(); SimObject emitter = this.currEmitter; SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"]).AsBool() && (!last["onMouseUp"].AsBool())) { last["field"] = propertyField; last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValue"] = value; } else { ParticleEditorUndo.ActionUpdateActiveEmitter action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitter>("Update Active Emitter"); action["emitter"] = emitter; action["field"] = propertyField; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValue"] = value; action["oldValue"] = emitter.getFieldValue(propertyField, -1); ParticleEditor.submitUndo(action); } emitter.setFieldValue(propertyField, value, -1); emitter.call("reload"); }
public void updateParticle(string propertyField, string value, bool isSlider, bool onMouseUp) { editor Editor = "Editor"; ParticleEditor ParticleEditor = "ParticleEditor"; this.setParticleDirty(); SimObject particle = this.currParticle; SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool())) { last["field"] = propertyField; last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValue"] = value; } else { var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveParticle>("Update Active Particle"); action["particle"] = particle; action["field"] = propertyField; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValue"] = value; action["oldValue"] = particle.getFieldValue(propertyField, -1); ParticleEditor.submitUndo(action); } particle.setFieldValue(propertyField, value, -1); particle.call("reload"); }
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 T this[int index] { get { //if (_OwnerObject.IsDead()) throw new Exceptions.SimObjectPointerInvalidException(); if (index >= _Count) { throw new IndexOutOfRangeException(); } return(_GetterFunction(_OwnerObject.getFieldValue(_FieldName, index))); } set { //if (_OwnerObject.IsDead()) throw new Exceptions.SimObjectPointerInvalidException(); if (index >= _Count) { throw new IndexOutOfRangeException(); } _OwnerObject.setFieldValue(_FieldName, _SetterFunction(value), index); } }