Exemple #1
0
        public override void onDeactivated()
        {
            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui    ForestEditorGui   = "ForestEditorGui";
            PersistenceManager ForestDataManager = "ForestDataManager";

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

            SimObject tool = ForestEditorGui.getActiveTool();

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

            // Also take this opportunity to save.
            ForestDataManager.saveDirty();

            this.map.pop();

            base.onDeactivated();
        }
Exemple #2
0
        public override void onWorldEditorStartup()
        {
            ForestEditorGui.ForestEditBrushTree ForestEditBrushTree = "ForestEditBrushTree";
            SimSet ForestItemDataSet = "ForestItemDataSet";

            ForestEditorGui.ForestEditMeshTree ForestEditMeshTree = "ForestEditMeshTree";
            EditorGui EditorGui = "EditorGui";

            ForestEditorGui.ForestEditTabBook            ForestEditTabBook            = "ForestEditTabBook";
            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";

            new ObjectCreator("PersistenceManager", "ForestDataManager").Create();

            const string brushPath = "art/forest/brushes.cs";

            if (!Util.isFile(brushPath))
            {
                Util.createPath(brushPath);
            }

            // This creates the ForestBrushGroup, all brushes, and elements.
            Util.exec(brushPath, false, false);

            SimGroup ForestBrushGroup = "ForestBrushGroup";

            if (!ForestBrushGroup.isObject())
            {
                ForestBrushGroup  = new ObjectCreator("SimGroup", "ForestBrushGroup").Create();
                this["showError"] = true.AsString();
            }

            ForestEditBrushTree.open(ForestBrushGroup);

            if (!ForestItemDataSet.isObject())
            {
                ForestItemDataSet = new ObjectCreator("SimSet", "ForestItemDataSet").Create();
            }

            ForestEditMeshTree.open(ForestItemDataSet);

            // Add ourselves to the window menu.
            string accel = EditorGui.addToEditorsMenu("Forest Editor", "", this);

            // Add ourselves to the tools menu.
            string tooltip = "Forest Editor (" + accel + ")";

            EditorGui.addToToolsToolbar("ForestEditorPlugin", "ForestEditorPalette",
                                        Util._expandFilename("tools/forestEditor/images/forest-editor-btn"), tooltip);

            //connect editor windows
            ForestEditorPalleteWindow.attachTo(ForestEditorPropertiesWindow);
            ForestEditTabBook.selectPage(0);
        }
        public void close(GuiControl gui)
        {
            EditorGui                      EditorGui                      = "EditorGui";
            GuiCanvas                      Canvas                         = "Canvas";
            GuiEditorGui                   GuiEditorGui                   = "GuiEditorGui";
            EWTreeWindow                   EWTreeWindow                   = "EWTreeWindow";
            TerrainPainter                 TerrainPainter                 = "TerrainPainter";
            GuiWindowCollapseCtrl          TerrainPainterPreview          = "TerrainPainterPreview";
            EWInspectorWindow              EWInspectorWindow              = "EWInspectorWindow";
            MaterialEditorPreviewWindow    MaterialEditorPreviewWindow    = "MaterialEditorPreviewWindow";
            MaterialEditorPropertiesWindow MaterialEditorPropertiesWindow = "MaterialEditorPropertiesWindow";
            DatablockEditorTreeWindow      DatablockEditorTreeWindow      = "DatablockEditorTreeWindow";
            DatablockEditorInspectorWindow DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            DecalEditorGui.DecalEditorWindow              DecalEditorWindow            = "DecalEditorWindow";
            DecalEditorGui.DecalPreviewWindow             DecalPreviewWindow           = "DecalPreviewWindow";
            ForestEditorGui.ForestEditorPalleteWindow     ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui.ForestEditorPropertiesWindow  ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            MeshRoadEditorGui.MeshRoadEditorTreeWindow    MeshRoadEditorTreeWindow     = "MeshRoadEditorTreeWindow";
            MeshRoadEditorGui.MeshRoadEditorOptionsWindow MeshRoadEditorOptionsWindow  = "MeshRoadEditorOptionsWindow";
            GuiWindowCollapseCtrl MissionAreaEditorTerrainWindow    = "MissionAreaEditorTerrainWindow";
            GuiWindowCollapseCtrl MissionAreaEditorPropertiesWindow = "MissionAreaEditorPropertiesWindow";

            ParticleEditor.gui.ParticleEditor.PE_Window PE_Window                = "PE_Window";
            RiverEditorGui.RiverEditorTreeWindow        RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            RiverEditorGui.RiverEditorOptionsWindow     RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            RoadEditorGui.RoadEditorTreeWindow          RoadEditorTreeWindow     = "RoadEditorTreeWindow";
            RoadEditorGui.RoadEditorOptionsWindow       RoadEditorOptionsWindow  = "RoadEditorOptionsWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";
            MessageHud            MessageHud            = "MessageHud";

            EWTreeWindow["wasOpen"]                      = EWTreeWindow["isInPopup"];
            EWInspectorWindow["wasOpen"]                 = EWInspectorWindow["isInPopup"];
            TerrainPainter["wasOpen"]                    = TerrainPainter["isInPopup"];
            TerrainPainterPreview["wasOpen"]             = TerrainPainterPreview["isInPopup"];
            MaterialEditorPreviewWindow["wasOpen"]       = MaterialEditorPreviewWindow["isInPopup"];
            MaterialEditorPropertiesWindow["wasOpen"]    = MaterialEditorPropertiesWindow["isInPopup"];
            DatablockEditorTreeWindow["wasOpen"]         = DatablockEditorTreeWindow["isInPopup"];
            DatablockEditorInspectorWindow["wasOpen"]    = DatablockEditorInspectorWindow["isInPopup"];
            DecalEditorWindow["wasOpen"]                 = DecalEditorWindow["isInPopup"];
            DecalPreviewWindow["wasOpen"]                = DecalPreviewWindow["isInPopup"];
            ForestEditorPalleteWindow["wasOpen"]         = ForestEditorPalleteWindow["isInPopup"];
            ForestEditorPropertiesWindow["wasOpen"]      = ForestEditorPropertiesWindow["isInPopup"];
            MeshRoadEditorTreeWindow["wasOpen"]          = MeshRoadEditorTreeWindow["isInPopup"];
            MeshRoadEditorOptionsWindow["wasOpen"]       = MeshRoadEditorOptionsWindow["isInPopup"];
            MissionAreaEditorTerrainWindow["wasOpen"]    = MissionAreaEditorTerrainWindow["isInPopup"];
            MissionAreaEditorPropertiesWindow["wasOpen"] = MissionAreaEditorPropertiesWindow["isInPopup"];
            PE_Window["wasOpen"]                = PE_Window["isInPopup"];
            RiverEditorTreeWindow["wasOpen"]    = RiverEditorTreeWindow["isInPopup"];
            RiverEditorOptionsWindow["wasOpen"] = RiverEditorOptionsWindow["isInPopup"];
            RoadEditorTreeWindow["wasOpen"]     = RoadEditorTreeWindow["isInPopup"];
            RoadEditorOptionsWindow["wasOpen"]  = RoadEditorOptionsWindow["isInPopup"];
            ShapeEdAdvancedWindow["wasOpen"]    = ShapeEdAdvancedWindow["isInPopup"];
            ShapeEdSelectWindow["wasOpen"]      = ShapeEdSelectWindow["isInPopup"];
            ShapeEdPropWindow["wasOpen"]        = ShapeEdPropWindow["isInPopup"];

            EWTreeWindow.ClosePopOut();
            EWInspectorWindow.ClosePopOut();
            TerrainPainter.ClosePopOut();
            TerrainPainterPreview.ClosePopOut();
            MaterialEditorPreviewWindow.ClosePopOut();
            MaterialEditorPropertiesWindow.ClosePopOut();
            DatablockEditorTreeWindow.ClosePopOut();
            DatablockEditorInspectorWindow.ClosePopOut();
            DecalEditorWindow.ClosePopOut();
            DecalPreviewWindow.ClosePopOut();
            ForestEditorPalleteWindow.ClosePopOut();
            ForestEditorPropertiesWindow.ClosePopOut();
            MeshRoadEditorTreeWindow.ClosePopOut();
            MeshRoadEditorOptionsWindow.ClosePopOut();
            MissionAreaEditorTerrainWindow.ClosePopOut();
            MissionAreaEditorPropertiesWindow.ClosePopOut();
            PE_Window.ClosePopOut();
            RiverEditorTreeWindow.ClosePopOut();
            RiverEditorOptionsWindow.ClosePopOut();
            RoadEditorTreeWindow.ClosePopOut();
            RoadEditorOptionsWindow.ClosePopOut();
            ShapeEdAdvancedWindow.ClosePopOut();
            ShapeEdSelectWindow.ClosePopOut();
            ShapeEdPropWindow.ClosePopOut();

            this.editorDisabled();
            Canvas.setContent(gui);
            if (MessageHud.isObject())
            {
                MessageHud.close();
            }
            EditorGui.writeCameraSettings();

            Util._schedule("1000", "0", "checkCursor");
            checkCursor();
        }
Exemple #4
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!");
            }
        }
        public void open()
        {
            EditorGui                      EditorGui                      = "EditorGui";
            GuiCanvas                      Canvas                         = "Canvas";
            GuiEditorGui                   GuiEditorGui                   = "GuiEditorGui";
            EWTreeWindow                   EWTreeWindow                   = "EWTreeWindow";
            TerrainPainter                 TerrainPainter                 = "TerrainPainter";
            GuiWindowCollapseCtrl          TerrainPainterPreview          = "TerrainPainterPreview";
            EWInspectorWindow              EWInspectorWindow              = "EWInspectorWindow";
            MaterialEditorPreviewWindow    MaterialEditorPreviewWindow    = "MaterialEditorPreviewWindow";
            MaterialEditorPropertiesWindow MaterialEditorPropertiesWindow = "MaterialEditorPropertiesWindow";
            DatablockEditorTreeWindow      DatablockEditorTreeWindow      = "DatablockEditorTreeWindow";
            DatablockEditorInspectorWindow DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            DecalEditorGui.DecalEditorWindow              DecalEditorWindow            = "DecalEditorWindow";
            DecalEditorGui.DecalPreviewWindow             DecalPreviewWindow           = "DecalPreviewWindow";
            ForestEditorGui.ForestEditorPalleteWindow     ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui.ForestEditorPropertiesWindow  ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            MeshRoadEditorGui.MeshRoadEditorTreeWindow    MeshRoadEditorTreeWindow     = "MeshRoadEditorTreeWindow";
            MeshRoadEditorGui.MeshRoadEditorOptionsWindow MeshRoadEditorOptionsWindow  = "MeshRoadEditorOptionsWindow";
            GuiWindowCollapseCtrl MissionAreaEditorTerrainWindow    = "MissionAreaEditorTerrainWindow";
            GuiWindowCollapseCtrl MissionAreaEditorPropertiesWindow = "MissionAreaEditorPropertiesWindow";

            ParticleEditor.gui.ParticleEditor.PE_Window PE_Window                = "PE_Window";
            RiverEditorGui.RiverEditorTreeWindow        RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            RiverEditorGui.RiverEditorOptionsWindow     RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            RoadEditorGui.RoadEditorTreeWindow          RoadEditorTreeWindow     = "RoadEditorTreeWindow";
            RoadEditorGui.RoadEditorOptionsWindow       RoadEditorOptionsWindow  = "RoadEditorOptionsWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";

            // prevent the mission editor from opening while the GuiEditor is open.
            if (Canvas.getContent() == GuiEditorGui.getId())
            {
                return;
            }

            if (!EditorGui.isInitialized)
            {
                EditorGui.init();
            }

            this.editorEnabled();
            Canvas.setContent(EditorGui);
            EditorGui.syncCameraGui();

            if (EWTreeWindow["wasOpen"].AsBool())
            {
                EWTreeWindow.OpenPopOut();
            }

            if (EWInspectorWindow["wasOpen"].AsBool())
            {
                EWInspectorWindow.OpenPopOut();
            }

            if (TerrainPainter["wasOpen"].AsBool())
            {
                TerrainPainter.OpenPopOut();
            }

            if (TerrainPainterPreview["wasOpen"].AsBool())
            {
                TerrainPainterPreview.OpenPopOut();
            }

            if (MaterialEditorPreviewWindow["wasOpen"].AsBool())
            {
                MaterialEditorPreviewWindow.OpenPopOut();
            }

            if (MaterialEditorPropertiesWindow["wasOpen"].AsBool())
            {
                MaterialEditorPropertiesWindow.OpenPopOut();
            }

            if (DatablockEditorTreeWindow["wasOpen"].AsBool())
            {
                DatablockEditorTreeWindow.OpenPopOut();
            }

            if (DatablockEditorInspectorWindow["wasOpen"].AsBool())
            {
                DatablockEditorInspectorWindow.OpenPopOut();
            }

            if (DecalEditorWindow["wasOpen"].AsBool())
            {
                DecalEditorWindow.OpenPopOut();
            }

            if (DecalPreviewWindow["wasOpen"].AsBool())
            {
                DecalPreviewWindow.OpenPopOut();
            }

            if (ForestEditorPalleteWindow["wasOpen"].AsBool())
            {
                ForestEditorPalleteWindow.OpenPopOut();
            }

            if (ForestEditorPropertiesWindow["wasOpen"].AsBool())
            {
                ForestEditorPropertiesWindow.OpenPopOut();
            }

            if (MeshRoadEditorTreeWindow["wasOpen"].AsBool())
            {
                MeshRoadEditorTreeWindow.OpenPopOut();
            }

            if (MeshRoadEditorOptionsWindow["wasOpen"].AsBool())
            {
                MeshRoadEditorOptionsWindow.OpenPopOut();
            }

            if (MissionAreaEditorTerrainWindow["wasOpen"].AsBool())
            {
                MissionAreaEditorTerrainWindow.OpenPopOut();
            }

            if (MissionAreaEditorPropertiesWindow["wasOpen"].AsBool())
            {
                MissionAreaEditorPropertiesWindow.OpenPopOut();
            }

            if (PE_Window["wasOpen"].AsBool())
            {
                PE_Window.OpenPopOut();
            }

            if (RiverEditorTreeWindow["wasOpen"].AsBool())
            {
                RiverEditorTreeWindow.OpenPopOut();
            }

            if (RiverEditorOptionsWindow["wasOpen"].AsBool())
            {
                RiverEditorOptionsWindow.OpenPopOut();
            }

            if (RoadEditorTreeWindow["wasOpen"].AsBool())
            {
                RoadEditorTreeWindow.OpenPopOut();
            }

            if (RoadEditorOptionsWindow["wasOpen"].AsBool())
            {
                RoadEditorOptionsWindow.OpenPopOut();
            }

            if (ShapeEdAdvancedWindow["wasOpen"].AsBool())
            {
                ShapeEdAdvancedWindow.OpenPopOut();
            }

            if (ShapeEdSelectWindow["wasOpen"].AsBool())
            {
                ShapeEdSelectWindow.OpenPopOut();
            }

            if (ShapeEdPropWindow["wasOpen"].AsBool())
            {
                ShapeEdPropWindow.OpenPopOut();
            }
        }