예제 #1
0
        public void onInspectorPostFieldModification()
        {
            editor Editor = "Editor";

            if (currentFieldEditAction.isMemberOfClass("CompoundUndoAction"))
            {
                Editor.getUndoManager().popCompound();
            }
            else
            {
                currentFieldEditAction.addToManager(Editor.getUndoManager());
            }

            currentFieldEditAction = "";

            ((EWorldEditor)"EWorldEditor").isDirty = true;
        }
예제 #2
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();
            }
        }
예제 #3
0
        public void onInspectorPreFieldModification(string fieldName, string arrayIndex)
        {
            Util.pushInstantGroup();
            editor Editor = "Editor";

            UndoManager undoManager = Editor.getUndoManager();

            int numOfObjects = this.getNumInspectObjects();

            UndoAction action = "0";

            if (numOfObjects > 1)
            {
                action = undoManager.pushCompound("Multiple Field Edit");
            }

            for (uint i = 0; i < numOfObjects; i++)
            {
                SimObject obj = 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 (numOfObjects > 1)
                {
                    undo.addToManager(undoManager);
                }
                else
                {
                    action = undo;
                    break;
                }
            }
            this["currentFieldEditAction"] = action;
            Util.popInstantGroup();
        }
예제 #4
0
        public void onInspectorDiscardFieldModification()
        {
            editor Editor = "Editor";

            currentFieldEditAction.undo();

            if (currentFieldEditAction.isMemberOfClass("CompoundUndoAction"))
            {
                Editor.getUndoManager().popCompound(true);
            }
            else
            {
                currentFieldEditAction.delete();
            }

            this.currentFieldEditAction = "";
        }
예제 #5
0
        public virtual void onCancelCompoundEdit()
        {
            editor Editor = "Editor";

            Editor.getUndoManager().popCompound(true);
        }
예제 #6
0
        public override void onEndCompoundEdit()
        {
            editor Editor = "Editor";

            Editor.getUndoManager().popCompound();
        }
예제 #7
0
        public override void onBeginCompoundEdit()
        {
            editor Editor = "Editor";

            Editor.getUndoManager().pushCompound("Multiple Field Edit");
        }
예제 #8
0
        public static void toggleEditor(bool make)
        {
            if (((GuiCanvas)"Canvas").isFullscreen())
            {
                messageBox.MessageBoxOK("Windowed Mode Required", "Please switch to windowed mode to access the Mission Editor.");
                return;
            }
            editor editor = "editor";

            if (make)
            {
                string timerID = omni.console.Call("startPrecisionTimer");
                if (omni.bGlobal["$InGuiEditor"])
                {
                    //omni.console.Call("GuiEdit");
                    GuiEditorGui.GuiEdit("");
                }

                if (!omni.bGlobal["$missionRunning"])
                {
                    // Flag saying, when level is chosen, launch it with the editor open.
                    ((GuiControl)"ChooseLevelDlg")["launchInEditor"] = true.AsString();
                    //((GuiCanvas) "canvas").pushDialog("ChooseLevelDlg");
                    MenuHandlers.EditorNewLevel("");
                }
                else
                {
                    omni.Util.pushInstantGroup();
                    if (!"Editor".isObject())
                    {
                        create();

                        ((SimGroup)"MissionCleanup").add(editor);
                        ((SimGroup)"MissionCleanup").add(editor.getUndoManager());
                    }

                    if (Extendable.GuiCanvas.EditorIsActive())
                    {
                        if (((LevelInfo)"theLevelInfo")["Type"] == "DemoScene")
                        {
                            omni.console.commandToServer("dropPlayerAtCamera");
                            editor.close("SceneGui");
                        }
                        else
                        {
                            editor.close("PlayGui");
                        }
                    }
                    else
                    {
                        if (!omni.bGlobal["$GuiEditorBtnPressed"])
                        {
                            ((GuiCanvas)"Canvas").pushDialog("EditorLoadingGui");
                            ((GuiCanvas)"Canvas").repaint(0);
                        }
                        else
                        {
                            omni.bGlobal["$GuiEditorBtnPressed"] = false;
                        }

                        editor.open();

                        // Cancel the scheduled event to prevent
                        // the level from cycling after it's duration
                        // has elapsed.

                        omni.Util.cancel(omni.iGlobal["$Game::Schedule"]);

                        if (((LevelInfo)"theLevelInfo")["type"] == "DemoScene")
                        {
                            omni.console.commandToServer("dropCameraAtPlayer", new string[] { "true" });
                        }

                        ((GuiCanvas)"Canvas").popDialog("EditorLoadingGui");
                    }

                    omni.Util.popInstantGroup();
                }

                string elapsed = omni.console.Call("stopPrecisionTimer", new string[] { timerID });

                omni.Util._warn("Time spent in toggleEditor() : " + (elapsed.AsFloat() / 1000.0) + " s");
            }
        }