예제 #1
0
        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();
            }
        }