예제 #1
0
        public override void onDeactivated()
        {
            DecalEditorGui        DecalEditorGui     = "DecalEditorGui";
            GuiWindowCollapseCtrl DecalPreviewWindow = "DecalPreviewWindow";
            GuiWindowCollapseCtrl DecalEditorWindow  = "DecalEditorWindow";
            GizmoProfile          GlobalGizmoProfile = "GlobalGizmoProfile";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (!this["isActive"].AsBool())
            {
                return;
            }
            this["isActive"] = false.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            DecalEditorGui.setVisible(false);
            DecalPreviewWindow.setVisible(false);
            DecalEditorWindow.setVisible(false);

            this.map.pop();

            // Remember last palette selection
            this["paletteSelection"] = DecalEditorGui.getMode();

            // Restore the previous Gizmo
            // alignment settings.
            GlobalGizmoProfile["alignment"] = this["prevGizmoAlignment"];

            base.onDeactivated();
        }
예제 #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();
        }
예제 #3
0
        public override void onDeactivated()
        {
            GuiMeshRoadEditorCtrl MeshRoadEditorGui           = "MeshRoadEditorGui";
            GuiControl            MeshRoadEditorToolbar       = "MeshRoadEditorToolbar";
            GuiWindowCollapseCtrl MeshRoadEditorOptionsWindow = "MeshRoadEditorOptionsWindow";

            MeshRoadEditorGui.MeshRoadEditorTreeWindow MeshRoadEditorTreeWindow = "MeshRoadEditorTreeWindow";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (!this["isActive"].AsBool())
            {
                return;
            }
            this["isActive"] = false.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            this.writeSettings();

            MeshRoadEditorGui.setVisible(false);
            MeshRoadEditorOptionsWindow.setVisible(false);
            MeshRoadEditorToolbar.setVisible(false);
            MeshRoadEditorTreeWindow.setVisible(false);
            this.map.pop();

            // Restore the previous Gizmo
            // alignment settings.
            GlobalGizmoProfile["alignment"] = this["prevGizmoAlignment"];

            base.onDeactivated();
        }
        public override void onDeactivated()
        {
            RiverEditorGui        RiverEditorGui           = "RiverEditorGui";
            GuiControl            RiverEditorToolbar       = "RiverEditorToolbar";
            GuiWindowCollapseCtrl RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            GuiWindowCollapseCtrl RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            GizmoProfile          GlobalGizmoProfile       = "GlobalGizmoProfile";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (!this["isActive"].AsBool())
            {
                return;
            }
            this["isActive"] = false.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013

            this.writeSettings();

            omni.bGlobal["$River::EditorOpen"] = false;

            RiverEditorGui.setVisible(false);
            RiverEditorToolbar.setVisible(false);
            RiverEditorOptionsWindow.setVisible(false);
            RiverEditorTreeWindow.setVisible(false);
            this.map.pop();

            // Restore the previous Gizmo
            // alignment settings.
            GlobalGizmoProfile["alignment"] = this["prevGizmoAlignment"];

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

            base.onDeactivated();
        }
        public override void onActivated()
        {
            RiverEditorGui        RiverEditorGui           = "RiverEditorGui";
            GuiControl            RiverEditorToolbar       = "RiverEditorToolbar";
            GuiWindowCollapseCtrl RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            GuiWindowCollapseCtrl RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            GuiTreeViewCtrl       RiverTreeView            = "RiverTreeView";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";
            EditorGui    EditorGui          = "EditorGui";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            this["isActive"] = true.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            this.readSettings();

            omni.bGlobal["$River::EditorOpen"] = true;

            ((GuiBitmapButtonCtrl)
             ((GuiDynamicCtrlArrayControl)"ToolsPaletteArray").findObjectByInternalName(
                 "RiverEditorAddRiverMode", false)).performClick();
            EditorGui.bringToFront("RiverEditorGui");

            RiverEditorGui.setVisible(true);
            RiverEditorGui.makeFirstResponder(true);
            RiverEditorToolbar.setVisible(true);

            RiverEditorOptionsWindow.setVisible(true);
            RiverEditorTreeWindow.setVisible(true);

            RiverTreeView.open("ServerRiverSet", true);
            this.map.push();

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

            // The DecalEditor always uses Object alignment.
            GlobalGizmoProfile["alignment"] = "Object";

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

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

            base.onActivated();
        }
        public override void onActivated()
        {
            EditorGui           EditorGui           = "EditorGui";
            MenuBar             menuBar             = EditorGui["menuBar"];
            GuiControl          ConvexEditorToolbar = "ConvexEditorToolbar";
            GuiConvexEditorCtrl ConvexEditorGui     = "ConvexEditorGui";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            this.readSettings();

            EditorGui.bringToFront(ConvexEditorGui);
            ConvexEditorGui.setVisible(true);
            ConvexEditorToolbar.setVisible(true);
            ConvexEditorGui.makeFirstResponder(true);
            this.map.push();

            // Set the status bar here until all tool have been hooked up
            EditorGuiStatusBar.setInfo("Sketch Tool.");
            EditorGuiStatusBar.setSelection("");

            // Add our menu.
            menuBar.insert("ConvexActionsMenu", menuBar["dynamicItemInsertPos"].AsInt());

            // Sync the pallete button state with the gizmo mode.
            string mode = GlobalGizmoProfile["mode"];

            switch (mode)
            {
            case "None":
                ((GuiBitmapButtonCtrl)"ConvexEditorNoneModeBtn").performClick();
                break;

            case "Move":
                ((GuiBitmapButtonCtrl)"ConvexEditorMoveModeBtn").performClick();
                break;

            case "Rotate":
                ((GuiBitmapButtonCtrl)"ConvexEditorRotateModeBtn").performClick();
                break;

            case "Scale":
                ((GuiBitmapButtonCtrl)"ConvexEditorScaleModeBtn").performClick();
                break;
            }

            base.onActivated();
        }
예제 #7
0
        public override void onActivated()
        {
            DecalEditorGui        DecalEditorGui     = "DecalEditorGui";
            EditorGui             EditorGui          = "EditorGui";
            GuiWindowCollapseCtrl DecalPreviewWindow = "DecalPreviewWindow";
            GuiWindowCollapseCtrl DecalEditorWindow  = "DecalEditorWindow";
            GizmoProfile          GlobalGizmoProfile = "GlobalGizmoProfile";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            this["isActive"] = true.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            EditorGui.bringToFront(DecalEditorGui);
            DecalEditorGui.setVisible(true);
            DecalEditorGui.makeFirstResponder(true);
            DecalPreviewWindow.setVisible(true);
            DecalEditorWindow.setVisible(true);

            this.map.push();

            //WORKAROUND: due to the gizmo mode being stored on its profile (which may be shared),
            //  we may end up with a mismatch between the editor mode and gizmo mode here.
            //  Reset mode explicitly here to work around this.
            DecalEditorGui.setMode(DecalEditorGui.getMode());

            // Set the current palette selection
            DecalEditorGui.paletteSync(this["paletteSelection"]);

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

            // The DecalEditor always uses Object alignment.
            GlobalGizmoProfile["alignment"] = "Object";

            DecalEditorGui.rebuildInstanceTree();

            // These could perhaps be the node details like the shape editor
            //ShapeEdPropWindow.syncNodeDetails(-1);

            base.onActivated();
        }
예제 #8
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();
        }
예제 #9
0
        public override void onActivated()
        {
            EditorGui       EditorGui       = "EditorGui";
            ForestEditorGui ForestEditorGui = "ForestEditorGui";

            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui.ForestEditMeshTree           ForestEditMeshTree           = "ForestEditMeshTree";
            ForestEditorGui.ForestEditBrushTree          ForestEditBrushTree          = "ForestEditBrushTree";
            ForestEditorGui.ForestEditTabBook            ForestEditTabBook            = "ForestEditTabBook";
            SimGroup     ForestBrushGroup   = "ForestBrushGroup";
            SimSet       ForestItemDataSet  = "ForestItemDataSet";
            SimSet       ForestTools        = "ForestTools";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            GuiBitmapButtonCtrl ForestEditorPaintModeBtn         = "ForestEditorPaintModeBtn";
            GuiBitmapButtonCtrl ForestEditorSelectModeBtn        = "ForestEditorSelectModeBtn";
            GuiBitmapButtonCtrl ForestEditorMoveModeBtn          = "ForestEditorMoveModeBtn";
            GuiBitmapButtonCtrl ForestEditorRotateModeBtn        = "ForestEditorRotateModeBtn";
            GuiBitmapButtonCtrl ForestEditorScaleModeBtn         = "ForestEditorScaleModeBtn";
            GuiBitmapButtonCtrl ForestEditorEraseModeBtn         = "ForestEditorEraseModeBtn";
            GuiBitmapButtonCtrl ForestEditorEraseSelectedModeBtn = "ForestEditorEraseSelectedModeBtn";
            GuiBitmapButtonCtrl ForestEditorDropToGroundModeBtn  = "ForestEditorDropToGroundModeBtn";

            ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool");
            ForestBrushTool     BrushTool     = ForestTools.FOF("BrushTool");

            string mode;

            //Copyright Winterleaf Entertainment L.L.C. 2013
            this["isActive"] = true.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            EditorGui.bringToFront(ForestEditorGui);
            ForestEditorGui.setVisible(true);
            ForestEditorPalleteWindow.setVisible(true);
            ForestEditorPropertiesWindow.setVisible(true);
            ForestEditorGui.makeFirstResponder(true);
            //ForestEditToolbar.setVisible( true );

            this.map.push();
            base.onActivated();

            ForestEditBrushTree.open(ForestBrushGroup);
            ForestEditMeshTree.open(ForestItemDataSet);

            // Open the Brush tab.
            ForestEditTabBook.selectPage(0);

            // Sync the pallete button state

            // And toolbar.
            SimObject tool = ForestEditorGui.getActiveTool();

            if (tool.isObject())
            {
                tool.call("onActivated");
            }

            if (!tool.isObject())
            {
                ForestEditorPaintModeBtn.performClick();

                if (ForestEditBrushTree.getItemCount() > 0)
                {
                    ForestEditBrushTree.selectItem(0, true);
                }
            }
            else if (tool == SelectionTool)
            {
                mode = GlobalGizmoProfile["mode"];
                switch (mode)
                {
                case "None":
                    ForestEditorSelectModeBtn.performClick();
                    break;

                case "Move":
                    ForestEditorMoveModeBtn.performClick();
                    break;

                case "Rotate":
                    ForestEditorRotateModeBtn.performClick();
                    break;

                case "Scale":
                    ForestEditorScaleModeBtn.performClick();
                    break;
                }
            }
            else if (tool == BrushTool)
            {
                mode = BrushTool["mode"];
                switch (mode)
                {
                case "Paint":
                    ForestEditorPaintModeBtn.performClick();
                    break;

                case "Erase":
                    ForestEditorEraseModeBtn.performClick();
                    break;

                case "EraseSelected":
                    ForestEditorEraseSelectedModeBtn.performClick();
                    break;

                case "DropToGround":
                    ForestEditorDropToGroundModeBtn.performClick();
                    break;
                }
            }

            if (this["showError"].AsBool())
            {
                messageBox.MessageBoxOK("Error",
                                        "Your art/forest folder does not contain a valid brushes.cs. Brushes you create will not be saved!");
            }
        }
예제 #10
0
        public void open(string filename)
        {
            EditorGui             EditorGui             = "EditorGui";
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdAnimWindow     ShapeEdAnimWindow     = "ShapeEdAnimWindow";
            ShapeEditorToolbar    ShapeEditorToolbar    = "ShapeEditorToolbar";

            ShapeEditor.ShapeEdShapeView ShapeEdShapeView = "ShapeEdShapeView";
            ShapeEditor.ShapeEdNodes     ShapeEdNodes     = "ShapeEdNodes";
            Settings     EditorSettings     = "EditorSettings";
            EWorldEditor EWorldEditor       = "EWorldEditor";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            ShapeEditor.ShapeEdShapeTreeView      ShapeEdShapeTreeView = "ShapeEdShapeTreeView";
            ShapeEditor.ShapeEdPreviewGui         ShapeEdPreviewGui    = "ShapeEdPreviewGui";
            ShapeEditorActions.ShapeEdUndoManager ShapeEdUndoManager   = "ShapeEdUndoManager";
            SimGroup MissionGroup = "MissionGroup";
            GuiDynamicCtrlArrayControl ToolsPaletteArray = "ToolsPaletteArray";
            editor Editor = "Editor";

            ShapeEditor.ShapeEdMaterials ShapeEdMaterials = "ShapeEdMaterials";
            ShapeEditor ShapeEditor = "ShapeEditor";

            GuiBitmapButtonCtrl wireframeMode     = ShapeEditorToolbar.FOT("wireframeMode");
            GuiBitmapButtonCtrl showAdvanced      = ShapeEditorToolbar.FOT("showAdvanced");
            GuiIconButtonCtrl   worldTransform    = ShapeEdNodes.FOT("worldTransform");
            GuiIconButtonCtrl   objectTransform   = ShapeEdNodes.FOT("objectTransform");
            GuiCheckBoxCtrl     highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial");
            GuiCanvas           Canvas            = "Canvas";

            if (!this["isActivated"].AsBool())
            {
                // Activate the Shape Editor
                EditorGui.setEditor(this, false);

                // Get editor settings (note the sun angle is not configured in the settings
                // dialog, so apply the settings here instead of in readSettings)
                this.readSettings();
                ShapeEdShapeView["sunAngleX"] = EditorSettings.value("ShapeEditor/SunAngleX");
                ShapeEdShapeView["sunAngleZ"] = EditorSettings.value("ShapeEditor/SunAngleZ");
                EWorldEditor["forceLoadDAE"]  = EditorSettings.value("forceLoadDAE");

                bGlobal["$wasInWireFrameMode"] = bGlobal["$gfx::wireframe"];
                wireframeMode.setStateOn(bGlobal["$gfx::wireframe"]);

                if (GlobalGizmoProfile.getFieldValue("alignment", -1) == "Object")
                {
                    objectTransform.setStateOn(true);
                }
                else
                {
                    worldTransform.setStateOn(true);
                }

                // Initialise and show the shape editor
                ShapeEdShapeTreeView.open(MissionGroup);
                ShapeEdShapeTreeView.buildVisibleTree(true);

                ShapeEdPreviewGui.setVisible(true);
                ShapeEdSelectWindow.setVisible(true);
                ShapeEdPropWindow.setVisible(true);
                ShapeEdAnimWindow.setVisible(true);
                ShapeEdAdvancedWindow.setVisible(showAdvanced.getValue().AsBool());
                ShapeEditorToolbar.setVisible(true);
                EditorGui.bringToFront(ShapeEdPreviewGui);

                ((GuiBitmapButtonCtrl)ToolsPaletteArray.FOT("WorldEditorMove")).performClick();
                this.map.push();

                // Switch to the ShapeEditor UndoManager
                this["oldUndoMgr"] = Editor.getUndoManager();
                Editor.setUndoManager(ShapeEdUndoManager);

                ShapeEdShapeView.setDisplayType(EditorGui["currentDisplayType"].AsInt());
                this.initStatusBar();

                // Customise menu bar
                this["oldCamFitCmd"]      = this.replaceMenuCmd("Camera", "8", "ShapeEdShapeView.fitToShape();");
                this["oldCamFitOrbitCmd"] = this.replaceMenuCmd("Camera", "9", "ShapeEdShapeView.fitToShape();");

                base.onActivated();
            }

            // Select the new shape
            if (ShapeEditor.shape.isObject() && (ShapeEditor.shape["baseShape"] == filename))
            {
                // Shape is already selected => re-highlight the selected material if necessary
                ShapeEdMaterials.updateSelectedMaterial(highlightMaterial.getValue().AsBool());
            }
            else if (filename != "")
            {
                ShapeEditor.selectShape(filename, ShapeEditor.isDirty());

                // 'fitToShape' only works after the GUI has been rendered, so force a repaint first
                Canvas.repaint(0);
                ShapeEdShapeView.fitToShape();
            }
        }