Esempio n. 1
0
        public override void handleDelete()
        {
            NavEditorGui NavEditorGui = "NavEditorGui";

            // Event happens when the user hits 'delete'.
            NavEditorGui.deleteSelected();
        }
Esempio n. 2
0
        public override void onDeactivated()
        {
            writeSettings();

            bGlobal["$Nav::EditorOpen"] = false;

            NavEditorGui          NavEditorGui           = "NavEditorGui";
            GuiWindowCollapseCtrl NavEditorOptionsWindow = "NavEditorOptionsWindow";
            GuiWindowCollapseCtrl NavEditorTreeWindow    = "NavEditorTreeWindow";
            GuiControl            NavEditorToolbar       = "NavEditorToolbar";
            GizmoProfile          GlobalGizmoProfile     = "GlobalGizmoProfile";

            NavEditorGui.setVisible(false);
            NavEditorToolbar.setVisible(false);
            NavEditorOptionsWindow.setVisible(false);
            NavEditorTreeWindow.setVisible(false);
            map.pop();

            // Restore the previous Gizmo alignment settings.
            GlobalGizmoProfile.alignment = prevGizmoAlignment;

            // Allow the Gui to cleanup.
            NavEditorGui.onEditorDeactivated();

            base.onDeactivated();
        }
Esempio n. 3
0
        public override void onSaveMission(string missionFile)
        {
            NavEditorGui NavEditorGui = "NavEditorGui";

            if (NavEditorGui.isDirty)
            {
                SimGroup MissionGroup = "MissionGroup";
                MissionGroup.save(missionFile);
                NavEditorGui.isDirty = false;
            }
        }
Esempio n. 4
0
        public void writeSettings()
        {
            Settings     EditorSettings = "EditorSettings";
            NavEditorGui NavEditorGui   = "NavEditorGui";

            EditorSettings.beginGroup("NavEditor", true);

            EditorSettings.setValue("SpawnClass", NavEditorGui.spawnClass);
            EditorSettings.setValue("SpawnDatablock", NavEditorGui.spawnDatablock);

            EditorSettings.endGroup();
        }
Esempio n. 5
0
        public void readSettings()
        {
            Settings     EditorSettings = "EditorSettings";
            NavEditorGui NavEditorGui   = "NavEditorGui";

            EditorSettings.beginGroup("NavEditor", true);

            NavEditorGui.spawnClass     = EditorSettings.value("SpawnClass");
            NavEditorGui.spawnDatablock = EditorSettings.value("SpawnDatablock");

            EditorSettings.endGroup();
        }
        public void create()
        {
            GuiTextEditCtrl MeshName          = FOT("MeshName");
            GuiCheckBoxCtrl MeshMissionBounds = FOT("MeshMissionBounds");
            string          name = MeshName.getText();

            if (name == "" || Util.nameToID(name) > 0)
            {
                messageBox.MessageBoxOK("Error", "A NavMesh must have a unique name!");
                return;
            }

            NavMesh mesh = "0";

            SimSet MissionGroup = "MissionGroup";

            if (MeshMissionBounds.isStateOn())
            {
                if (!Util.isObject(MissionGroup))
                {
                    messageBox.MessageBoxOK("Error", "You must have a MissionGroup to use the mission bounds function.");
                    return;
                }
                // Get maximum extents of all objects.
                string  box   = MissionBoundsExtents(MissionGroup);
                Point3F pos   = Util.getBoxCenter(box.AsBox3F());
                string  scale = (Util.getWord(box, 3).AsInt() - Util.getWord(box, 0).AsInt()) / 2 + 5
                                + " " + (Util.getWord(box, 4).AsInt() - Util.getWord(box, 1).AsInt()) / 2 + 5
                                + " " + (Util.getWord(box, 5).AsInt() - Util.getWord(box, 2).AsInt()) / 2 + 5;

                var oc = new ObjectCreator("NavMesh", name);
                oc["position"] = pos;
                oc["scale"]    = scale;
                mesh           = oc.Create();
            }
            else
            {
                GuiTextEditCtrl MeshPosition = FOT("MeshPosition");
                GuiTextEditCtrl MeshScale    = FOT("MeshScale");

                var oc = new ObjectCreator("NavMesh", name);
                oc["position"] = MeshPosition.getText();
                oc["scale"]    = MeshScale.getText();
                mesh           = oc.Create();
            }
            MissionGroup.add(mesh);
            NavEditorGui NavEditorGui = "NavEditorGui";
            canvas       Canvas       = "Canvas";

            NavEditorGui.selectObject(mesh);

            Canvas.popDialog(this);
        }
Esempio n. 7
0
        public override void onActivated()
        {
            readSettings();

            // Set a global variable so everyone knows we're editing!
            bGlobal["$Nav::EditorOpen"] = true;

            // Start off in Select mode.
            GuiDynamicCtrlArrayControl ToolsPaletteArray   = "ToolsPaletteArray";
            GuiBitmapButtonCtrl        NavEditorSelectMode = ToolsPaletteArray.FOT("NavEditorSelectMode");

            NavEditorSelectMode.performClick();

            EditorGui    EditorGui    = "EditorGui";
            NavEditorGui NavEditorGui = "NavEditorGui";

            EditorGui.bringToFront(NavEditorGui);

            NavEditorGui.setVisible(true);
            NavEditorGui.makeFirstResponder(true);
            GuiControl NavEditorToolbar = "NavEditorToolbar";

            NavEditorToolbar.setVisible(true);

            GuiWindowCollapseCtrl NavEditorOptionsWindow = "NavEditorOptionsWindow";
            GuiWindowCollapseCtrl NavEditorTreeWindow    = "NavEditorTreeWindow";

            NavEditorOptionsWindow.setVisible(true);
            NavEditorTreeWindow.setVisible(true);

            // Inspect the ServerNavMeshSet, which contains all the NavMesh objects
            // in the mission.
            SimSet ServerNavMeshSet = "ServerNavMeshSet";

            if (!Util.isObject(ServerNavMeshSet))
            {
                ServerNavMeshSet = new ObjectCreator("SimSet", "ServerNavMeshSet").Create();
            }
            if (ServerNavMeshSet.getCount() == 0)
            {
                messageBox.MessageBoxYesNo("No NavMesh",
                                           "There is no NavMesh in this level. Would you like to create one?" + " " +
                                           "If not, please use the World Editor to create a new NavMesh.",
                                           "Canvas.pushDialog(CreateNewNavMeshDlg);");
            }
            NavTreeView NavTreeView = "NavTreeView";

            NavTreeView.open(ServerNavMeshSet, true);

            // Push our keybindings to the top. (See initializeNavEditor for where this
            // map was created.)
            map.push();

            // Store this on a dynamic field
            // in order to restore whatever setting
            // the user had before.
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            prevGizmoAlignment = GlobalGizmoProfile.alignment;

            // Always use Object alignment.
            GlobalGizmoProfile.alignment = "Object";

            // Set the status bar here until all tool have been hooked up
            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            EditorGuiStatusBar.setInfo("Navigation editor.");
            EditorGuiStatusBar.setSelection("");

            // Allow the Gui to setup.
            NavEditorGui.onEditorActivated();

            base.onActivated();
        }
Esempio n. 8
0
        public override bool isDirty()
        {
            NavEditorGui NavEditorGui = "NavEditorGui";

            return(NavEditorGui.isDirty);
        }
Esempio n. 9
0
        public override bool handleEscape()
        {
            NavEditorGui NavEditorGui = "NavEditorGui";

            return(NavEditorGui.onEscapePressed());
        }
Esempio n. 10
0
        public static void initializeNavEditor()
        {
            omni.Util._echo(" % - Initializing Navigation Editor");

            omni.iGlobal["$Nav::WalkFlag"]     = 1 << 0;
            omni.iGlobal["$Nav::SwimFlag"]     = 1 << 1;
            omni.iGlobal["$Nav::JumpFlag"]     = 1 << 2;
            omni.iGlobal["$Nav::LedgeFlag"]    = 1 << 3;
            omni.iGlobal["$Nav::DropFlag"]     = 1 << 4;
            omni.iGlobal["$Nav::ClimbFlag"]    = 1 << 5;
            omni.iGlobal["$Nav::TeleportFlag"] = 1 << 6;

            // Execute all relevant scripts and GUIs.
            //exec("./NavEditor.cs");
            NavEditorProfiles.initialize();
            //exec("./NavEditorGui.gui");
            gui.NavEditorGui.initialize();
            //exec("./NavEditorToolbar.gui");
            gui.NavEditorToolbar.initialize();
            //exec("./NavEditorGui.cs");
            //exec("./NavEditorAboutDlg.gui");
            NavEditorAboutDlg.initialize();
            //exec("./NavEditorConsoleDlg.gui");
            gui.NavEditorConsoleDlg.initialize();
            //exec("./CreateNewNavMeshDlg.gui");
            CreateNewNavMeshDlg.initialize();

            // Add ourselves to EditorGui, where all the other tools reside
            NavEditorGui          NavEditorGui           = "NavEditorGui";
            GuiControl            NavEditorToolbar       = "NavEditorToolbar";
            GuiWindowCollapseCtrl NavEditorOptionsWindow = "NavEditorOptionsWindow";
            GuiWindowCollapseCtrl NavEditorTreeWindow    = "NavEditorTreeWindow";
            GuiWindowCtrl         NavEditorConsoleDlg    = "NavEditorConsoleDlg";

            NavEditorGui.setVisible(false);
            NavEditorToolbar.setVisible(false);
            NavEditorOptionsWindow.setVisible(false);
            NavEditorTreeWindow.setVisible(false);
            NavEditorConsoleDlg.setVisible(false);

            EditorGui EditorGui = "EditorGui";

            EditorGui.add(NavEditorGui);
            EditorGui.add(NavEditorToolbar);
            EditorGui.add(NavEditorOptionsWindow);
            EditorGui.add(NavEditorTreeWindow);
            EditorGui.add(NavEditorConsoleDlg);

            ObjectCreator oc = new ObjectCreator("ScriptObject", "NavEditorPlugin", typeof(NavEditorPlugin));

            oc["editorGui"] = NavEditorGui;
            oc.Create();

            // Bind shortcuts for the nav editor.
            ActionMap map = new ObjectCreator("ActionMap").Create();

            map.bindCmd("keyboard", "1", "ENavEditorSelectModeBtn.performClick();", "");
            map.bindCmd("keyboard", "2", "ENavEditorLinkModeBtn.performClick();", "");
            map.bindCmd("keyboard", "3", "ENavEditorCoverModeBtn.performClick();", "");
            map.bindCmd("keyboard", "4", "ENavEditorTileModeBtn.performClick();", "");
            map.bindCmd("keyboard", "5", "ENavEditorTestModeBtn.performClick();", "");
            map.bindCmd("keyboard", "c", "NavEditorConsoleBtn.performClick();", "");
            NavEditorPlugin NavEditorPlugin = "NavEditorPlugin";

            NavEditorPlugin.map = map;

            NavEditorPlugin.initSettings();
        }