public void createTool(string tool, string cmd, GuiDynamicCtrlArrayControl toolsArray)
        {
            var        oc1       = new ObjectCreator("GuiControl");
            GuiControl container = oc1.Create();

            var oc = new ObjectCreator("GuiBitmapButtonCtrl");

            oc["Extent"]     = "108 81";
            oc["position"]   = "35 0";
            oc["bitmap"]     = "art/gui/no-preview";
            oc["altCommand"] = "ToolsDlg.execute(\\\"" + this["cwd"] + "/" + cmd + ".bat\\\");";
            GuiBitmapButtonCtrl bitmap = oc.Create();

            var oc2 = new ObjectCreator("GuiTextCtrl");

            oc2["text"]     = tool;
            oc2["Extent"]   = "108 30";
            oc2["position"] = "35 85";
            GuiTextCtrl text = oc2.Create();

            container.addGuiControl(bitmap);
            container.addGuiControl(text);

            toolsArray.addGuiControl(container);
        }
Beispiel #2
0
        public override void onSelectionChanged(string shape, string face)
        {
            GuiBitmapButtonCtrl ConvexEditorSplitFaceBtn  = "ConvexEditorSplitFaceBtn";
            GuiBitmapButtonCtrl ConvexEditorDeleteFaceBtn = "ConvexEditorDeleteFaceBtn";

            //echo( "onSelectionChanged: " @ %shape SPC %face );

            ConvexEditorSplitFaceBtn.setActive(false);
            ConvexEditorSplitFaceBtn["ToolTip"] = "Split selected face [Disabled]" + '\n' +
                                                  "Use Ctrl + Rotate instead for more control";
            ConvexEditorDeleteFaceBtn.setActive(false);
            ConvexEditorDeleteFaceBtn["ToolTip"] = "Delete selection [Disabled] (Delete)";

            if (!shape.isObject())
            {
                return;
            }

            ConvexEditorDeleteFaceBtn.setActive(true);

            if (face == "-1")
            {
                ConvexEditorDeleteFaceBtn["ToolTip"] = "Delete selected ConvexShape (Delete)";
            }
            else
            {
                ConvexEditorDeleteFaceBtn["ToolTip"] = "Delete selected Face (Delete)";

                ConvexEditorSplitFaceBtn["ToolTip"] = "Split selected face" + '\n' +
                                                      "Use Ctrl + Rotate instead for more control";
                ConvexEditorSplitFaceBtn.setActive(true);
            }
        }
            public void updateParticleTexture(bool action)
            {
                MaterialEditor.gui.CodeBehind.MaterialEditor.MaterialEditorGui MaterialEditorGui = "MaterialEditorGui";

                GuiBitmapButtonCtrl PEP_previewImage     = this.FOT("PEP_previewImage");
                GuiTextEditCtrl     PEP_previewImageName = this.FOT("PEP_previewImageName");


                if (action)
                {
                    string texture = MaterialEditorGui.openFile("texture");
                    if (texture != "")
                    {
                        PEP_previewImage.setBitmap(texture);
                        PEP_previewImageName.setText(texture);
                        PEP_previewImageName.tooltip = texture;

                        this.updateParticle("textureName", texture, false, false);
                    }
                }
                else
                {
                    PEP_previewImage.setBitmap("");
                    PEP_previewImageName.setText("");
                    PEP_previewImageName.tooltip = "";

                    this.updateParticle("textureName", "", false, false);
                }
            }
        public void setThreadDirection(int dir)
        {
            CodeBehind.ShapeEditor.ShapeEdShapeView    ShapeEdShapeView    = "ShapeEdShapeView";
            CodeBehind.ShapeEditor.ShapeEdThreadWindow ShapeEdThreadWindow = "ShapeEdThreadWindow";

            GuiBitmapButtonCtrl pauseBtn    = ShapeEdThreadWindow.FOT("pauseBtn");
            GuiBitmapButtonCtrl playBkwdBtn = ShapeEdThreadWindow.FOT("playBkwdBtn");
            GuiBitmapButtonCtrl playFwdBtn  = ShapeEdThreadWindow.FOT("playFwdBtn");

            // Update thread direction
            ShapeEdShapeView["threadDirection"] = dir.AsString();

            // Sync the controls in the thread window
            switch (dir)
            {
            case -1:
                playBkwdBtn.setStateOn(true);
                break;

            case 0:
                pauseBtn.setStateOn(true);
                break;

            case 1:
                playFwdBtn.setStateOn(true);
                break;
            }
        }
        public static void shapeEditorWireframeMode()
        {
            ShapeEditorToolbar  ShapeEditorToolbar = "ShapeEditorToolbar";
            GuiBitmapButtonCtrl wireframeMode      = ShapeEditorToolbar.FOT("wireframeMode");

            omni.bGlobal["$gfx::wireframe"] = !omni.bGlobal["$gfx::wireframe"];
            wireframeMode.setStateOn(omni.bGlobal["$gfx::wireframe"]);
        }
Beispiel #6
0
        public void keyboardSetMaterial(string mat)
        {
            string name = "EPainterMaterialButton" + mat;
            GuiBitmapButtonCtrl ctrl = ((GuiWindowCollapseCtrl)"TerrainPainter").findObjectByInternalName(name, true);

            if (ctrl.isObject())
            {
                ctrl.performClick();
            }
        }
        public void writeSettings()
        {
            Settings EditorSettings = "EditorSettings";

            ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui  = "ShapeEdPreviewGui";
            ShapeEditor.ShapeEdMaterials  ShapeEdMaterials   = "ShapeEdMaterials";
            ShapeEditorToolbar            ShapeEditorToolbar = "ShapeEditorToolbar";

            ShapeEditor.ShapeEdMountWindow ShapeEdMountWindow = "ShapeEdMountWindow";
            ShapeEditor.ShapeEdShapeView   ShapeEdShapeView   = "ShapeEdShapeView";

            GuiSwatchButtonCtrl previewBackground = ShapeEdPreviewGui.FOT("previewBackground");
            GuiCheckBoxCtrl     highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial");
            GuiBitmapButtonCtrl showNodes         = ShapeEditorToolbar.FOT("showNodes");
            GuiBitmapButtonCtrl showBounds        = ShapeEditorToolbar.FOT("showBounds");
            GuiBitmapButtonCtrl showObjBox        = ShapeEditorToolbar.FOT("showObjBox");
            GuiBitmapButtonCtrl showAdvanced      = ShapeEditorToolbar.FOT("showAdvanced");
            GuiBitmapButtonCtrl showGridBtn       = ShapeEditorToolbar.FOT("showGridBtn");
            GuiBitmapButtonCtrl renderColMeshes   = ShapeEditorToolbar.FOT("renderColMeshes");
            GuiCheckBoxCtrl     renderMounts      = ShapeEdMountWindow.FOT("renderMounts");

            EditorSettings.beginGroup("ShapeEditor", true);

            // Display options
            EditorSettings.setValue("BackgroundColor", ColorPickerDlg.ColorFloatToInt(previewBackground["color"]));
            EditorSettings.setValue("HighlightMaterial", highlightMaterial.getValue());
            EditorSettings.setValue("ShowNodes", showNodes.getValue());
            EditorSettings.setValue("ShowBounds", showBounds.getValue());
            EditorSettings.setValue("ShowObjBox", showObjBox.getValue());
            EditorSettings.setValue("RenderCollision", renderColMeshes.getValue());
            EditorSettings.setValue("RenderMounts", renderMounts.getValue());

            // Grid
            EditorSettings.setValue("ShowGrid", showGridBtn.getValue());
            EditorSettings.setValue("GridSize", ShapeEdShapeView["gridSize"]);
            EditorSettings.setValue("GridDimension", ShapeEdShapeView["gridDimension"]);

            // Sun
            EditorSettings.setValue("SunDiffuseColor", ShapeEdShapeView["sunDiffuse"]);
            EditorSettings.setValue("SunAmbientColor", ShapeEdShapeView["sunAmbient"]);
            EditorSettings.setValue("SunAngleX", ShapeEdShapeView["sunAngleX"]);
            EditorSettings.setValue("SunAngleZ", ShapeEdShapeView["sunAngleZ"]);

            // Sub-windows
            EditorSettings.setValue("AdvancedWndVisible", showAdvanced.getValue());

            EditorSettings.endGroup();
        }
        public void readSettings()
        {
            Settings EditorSettings = "EditorSettings";

            ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui  = "ShapeEdPreviewGui";
            ShapeEditor.ShapeEdMaterials  ShapeEdMaterials   = "ShapeEdMaterials";
            ShapeEditorToolbar            ShapeEditorToolbar = "ShapeEditorToolbar";

            ShapeEditor.ShapeEdMountWindow ShapeEdMountWindow = "ShapeEdMountWindow";
            ShapeEditor.ShapeEdShapeView   ShapeEdShapeView   = "ShapeEdShapeView";

            GuiSwatchButtonCtrl previewBackground = ShapeEdPreviewGui.FOT("previewBackground");
            GuiCheckBoxCtrl     highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial");
            GuiBitmapButtonCtrl showNodes         = ShapeEditorToolbar.FOT("showNodes");
            GuiBitmapButtonCtrl showBounds        = ShapeEditorToolbar.FOT("showBounds");
            GuiBitmapButtonCtrl showObjBox        = ShapeEditorToolbar.FOT("showObjBox");
            GuiBitmapButtonCtrl showAdvanced      = ShapeEditorToolbar.FOT("showAdvanced");
            GuiBitmapButtonCtrl showGridBtn       = ShapeEditorToolbar.FOT("showGridBtn");
            GuiBitmapButtonCtrl renderColMeshes   = ShapeEditorToolbar.FOT("renderColMeshes");
            GuiCheckBoxCtrl     renderMounts      = ShapeEdMountWindow.FOT("renderMounts");

            EditorSettings.beginGroup("ShapeEditor", true);

            // Display options
            previewBackground["color"] = ColorPickerDlg.ColorIntToFloat(EditorSettings.value("BackgroundColor"));
            SetToggleButtonValue(highlightMaterial, EditorSettings.value("HighlightMaterial"));
            SetToggleButtonValue(showNodes, EditorSettings.value("ShowNodes"));
            SetToggleButtonValue(showBounds, EditorSettings.value("ShowBounds"));
            SetToggleButtonValue(showObjBox, EditorSettings.value("ShowObjBox"));
            SetToggleButtonValue(renderColMeshes, EditorSettings.value("RenderCollision"));
            SetToggleButtonValue(renderMounts, EditorSettings.value("RenderMounts"));

            // Grid
            SetToggleButtonValue(showGridBtn, EditorSettings.value("ShowGrid"));
            ShapeEdShapeView["gridSize"]      = EditorSettings.value("GridSize");
            ShapeEdShapeView["gridDimension"] = EditorSettings.value("GridDimension");

            // Sun
            ShapeEdShapeView["sunDiffuse"] = EditorSettings.value("SunDiffuseColor");
            ShapeEdShapeView["sunAmbient"] = EditorSettings.value("SunAmbientColor");

            // Sub-windows
            SetToggleButtonValue(showAdvanced, EditorSettings.value("AdvancedWndVisible"));

            EditorSettings.endGroup();
        }
Beispiel #9
0
        public void toggleLock()
        {
            EWTreeWindow        EWTreeWindow    = "EWTreeWindow";
            GuiBitmapButtonCtrl LockSelection   = EWTreeWindow.FOT("LockSelection");
            GuiBitmapButtonCtrl DeleteSelection = EWTreeWindow.FOT("DeleteSelection");

            if (LockSelection.command == "EWorldEditor.lockSelection(true); EditorTree.toggleLock();")
            {
                LockSelection.command   = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();";
                DeleteSelection.command = "";
            }
            else
            {
                LockSelection.command   = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();";
                DeleteSelection.command = "EditorMenuEditDelete();";
            }
        }
        public void togglePingPong()
        {
            GuiBitmapButtonCtrl pingpong    = this.FOT("pingpong");
            GuiBitmapButtonCtrl playBkwdBtn = this.FOT("playBkwdBtn");
            GuiBitmapButtonCtrl playFwdBtn  = this.FOT("playFwdBtn");

            CodeBehind.ShapeEditor.ShapeEdShapeView ShapeEdShapeView = "ShapeEdShapeView";

            ShapeEdShapeView["threadPingPong"] = pingpong.getValue();
            if (playFwdBtn.getValue().AsBool())
            {
                playFwdBtn.performClick();
            }
            else if (playBkwdBtn.getValue().AsBool())
            {
                playBkwdBtn.performClick();
            }
        }
Beispiel #11
0
        public override void onAddSelection(int obj, bool isLastSelection)
        {
            EWorldEditor EWorldEditor = "EWorldEditor";
            EWTreeWindow EWTreeWindow = "EWTreeWindow";
            Inspector    Inspector    = "Inspector";

            GuiBitmapButtonCtrl LockSelection   = EWTreeWindow.FOT("LockSelection");
            GuiBitmapButtonCtrl DeleteSelection = EWTreeWindow.FOT("DeleteSelection");

            EWorldEditor.selectObject(obj.AsString());

            int selSize   = EWorldEditor.getSelectionSize();
            int lockCount = EWorldEditor.getSelectionLockCount();

            if (lockCount < selSize)
            {
                LockSelection.setStateOn(false);
                LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();";
            }
            else if (lockCount > 0)
            {
                LockSelection.setStateOn(true);
                LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();";
            }

            if (selSize > 0 && lockCount == 0)
            {
                DeleteSelection.command = "EditorMenuEditDelete();";
            }
            else
            {
                DeleteSelection.command = "";
            }

            if (isLastSelection)
            {
                Inspector.addInspect(obj.AsString());
            }
            else
            {
                Inspector.addInspect(obj.AsString(), false);
            }
        }
            public override void onTabSelected(string text, uint index)
            {
                GuiWindowCollapseCtrl DatablockEditorTreeWindow = "DatablockEditorTreeWindow";
                GuiBitmapButtonCtrl   DeleteSelection           = DatablockEditorTreeWindow.findObjectByInternalName("DeleteSelection", true);
                GuiBitmapButtonCtrl   CreateSelection           = DatablockEditorTreeWindow.findObjectByInternalName("CreateSelection", true);

                switch (index)
                {
                case 0:
                    DeleteSelection.visible = true;
                    CreateSelection.visible = false;
                    break;

                case 1:
                    DeleteSelection.visible = false;
                    CreateSelection.visible = true;
                    break;
                }
            }
Beispiel #13
0
        public override void onActivated()
        {
            base.onActivated();
            EditorGui           EditorGui            = "EditorGui";
            TerrainEditor       ETerrainEditor       = "ETerrainEditor";
            GuiControl          EWTerrainEditToolbar = "EWTerrainEditToolbar";
            TerrainEditorPlugin TerrainEditorPlugin  = "TerrainEditorPlugin";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            Settings EditorSettings = "EditorSettings";

            EditorGui.readTerrainEditorSettings();

            string action = EditorSettings.value("TerrainEditor/currentAction");

            ETerrainEditor.switchAction(action);

            GuiButtonCtrl ctrl =
                (((GuiDynamicCtrlArrayControl)"ToolsPaletteArray").findObjectByInternalName(action, true));

            ctrl.setStateOn(true);

            GuiBitmapButtonCtrl octrl =
                ((GuiControl)"EWTerrainEditToolbarBrushType").findObjectByInternalName("ellipse", true);

            octrl.performClick();

            EditorGui.menuBar.insert(this["terrainMenu"], EditorGui.menuBar["dynamicItemInsertPos"].AsInt());

            EditorGui.bringToFront(ETerrainEditor);
            ETerrainEditor.setVisible(true);
            ETerrainEditor.attachTerrain();
            ETerrainEditor.makeFirstResponder(true);

            EWTerrainEditToolbar.setVisible(true);
            ETerrainEditor.onBrushChanged();
            ETerrainEditor.setup();
            TerrainEditorPlugin.syncBrushInfo();

            EditorGuiStatusBar.setSelection("");

            ((ActionMap)map).push();
        }
Beispiel #14
0
            public override void onTabSelected(string text, uint index)
            {
                EWTreeWindow EWTreeWindow = "EWTreeWindow";

                GuiBitmapButtonCtrl DeleteSelection = EWTreeWindow.FOT("DeleteSelection");
                GuiBitmapButtonCtrl LockSelection   = EWTreeWindow.FOT("LockSelection");
                GuiBitmapButtonCtrl AddSimGroup     = EWTreeWindow.FOT("AddSimGroup");

                if (this.getSelectedPage() == 0)
                {
                    DeleteSelection.visible = true;
                    LockSelection.visible   = true;
                    AddSimGroup.visible     = true;
                }
                else
                {
                    DeleteSelection.visible = false;
                    LockSelection.visible   = false;
                    AddSimGroup.visible     = false;
                }
            }
        public void togglePause()
        {
            GuiBitmapButtonCtrl pauseBtn    = this.FOT("pauseBtn");
            GuiBitmapButtonCtrl playBkwdBtn = this.FOT("playBkwdBtn");
            GuiBitmapButtonCtrl playFwdBtn  = this.FOT("playFwdBtn");

            if (pauseBtn.getValue().AsInt() == 0)
            {
                this["lastDirBkwd"] = playBkwdBtn.getValue();
                pauseBtn.performClick();
            }
            else
            {
                this.setNoProxySequence();
                if (this["lastDirBkwd"].AsBool())
                {
                    playBkwdBtn.performClick();
                }
                else
                {
                    playFwdBtn.performClick();
                }
            }
        }
        public void setPlaybackLimit(string limit, int val)
        {
            GuiTextEditCtrl     seqIn     = this.FOT("seqIn");
            GuiTextEditCtrl     seqOut    = this.FOT("seqOut");
            GuiBitmapButtonCtrl seqInBar  = this.FOT("seqInBar");
            GuiBitmapButtonCtrl seqOutBar = this.FOT("seqOutBar");

            // Determine where to place the in/out bar on the slider
            int thumbWidth = 8; // width of the thumb bitmap
            int pos_x      = this.getTimelineBitmapPos(val, thumbWidth);

            if (limit == "in")
            {
                this.seqStartFrame = val;
                seqIn.setText(val.AsString());
                seqInBar.setPosition(pos_x, 0);
            }
            else
            {
                this.seqEndFrame = val;
                seqOut.setText(val.AsString());
                seqOutBar.setPosition(pos_x, 0);
            }
        }
Beispiel #17
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(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();
            }
        }
        public override void onWorldEditorStartup()
        {
            EditorGui EditorGui = "EditorGui";

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

            // Add ourselves to the ToolsToolbar
            string tooltip = "Shape Editor (" + accel + ")";

            EditorGui.addToToolsToolbar("ShapeEditorPlugin", "ShapeEditorPalette",
                                        Util._expandFilename("tools/worldEditor/images/toolbar/shape-editor"), tooltip);

            // Add ourselves to the Editor Settings window
            //exec( "./gui/ShapeEditorSettingsTab.gui" );
            //console.Call("ShapeEditorSettingsTab_initialize");
            ShapeEditorSettingsTab.initialize();


            ESettingsWindow ESettingsWindow = "ESettingsWindow";

            ESettingsWindow.addTabPage("EShapeEditorSettingsPage");

            ShapeEdPropWindow ShapeEdPropWindow = "ShapeEdPropWindow";

            ShapeEdPropWindow.attachTo("ShapeEdSelectWindow");
            ShapeEdAnimWindow ShapeEdAnimWindow = "ShapeEdAnimWindow";

            ShapeEdAnimWindow.resize(-1, 526, 593, 53);

            // Initialise gui
            ShapeEditor.ShapeEdSeqNodeTabBook ShapeEdSeqNodeTabBook = "ShapeEdSeqNodeTabBook";
            ShapeEdSeqNodeTabBook.selectPage(0);
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow        = "ShapeEdAdvancedWindow";
            GuiTabBookCtrl        ShapeEdAdvancedWindowtabBook = ShapeEdAdvancedWindow.FOT("tabBook");

            ShapeEdAdvancedWindowtabBook.selectPage(0);

            ShapeEdSelectWindow ShapeEdSelectWindow        = "ShapeEdSelectWindow";
            GuiTabBookCtrl      ShapeEdSelectWindowtabBook = ShapeEdSelectWindow.FOT("tabBook");

            ShapeEdSelectWindowtabBook.selectPage(0);
            ShapeEdSelectWindow.navigate("");

            ShapeEditorToolbar  ShapeEditorToolbar = "ShapeEditorToolbar";
            GuiBitmapButtonCtrl orbitNodeBtn       = ShapeEditorToolbar.FOT("orbitNodeBtn");

            SetToggleButtonValue(orbitNodeBtn, "0");
            GuiBitmapButtonCtrl ghostMode = ShapeEditorToolbar.FOT("ghostMode");

            SetToggleButtonValue(ghostMode, "0");

            // Initialise hints menu
            SimGroup ShapeHintGroup = "ShapeHintGroup";

            ShapeEditor.ShapeEdHintMenu ShapeEdHintMenu = "ShapeEdHintMenu";
            ShapeEdHintMenu.clear();
            int count = ShapeHintGroup.getCount();

            for (uint i = 0; i < count; i++)
            {
                SimObject hint = ShapeHintGroup.getObject(i);
                ShapeEdHintMenu.add(hint["objectType"], hint);
            }
        }
Beispiel #20
0
        public void next()
        {
            // Set us to a blank screen while we load the next one
            GuiCanvas Canvas = "Canvas";

            Canvas.setContent("BlankGui");
            // Set our bitmap and reset the done variable

            this.setBitmapX(this["bitmap" + mStartupIdx]);
            done = false;

            // If we have a logo then set it
            GuiBitmapButtonCtrl StartupLogo = findObjectByInternalName("StartupLogo", false);

            if (StartupLogo.isObject())
            {
                if (this["logo" + mStartupIdx] != "")
                {
                    StartupLogo.setBitmap(this["logo" + mStartupIdx]);
                    if (this["logoPos" + mStartupIdx] != "")
                    {
                        Point2I logoPos = new Point2I(this["logoPos" + mStartupIdx]);
                        StartupLogo.setPosition(logoPos.x, logoPos.y);
                    }
                    if (this["logoExtent" + mStartupIdx] != "")
                    {
                        StartupLogo.setExtent(new Point2F(this["logoExtent" + mStartupIdx]));
                    }

                    StartupLogo.setVisible(true);
                }
                else
                {
                    StartupLogo.setVisible(false);
                }
            }

            GuiBitmapButtonCtrl StartupLogoSecondary = findObjectByInternalName("StartupLogoSecondary", false);

            if (StartupLogoSecondary.isObject())
            {
                if (this["seclogo" + mStartupIdx] != "")
                {
                    StartupLogoSecondary.setBitmap(this["seclogo" + mStartupIdx]);
                    if (this["seclogoPos" + mStartupIdx] != "")
                    {
                        Point2I logoPos = new Point2I(this["seclogoPos" + mStartupIdx]);
                        StartupLogoSecondary.setPosition(logoPos.x, logoPos.y);
                    }
                    if (this["seclogoExtent" + mStartupIdx] != "")
                    {
                        StartupLogoSecondary.setExtent(new Point2F(this["seclogoExtent" + mStartupIdx]));
                    }

                    StartupLogoSecondary.setVisible(true);
                }
                else
                {
                    StartupLogoSecondary.setVisible(false);
                }
            }

            mStartupIdx++;

            ((GuiCanvas)"Canvas").setContent(this);
        }
Beispiel #21
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();
        }
            public void guiSync()
            {
                GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector";

                ParticleEmitterEditor.PE_EmitterEditor PE_EmitterEditor = "PE_EmitterEditor";
                MaterialEditor.gui.CodeBehind.MaterialEditor.MaterialEditorGui MaterialEditorGui = "MaterialEditorGui";
                GuiSwatchButtonCtrl PE_ColorTintSwatch0 = "PE_ColorTintSwatch0";
                GuiSwatchButtonCtrl PE_ColorTintSwatch1 = "PE_ColorTintSwatch1";
                GuiSwatchButtonCtrl PE_ColorTintSwatch2 = "PE_ColorTintSwatch2";
                GuiSwatchButtonCtrl PE_ColorTintSwatch3 = "PE_ColorTintSwatch3";

                GuiBitmapButtonCtrl PEP_previewImage                  = this.FOT("PEP_previewImage");
                GuiTextEditCtrl     PEP_previewImageName              = this.FOT("PEP_previewImageName");
                GuiTextEditCtrl     PEP_lifetimeMS_textEdit           = this.FOT("PEP_lifetimeMS_textEdit");
                GuiTextEditCtrl     PEP_lifetimeVarianceMS_textEdit   = this.FOT("PEP_lifetimeVarianceMS_textEdit");
                GuiTextEditCtrl     PEP_inheritedVelFactor_textEdit   = this.FOT("PEP_inheritedVelFactor_textEdit");
                GuiTextEditCtrl     PEP_constantAcceleration_textEdit = this.FOT("PEP_constantAcceleration_textEdit");
                GuiTextEditCtrl     PEP_gravityCoefficient_textEdit   = this.FOT("PEP_gravityCoefficient_textEdit");
                GuiTextEditCtrl     PEP_dragCoefficient_textEdit      = this.FOT("PEP_dragCoefficient_textEdit");
                GuiTextEditCtrl     PEP_spinRandomMin_textEdit        = this.FOT("PEP_spinRandomMin_textEdit");
                GuiTextEditCtrl     PEP_spinRandomMax_textEdit        = this.FOT("PEP_spinRandomMax_textEdit");
                GuiTextEditCtrl     PEP_spinSpeed_textEdit            = this.FOT("PEP_spinSpeed_textEdit");
                GuiTextEditCtrl     PEP_pointSize_textEdit0           = this.FOT("PEP_pointSize_textEdit0");
                GuiTextEditCtrl     PEP_pointSize_textEdit1           = this.FOT("PEP_pointSize_textEdit1");
                GuiTextEditCtrl     PEP_pointSize_textEdit2           = this.FOT("PEP_pointSize_textEdit2");
                GuiTextEditCtrl     PEP_pointSize_textEdit3           = this.FOT("PEP_pointSize_textEdit3");
                GuiTextEditCtrl     PEP_pointTime_textEdit0           = this.FOT("PEP_pointTime_textEdit0");
                GuiTextEditCtrl     PEP_pointTime_textEdit1           = this.FOT("PEP_pointTime_textEdit1");
                GuiTextEditCtrl     PEP_pointTime_textEdit2           = this.FOT("PEP_pointTime_textEdit2");
                GuiTextEditCtrl     PEP_pointTime_textEdit3           = this.FOT("PEP_pointTime_textEdit3");
                GuiCheckBoxCtrl     PEP_inverseAlpha                  = this.FOT("PEP_inverseAlpha");
                GuiSliderCtrl       PEP_lifetimeMS_slider             = this.FOT("PEP_lifetimeMS_slider");
                GuiSliderCtrl       PEP_lifetimeVarianceMS_slider     = this.FOT("PEP_lifetimeVarianceMS_slider");
                GuiSliderCtrl       PEP_inheritedVelFactor_slider     = this.FOT("PEP_inheritedVelFactor_slider");
                GuiSliderCtrl       PEP_constantAcceleration_slider   = this.FOT("PEP_constantAcceleration_slider");
                GuiSliderCtrl       PEP_gravityCoefficient_slider     = this.FOT("PEP_gravityCoefficient_slider");
                GuiSliderCtrl       PEP_dragCoefficient_slider        = this.FOT("PEP_dragCoefficient_slider");
                GuiSliderCtrl       PEP_spinRandomMin_slider          = this.FOT("PEP_spinRandomMin_slider");
                GuiSliderCtrl       PEP_spinRandomMax_slider          = this.FOT("PEP_spinRandomMax_slider");
                GuiSliderCtrl       PEP_spinSpeed_slider              = this.FOT("PEP_spinSpeed_slider");
                GuiSliderCtrl       PEP_pointSize_slider0             = this.FOT("PEP_pointSize_slider0");
                GuiSliderCtrl       PEP_pointSize_slider1             = this.FOT("PEP_pointSize_slider1");
                GuiSliderCtrl       PEP_pointSize_slider2             = this.FOT("PEP_pointSize_slider2");
                GuiSliderCtrl       PEP_pointSize_slider3             = this.FOT("PEP_pointSize_slider3");
                GuiSliderCtrl       PEP_pointTime_slider0             = this.FOT("PEP_pointTime_slider0");
                GuiSliderCtrl       PEP_pointTime_slider1             = this.FOT("PEP_pointTime_slider1");
                GuiSliderCtrl       PEP_pointTime_slider2             = this.FOT("PEP_pointTime_slider2");
                GuiSliderCtrl       PEP_pointTime_slider3             = this.FOT("PEP_pointTime_slider3");

                // Populate the selector with the particles assigned
                // to the current emitter.

                bool             containsCurrParticle = false;
                GuiPopUpMenuCtrl popup = PEP_ParticleSelector;

                popup.clear();

                foreach (SimObject particle in PE_EmitterEditor.currEmitter["particles"].Split(' '))
                {
                    if (particle.getId() == this.currParticle)
                    {
                        containsCurrParticle = true;
                    }

                    popup.add(particle.getName(), particle.getId());
                }

                // Just in case the particle doesn't exist, fallback gracefully

                if (!containsCurrParticle)
                {
                    this.currParticle = Util.getWord(PE_EmitterEditor.currEmitter["particles"], 0).getID();
                }

                SimObject data = this.currParticle;

                popup.sort();
                popup.setSelected(data);

                string bitmap = MaterialEditorGui.searchForTexture(data.getName(), data["textureName"]);


                if (bitmap != "")
                {
                    PEP_previewImage.setBitmap(bitmap);
                    PEP_previewImageName.setText(bitmap);
                    PEP_previewImageName.tooltip = bitmap;
                }
                else
                {
                    PEP_previewImage.setBitmap("");
                    PEP_previewImageName.setText("None");
                    PEP_previewImageName.tooltip = "None";
                }

                PEP_inverseAlpha.setValue(data["useInvAlpha"]);

                PEP_lifetimeMS_slider.setValue(data["lifetimeMS"]);
                PEP_lifetimeMS_textEdit.setText(data["lifetimeMS"]);

                PEP_lifetimeVarianceMS_slider.setValue(data["lifetimeVarianceMS"]);
                PEP_lifetimeVarianceMS_textEdit.setText(data["lifetimeVarianceMS"]);

                PEP_inheritedVelFactor_slider.setValue(data["inheritedVelFactor"]);
                PEP_inheritedVelFactor_textEdit.setText(data["inheritedVelFactor"]);

                PEP_constantAcceleration_slider.setValue(data["constantAcceleration"]);
                PEP_constantAcceleration_textEdit.setText(data["constantAcceleration"]);

                PEP_gravityCoefficient_slider.setValue(data["gravityCoefficient"]);
                PEP_gravityCoefficient_textEdit.setText(data["gravityCoefficient"]);

                PEP_dragCoefficient_slider.setValue(data["dragCoefficient"]);
                PEP_dragCoefficient_textEdit.setText(data["dragCoefficient"]);

                PEP_spinRandomMin_slider.setValue(data["spinRandomMin"]);
                PEP_spinRandomMin_textEdit.setText(data["spinRandomMin"]);

                PEP_spinRandomMax_slider.setValue(data["spinRandomMax"]);
                PEP_spinRandomMax_textEdit.setText(data["spinRandomMax"]);

                PEP_spinRandomMax_slider.setValue(data["spinRandomMax"]);
                PEP_spinRandomMax_textEdit.setText(data["spinRandomMax"]);

                PEP_spinSpeed_slider.setValue(data["spinSpeed"]);
                PEP_spinSpeed_textEdit.setText(data["spinSpeed"]);

                PE_ColorTintSwatch0["color"] = data["colors[0]"];
                PE_ColorTintSwatch1["color"] = data["colors[1]"];
                PE_ColorTintSwatch2["color"] = data["colors[2]"];
                PE_ColorTintSwatch3["color"] = data["colors[3]"];

                PEP_pointSize_slider0.setValue(data["sizes[0]"]);
                PEP_pointSize_textEdit0.setText(data["sizes[0]"]);

                PEP_pointSize_slider1.setValue(data["sizes[1]"]);
                PEP_pointSize_textEdit1.setText(data["sizes[1]"]);

                PEP_pointSize_slider2.setValue(data["sizes[2]"]);
                PEP_pointSize_textEdit2.setText(data["sizes[2]"]);

                PEP_pointSize_slider3.setValue(data["sizes[3]"]);
                PEP_pointSize_textEdit3.setText(data["sizes[3]"]);

                PEP_pointTime_slider0.setValue(data["times[0]"]);
                PEP_pointTime_textEdit0.setText(data["times[0]"]);

                PEP_pointTime_slider1.setValue(data["times[1]"]);
                PEP_pointTime_textEdit1.setText(data["times[1]"]);

                PEP_pointTime_slider2.setValue(data["times[2]"]);
                PEP_pointTime_textEdit2.setText(data["times[2]"]);

                PEP_pointTime_slider3.setValue(data["times[3]"]);
                PEP_pointTime_textEdit3.setText(data["times[3]"]);
            }