Exemple #1
0
        public void update()
        {
            GuiStackControl SFXParametersStack = this.FOT("SFXParametersStack");

            for (uint i = 0; i < SFXParametersStack.getCount(); i++)
            {
                // If either the value field or the slider are currently being
                // edited, don't update the value in order to not interfere with
                // user editing.

                GuiControl ctrl = SFXParametersStack.getObject(i);

                GuiTextEditCtrl valueField  = ctrl.FOT("valueField");
                GuiSliderCtrl   valueSlider = ctrl.FOT("valueSlider");

                if (valueField.isFirstResponder() || valueSlider.isThumbBeingDragged())
                {
                    continue;
                }

                SFXParameter parameter = ctrl["sfxParameter"];

                valueField.setValue(parameter.value.AsString());
                valueSlider.setValue(parameter.value.AsString());
            }

            // If the control is still awake, schedule another
            // update.

            if (this.isVisible())
            {
                this.schedule(iGlobal["$SFX_PARAMETERS_UPDATE_INTERVAL"].AsString(), "update");
            }
        }
            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);
                }
            }
Exemple #3
0
        public void init(string guiName, string guiClass)
        {
            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";
            GuiTextEditCtrl        nameField = this.FOT("nameField");

            nameField.setValue(guiName);

            // Initialize the class dropdown if we haven't already.

            GuiPopUpMenuCtrl classDropdown = this.FOT("classDropdown");

            if (classDropdown.size() == 0)
            {
                string classes = Util.enumerateConsoleClassesByCategory("Gui");
                int    count   = Util.getFieldCount(classes);

                for (int i = 0; i < count; i++)
                {
                    string className = Util.getField(classes, i);
                    if (GuiEditor.isFilteredClass(className) ||
                        !Util.isMemberOfClass(className, "GuiControl"))
                    {
                        continue;
                    }

                    classDropdown.add(className, 0);
                }

                classDropdown.sort();
            }

            classDropdown.setText("GuiControl");
        }
Exemple #4
0
            public void saveEmitter(SimObject emitter)
            {
                PEE_EmitterSelector_Control PEE_EmitterSelector_Control      = "PEE_EmitterSelector_Control";
                ParticleEmitterData         PE_EmitterEditor_NotDirtyEmitter = "PE_EmitterEditor_NotDirtyEmitter";
                PersistenceManager          PE_EmitterSaver = "PE_EmitterSaver";
                ParticleEditor ParticleEditor = "ParticleEditor";

                GuiTextEditCtrl TextEdit = PEE_EmitterSelector_Control.FOT("TextEdit");

                string newName;

                if (emitter == "")
                {
                    newName = TextEdit.getText();
                }
                else
                {
                    newName = emitter.getName();
                }

                this.currEmitter.setName(newName);
                PE_EmitterEditor_NotDirtyEmitter.assignFieldsFrom(emitter);
                PE_EmitterEditor_NotDirtyEmitter["originalName"] = newName;

                PE_EmitterSaver.saveDirty();

                this.currEmitter = newName.getID();
                this.setEmitterNotDirty();

                ParticleEditor.createParticleList();
            }
Exemple #5
0
        public static void DbgWatchDialogEdit()
        {
            GuiTextEditCtrl      EditWatchDialogValue = "EditWatchDialogValue";
            GuiTextListCtrl      DebuggerWatchView    = "DebuggerWatchView";
            DebuggerEditWatchDlg DebuggerEditWatchDlg = "DebuggerEditWatchDlg";
            TCPDebugger          TCPDebugger          = "TCPDebugger";
            GuiCanvas            Canvas = "Canvas";

            string newValue = EditWatchDialogValue.getValue();
            int    id       = DebuggerWatchView.getSelectedId();

            if (id >= 0)
            {
                string row  = DebuggerWatchView.getRowTextById(id);
                string expr = omni.Util.getField(row, 0);
                string assignment;
                if (newValue == "")
                {
                    assignment = expr + " = \"\"";
                }
                else
                {
                    assignment = expr + " = " + newValue;
                }
                TCPDebugger.send("EVAL " + id + " 0 " + assignment + "\r\n");
            }
            Canvas.popDialog(DebuggerEditWatchDlg);
        }
Exemple #6
0
        public void syncBrushInfo()
        {
            GuiControl    TerrainBrushSizeTextEditContainer     = "TerrainBrushSizeTextEditContainer";
            GuiControl    TerrainBrushPressureTextEditContainer = "TerrainBrushPressureTextEditContainer";
            GuiControl    TerrainBrushSoftnessTextEditContainer = "TerrainBrushSoftnessTextEditContainer";
            GuiControl    TerrainSetHeightTextEditContainer     = "TerrainSetHeightTextEditContainer";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            GuiTextEditCtrl tTerrainBrushSizeTextEditContainer =
                TerrainBrushSizeTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainBrushPressureTextEditContainer =
                TerrainBrushPressureTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainBrushSoftnessTextEditContainer =
                TerrainBrushSoftnessTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainSetHeightTextEditContainer =
                TerrainSetHeightTextEditContainer.findObjectByInternalName("textEdit", true);

            tTerrainBrushSizeTextEditContainer.text     = Util.getWord(ETerrainEditor.getBrushSize(), 0);
            tTerrainBrushPressureTextEditContainer.text = (ETerrainEditor.getBrushPressure() * 100).AsString();
            tTerrainBrushSoftnessTextEditContainer.text = (ETerrainEditor.getBrushSoftness() * 100).AsString();
            tTerrainSetHeightTextEditContainer.text     = (ETerrainEditor.setHeightVal.AsString());

            string brushType = ETerrainEditor.getBrushType();

            Util.eval("EWTerrainEditToolbar-->" + brushType + ".setStateOn(1);");
        }
        public void loadDialog(GuiControl ctrl)
        {
            GuiCanvas       Canvas                    = "Canvas";
            GuiSliderCtrl   AlphaLevelSlider          = "AlphaLevelSlider";
            GuiSliderCtrl   MouseOverAlphaLevelSlider = "MouseOverAlphaLevelSlider";
            GuiTextEditCtrl AlphaLevelText            = "AlphaLevelText";
            GuiTextEditCtrl MouseOverAlphaLevelText   = "MouseOverAlphaLevelText";
            GuiTextEditCtrl AlphaFadeTimeText         = "AlphaFadeTimeText";

            this["ctrl"] = ctrl;
            this.checkAllowedDialogs();
            Canvas.pushDialog(this);

            if (this.ctrl["alpha"].AsBool())
            {
                this["oldAlphaValue"]     = ctrl.getAlphaValue().AsString();
                AlphaLevelSlider["value"] = this["oldAlphaValue"];
                AlphaLevelText["text"]    = this["oldAlphaValue"];
            }
            if (this.ctrl.mouseOverAlpha)
            {
                this["oldMouseOverAlphaValue"]     = ctrl.getMouseOverAlphaValue().AsString();
                MouseOverAlphaLevelSlider["value"] = this["oldMouseOverAlphaValue"];
                MouseOverAlphaLevelText["text"]    = this["oldMouseOverAlphaValue"];
            }
            if (this.ctrl.alphaFade)
            {
                this["oldAlphaFadeTime"]  = ctrl.getAlphaFadeTime().AsString();
                AlphaFadeTimeText["text"] = this["oldAlphaFadeTime"];
            }
        }
Exemple #8
0
        public static void DbgConsoleEntryReturn()
        {
            DebuggerConsoleView DebuggerConsoleView = "DebuggerConsoleView";
            TCPDebugger         TCPDebugger         = "TCPDebugger";
            GuiTextEditCtrl     DbgConsoleEntry     = "DbgConsoleEntry";
            GuiTextCtrl         DebuggerStatus      = "DebuggerStatus";

            string msg = DbgConsoleEntry.getValue();

            if (msg != "")
            {
                DebuggerConsoleView.print("" + msg);
                if (DebuggerStatus.getValue() == "NOT CONNECTED")
                {
                    DebuggerConsoleView.print("*** Not connected.");
                }
                else if (DebuggerStatus.getValue() == "BREAK")
                {
                    DebuggerConsoleView.print("*** Target is in BREAK mode.");
                }
                else
                {
                    TCPDebugger.send("CEVAL " + msg + "\r\n");
                }
            }
            DbgConsoleEntry.setValue("");
        }
        public void unselectDatablock(string datablock, bool dontSyncTree)
        {
            GuiTreeViewCtrl       DatablockEditorTree            = "DatablockEditorTree";
            GuiInspector          DatablockEditorInspector       = "DatablockEditorInspector";
            GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";

            DatablockEditorInspector.removeInspect(datablock);

            if (!dontSyncTree)
            {
                int id = DatablockEditorTree.findItemByValue(datablock.getID().AsString());
                DatablockEditorTree.selectItem(id, false);
            }

            this.syncDirtyState();

            // If we have exactly one selected datablock remaining, re-enable
            // the save-as button.

            int numSelected = this.getNumSelectedDatablocks();

            if (numSelected == 1)
            {
                ((GuiBitmapButtonCtrl)DatablockEditorInspectorWindow.findObjectByInternalName("saveAsButton", true)).setActive(true);

                GuiTextEditCtrl fileNameField = DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile", true);
                fileNameField.setText(((SimObject)this.getSelectedDatablock()).getFilename());
                fileNameField.setActive(true);
            }

            EditorGuiStatusBar.setSelection(this.getNumSelectedDatablocks() + " Datablocks Selected");
        }
Exemple #10
0
        public static void InspectVars(string filter = "*")
        {
            MenuHandlers.EditorHelpMenu DiagnosticMenu = "DiagnosticMenu";
            GuiTextEditCtrl             txtFilter      = "txtFilter";

            txtFilter.setText(filter);

            ConsoleVarDlg ConsoleVarDlg = "ConsoleVarDlg";

            if (!ConsoleVarDlg.isAwake())
            {
                ((GuiCanvas)"Canvas").pushDialog("ConsoleVarDlg", 100);
                DiagnosticMenu.checkItem(2, true);
            }
            else
            {
                if (((GuiWindowCtrl)"ConsoleVarDlgWindow").isInPopup)
                {
                    ((GuiWindowCtrl)"ConsoleVarDlgWindow").ClosePopOut();
                }
                ((GuiCanvas)"Canvas").popDialog("ConsoleVarDlg");
                DiagnosticMenu.checkItem(2, false);
            }

            GuiVariableInspector GuiVariableInspector = "ConsoleVarInspector";

            GuiVariableInspector.loadVars(filter);
        }
            public override void onClick(string SelectedidString)
            {
                ETransformSelection ETransformSelection = "ETransformSelection";

                GuiTextEditCtrl SizeX = ETransformSelection.FOT("SizeX");
                GuiTextEditCtrl SizeY = ETransformSelection.FOT("SizeY");
                GuiTextEditCtrl SizeZ = ETransformSelection.FOT("SizeZ");

                if (this.getValue().AsInt() == 1)
                {
                    string scalex = SizeX.getValue();
                    SizeY.setValue(scalex);
                    SizeZ.setValue(scalex);

                    SizeY.setActive(false);
                    SizeZ.setActive(false);
                }
                else
                {
                    SizeY.setActive(true);
                    SizeZ.setActive(true);
                }

                base.onClick(SelectedidString);
            }
            public override void onSelect(string id, string y)
            {
                GuiEditorProfileInspector GuiEditorProfileInspector = "GuiEditorProfileInspector";
                GuiTextEditCtrl           GuiEditorProfileFileName  = "GuiEditorProfileFileName";
                ProfilePane ProfilePane = "ProfilePane";

                GuiControlProfile obj = this.getItemValue(id.AsInt());

                if (obj == 0)
                {
                    return;
                }

                GuiEditorProfileInspector.inspect(obj);

                ProfilePane.onProfileSelected();

                string fileName = obj.getFilename();

                if (fileName == "")
                {
                    fileName = sGlobal["$GUI_EDITOR_DEFAULT_PROFILE_FILENAME"];
                }

                GuiEditorProfileFileName.setText(fileName);
            }
            public override void onValidate()
            {
                ETransformSelectionScaleProportional ETransformSelectionScaleProportional =
                    "ETransformSelectionScaleProportional";
                ETransformSelectionSizeProportional ETransformSelectionSizeProportional =
                    "ETransformSelectionSizeProportional";
                ETransformSelection ETransformSelection = "ETransformSelection";

                GuiTextEditCtrl ScaleX = ETransformSelection.FOT("ScaleX");
                GuiTextEditCtrl ScaleY = ETransformSelection.FOT("ScaleY");
                GuiTextEditCtrl ScaleZ = ETransformSelection.FOT("ScaleZ");
                GuiTextEditCtrl SizeX  = ETransformSelection.FOT("SizeX");
                GuiTextEditCtrl SizeY  = ETransformSelection.FOT("SizeY");
                GuiTextEditCtrl SizeZ  = ETransformSelection.FOT("SizeZ");

                if (this.getInternalName() == "ScaleX" && ETransformSelectionScaleProportional.getValue().AsBool())
                {
                    // Set the Y and Z values to match
                    string scalex = ScaleX.getValue();
                    ScaleY.setValue(scalex);
                    ScaleZ.setValue(scalex);
                }

                if (this.getInternalName() == "SizeX" && ETransformSelectionSizeProportional.getValue().AsBool())
                {
                    // Set the Y and Z values to match
                    string sizex = SizeX.getValue();
                    SizeY.setValue(sizex);
                    SizeZ.setValue(sizex);
                }
            }
        public void getAbsScale()
        {
            EWorldEditor    EWorldEditor = "EWorldEditor";
            GuiCheckBoxCtrl ETransformSelectionScaleProportional = "ETransformSelectionScaleProportional";

            GuiCheckBoxCtrl DoScale       = this.FOT("DoScale");
            GuiCheckBoxCtrl ScaleRelative = this.FOT("ScaleRelative");
            GuiTextEditCtrl ScaleX        = this.FOT("ScaleX");
            GuiTextEditCtrl ScaleY        = this.FOT("ScaleY");
            GuiTextEditCtrl ScaleZ        = this.FOT("ScaleZ");

            int count = EWorldEditor.getSelectionSize();

            // If we have more than one SceneObject selected,
            // we must exit.
            SimObject obj = -1;

            for (int i = 0; i < count; i++)
            {
                SimObject test = EWorldEditor.getSelectedObject(i);
                if (test.isMemberOfClass("SceneObject"))
                {
                    if (obj != -1)
                    {
                        return;
                    }

                    obj = test;
                }
            }

            if (obj == -1)
            {
                // No SceneObjects selected
                return;
            }

            string scale  = obj["scale"];
            string scalex = Util.getWord(scale, 0);

            ScaleX.setText(scalex);
            if (!ETransformSelectionScaleProportional.getValue().AsBool())
            {
                ScaleY.setText(Util.getWord(scale, 1));
                ScaleZ.setText(Util.getWord(scale, 2));
            }
            else
            {
                ScaleY.setText(scalex);
                ScaleZ.setText(scalex);
            }

            // Turn off relative as we're populating absolute values
            ScaleRelative.setValue("0");

            // Finally, set the Scale check box as active.  The user
            // likely wants this if they're getting the position.
            DoScale.setValue("1");
        }
        public override void onWake()
        {
            GuiSliderCtrl   slider        = this.findObjectByInternalName("slider", true);
            GuiTextEditCtrl SlopeMinAngle =
                ((GuiControl)"PaintBrushSlopeControl").findObjectByInternalName("SlopeMinAngle", true);

            slider.setValue(SlopeMinAngle.getValue());
        }
            public override void onUnselect(int itemOrObjectId)
            {
                GuiEditorProfileInspector GuiEditorProfileInspector = "GuiEditorProfileInspector";
                GuiTextEditCtrl           GuiEditorProfileFileName  = "GuiEditorProfileFileName";

                GuiEditorProfileInspector.inspect("0");
                GuiEditorProfileFileName.setText("");
            }
        public static void setTerrainEditorMaxSlope(float value)
        {
            TerrainEditor   ETerrainEditor = "ETerrainEditor";
            float           val            = ETerrainEditor.setSlopeLimitMaxAngle(value);
            GuiTextEditCtrl SlopeMaxAngle  =
                ((GuiControl)"PaintBrushSlopeControl").findObjectByInternalName("SlopeMaxAngle", true);

            SlopeMaxAngle.setValue(omni.Util.mFloatLength(val, 1));
        }
        public void loadDialog(GuiControl ctrl)
        {
            GuiCanvas       Canvas       = "Canvas";
            GuiTextEditCtrl fontSizeText = "fontSizeText";

            this["ctrl"]        = ctrl;
            this["oldFontSize"] = ctrl.getControlFontSize().AsString();
            Canvas.pushDialog(this);
            fontSizeText.text = this["oldFontSize"];
        }
        public void loadDialog(GuiWindowCtrl ctrl)
        {
            GuiCanvas       Canvas    = "Canvas";
            GuiTextEditCtrl TitleText = "TitleText";

            this.ctrl            = ctrl;
            this["oldTitleName"] = ctrl.getWindowTitle();
            Canvas.pushDialog(this);
            TitleText.text = this["oldTitleName"];
        }
        public override void onWake()
        {
            GuiTextEditCtrl MeshName     = FOT("MeshName");
            GuiTextEditCtrl MeshPosition = FOT("MeshPosition");
            GuiTextEditCtrl MeshScale    = FOT("MeshScale");

            MeshName.setText("Nav");
            MeshPosition.setText("0 0 0");
            MeshScale.setText("50 50 20");
        }
        public void onCancelClicked( )
        {
            GuiTextEditCtrl textEdit = FOT("textEdit");

            if (cancelCallback != "")
            {
                Util.eval(cancelCallback + "(" + associatedButton + ", " + textEdit.getText() + ");");
            }
            ((canvas)"Canvas").popDialog(this);
        }
Exemple #22
0
        public void setActiveMaterial(TerrainMaterial mat)
        {
            if (mat.isObject())
            {
                GuiTextEditCtrl matNameCtrl        = this.findObjectByInternalName("matNameCtrl", true);
                GuiBitmapCtrl   baseTexCtrl        = this.findObjectByInternalName("baseTexCtrl", true);
                GuiBitmapCtrl   detailTexCtrl      = this.findObjectByInternalName("detailTexCtrl", true);
                GuiBitmapCtrl   macroTexCtrl       = this.findObjectByInternalName("macroTexCtrl", true);
                GuiBitmapCtrl   normTexCtrl        = this.findObjectByInternalName("normTexCtrl", true);
                GuiTextEditCtrl detSizeCtrl        = this.findObjectByInternalName("detSizeCtrl", true);
                GuiTextEditCtrl baseSizeCtrl       = this.findObjectByInternalName("baseSizeCtrl", true);
                GuiTextEditCtrl detStrengthCtrl    = this.findObjectByInternalName("detStrengthCtrl", true);
                GuiTextEditCtrl detDistanceCtrl    = this.findObjectByInternalName("detDistanceCtrl", true);
                GuiCheckBoxCtrl sideProjectionCtrl = this.findObjectByInternalName("sideProjectionCtrl", true);
                GuiTextEditCtrl parallaxScaleCtrl  = this.findObjectByInternalName("parallaxScaleCtrl", true);

                GuiTextEditCtrl macroSizeCtrl     = this.findObjectByInternalName("macroSizeCtrl", true);
                GuiTextEditCtrl macroStrengthCtrl = this.findObjectByInternalName("macroStrengthCtrl", true);
                GuiTextEditCtrl macroDistanceCtrl = this.findObjectByInternalName("macroDistanceCtrl", true);

                //TerrainPainterAddition
                GuiTextEditCtrl terrainFolderCtrl = FOT("terrainFolderCtrl");

                this["activeMat"] = mat;

                matNameCtrl.setText(mat.internalName);

                baseTexCtrl.setBitmapX(mat.diffuseMap == "" ? "tools/materialeditor/gui/unknownImage" : mat.diffuseMap);
                detailTexCtrl.setBitmapX(mat.detailMap == "" ? "tools/materialeditor/gui/unknownImage" : mat.detailMap);
                macroTexCtrl.setBitmapX(mat.macroMap == "" ? "tools/materialeditor/gui/unknownImage" : mat.macroMap);
                normTexCtrl.setBitmapX(mat.normalMap == "" ? "tools/materialeditor/gui/unknownImage" : mat.normalMap);

                detSizeCtrl.setText(mat.detailSize.AsString());
                baseSizeCtrl.setText(mat.diffuseSize.AsString());
                detStrengthCtrl.setText(mat.detailStrength.AsString());
                detDistanceCtrl.setText(mat.detailDistance.AsString());
                sideProjectionCtrl.setValue(mat.useSideProjection.AsString());
                parallaxScaleCtrl.setText(mat.parallaxScale.AsString());

                macroSizeCtrl.setText(mat.macroSize.AsString());
                macroStrengthCtrl.setText(mat.macroStrength.AsString());
                macroDistanceCtrl.setText(mat.macroDistance.AsString());

                //TerrainPainterAddition
                terrainFolderCtrl.setText(mat["terrainFolder"]);
                activateMaterialCtrls(true);
            }
            else
            {
                this["activeMat"] = "0";
                activateMaterialCtrls(false);
            }
        }
        // this is called from ColorBlendSelect.updateColor
        public static void updateRGBValues(bool location)
        {
            GuiColorPickerCtrl  ColorBlendSelect = "ColorBlendSelect";
            GuiTextEditCtrl     Channel_R_Val    = "Channel_R_Val";
            GuiTextEditCtrl     Channel_G_Val    = "Channel_G_Val";
            GuiTextEditCtrl     Channel_B_Val    = "Channel_B_Val";
            GuiSwatchButtonCtrl myColor          = "myColor";

            string pickColor;

            //update the color based on where it came from
            if (omni.bGlobal["$ColorPickerSignal"] && location)
            {
                pickColor = ColorBlendSelect.baseColor.AsString();
            }
            else
            {
                pickColor = ColorBlendSelect.pickColor.AsString();
            }

            //lets prepare the color
            string red   = omni.Util.getWord(pickColor, 0);
            string green = omni.Util.getWord(pickColor, 1);
            string blue  = omni.Util.getWord(pickColor, 2);
            //the alpha should be grabbed from mycolor
            string alpha = omni.Util.getWord(myColor.color.AsString(), 3);

            // set the color!
            myColor.color = (red + " " + green + " " + blue + " " + alpha).AsColorF();

            DoColorPickerUpdateCallback();

            //update differently depending on type
            if (omni.iGlobal["$ColorCallbackType"] == 1)
            {
                red   = omni.Util.mCeil(red.AsFloat() * 255).AsString();
                blue  = omni.Util.mCeil(blue.AsFloat() * 255).AsString();
                green = omni.Util.mCeil(green.AsFloat() * 255).AsString();
            }
            else
            {
                red   = omni.Util.mFloatLength(red.AsFloat(), 3);
                blue  = omni.Util.mFloatLength(blue.AsFloat(), 3);
                green = omni.Util.mFloatLength(green.AsFloat(), 3);
            }

            // changes current color values
            Channel_R_Val.setValue(red);
            Channel_G_Val.setValue(green);
            Channel_B_Val.setValue(blue);

            omni.bGlobal["$ColorPickerSignal"] = false;
        }
        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);
        }
        public void getAbsRotation()
        {
            EWorldEditor EWorldEditor = "EWorldEditor";

            GuiCheckBoxCtrl DoRotation  = this.FOT("DoRotation");
            GuiCheckBoxCtrl RotRelative = this.FOT("RotRelative");
            GuiCheckBoxCtrl RotLocal    = this.FOT("RotLocal");
            GuiTextEditCtrl Bank        = this.FOT("Bank");
            GuiTextEditCtrl Pitch       = this.FOT("Pitch");
            GuiTextEditCtrl Heading     = this.FOT("Heading");

            int count = EWorldEditor.getSelectionSize();

            // If we have more than one SceneObject selected,
            // we must exit.
            SimObject obj = -1;

            for (int i = 0; i < count; i++)
            {
                SimObject test = EWorldEditor.getSelectedObject(i);
                if (test.isMemberOfClass("SceneObject"))
                {
                    if (obj != -1)
                    {
                        return;
                    }

                    obj = test;
                }
            }

            if (obj == -1)
            {
                // No SceneObjects selected
                return;
            }

            string rot = obj.call("getEulerRotation");

            Pitch.setText(Util.getWord(rot, 0));
            Bank.setText(Util.getWord(rot, 1));
            Heading.setText(Util.getWord(rot, 2));

            // Turn off relative as we're populating absolute values.
            // Of course this means that we need to set local on.
            RotRelative.setValue("0");
            RotLocal.setValue("1");

            // Finally, set the Rotation check box as active.  The user
            // likely wants this if they're getting the position.
            DoRotation.setValue("1");
        }
Exemple #26
0
            public override void onClick(string SelectedidString)
            {
                GuiTextEditCtrl txtFilter = "txtFilter";
                string          filter    = txtFilter.getText().Trim();

                if (!filter.EndsWith("*"))
                {
                    filter += "*";
                }
                GuiVariableInspector GuiVariableInspector = "ConsoleVarInspector";

                GuiVariableInspector.loadVars(filter);
            }
Exemple #27
0
        public static void DbgFileViewFind()
        {
            DebuggerFileView DebuggerFileView       = "DebuggerFileView";
            GuiTextEditCtrl  DebuggerFindStringText = "DebuggerFindStringText";
            GuiCanvas        Canvas          = "Canvas";
            DebuggerFindDlg  DebuggerFindDlg = "DebuggerFindDlg";

            string searchString = DebuggerFindStringText.getValue();

            DebuggerFileView.findString(searchString);

            Canvas.popDialog(DebuggerFindDlg);
        }
Exemple #28
0
        public void onSelectFile()
        {
            if (sGlobal["$pref::WorldEditor::AddFMODProjectDlg::lastPath"] == "")
            {
                sGlobal["$pref::WorldEditor::AddFMODProjectDlg::lastPath"] = Util.getMainDotCsDir();
            }

            var ofd = new System.Windows.Forms.OpenFileDialog
            {
                Title            = @"Select Compiled FMOD Designer Event File...",
                InitialDirectory = sGlobal["$pref::WorldEditor::AddFMODProjectDlg::lastPath"],
                FileName         = ((GuiTextEditCtrl)this.findObjectByInternalName("fileNameField", true)).getText(),
                Filter           = @"Compiled Event Files (*.fev)|*.fev|All Files (*.*)|*.*",
                CheckFileExists  = true,
                Multiselect      = false,
            };

            string file = "";

            DialogResult dr = Dialogs.OpenFileDialog(ref ofd);

            switch (dr)
            {
            case DialogResult.OK:
                file = Dialogs.GetForwardSlashFile(ofd.FileName);
                sGlobal["$pref::WorldEditor::AddFMODProjectDlg::lastPath"] = Util.filePath(file);
                break;

            case DialogResult.Abort:
            case DialogResult.Ignore:
            case DialogResult.No:
            case DialogResult.Cancel:
            case DialogResult.None:
                return;
            }

            file = Util.makeRelativePath(file, Util.getMainDotCsDir());

            ((GuiTextCtrl)this.findObjectByInternalName("fileNameField", true)).setText(file);

            GuiTextEditCtrl projectNameField = this.findObjectByInternalName("projectNameField", true);

            if (projectNameField.getText() == "")
            {
                string projectName = "fmod" + Util.fileBase(file);
                if (Util.isValidObjectName(projectNameField))
                {
                    projectNameField.setText(projectName);
                }
            }
        }
Exemple #29
0
        public void selectDatablock(SimObject datablock, bool add = false, bool dontSyncTree = false)
        {
            GuiTreeViewCtrl       DatablockEditorTree            = "DatablockEditorTree";
            GuiInspector          DatablockEditorInspector       = "DatablockEditorInspector";
            GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";

            if (add)
            {
                DatablockEditorInspector.addInspect(datablock);
            }
            else
            {
                DatablockEditorInspector.inspect(datablock);
            }

            if (!dontSyncTree)
            {
                int id = DatablockEditorTree.findItemByValue(datablock);

                if (!add)
                {
                    DatablockEditorTree.clearSelection();
                }

                DatablockEditorTree.selectItem(id, true);
                DatablockEditorTree.scrollVisible(id);
            }

            this.syncDirtyState();

            // Update the filename text field.

            int             numSelected   = this.getNumSelectedDatablocks();
            GuiTextEditCtrl fileNameField = DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile",
                                                                                                    true);

            if (numSelected == 1)
            {
                string fileName = datablock.getFilename();
                fileNameField.setText(fileName != "" ? fileName : omni.sGlobal["$DATABLOCK_EDITOR_DEFAULT_FILENAME"]);
            }
            else
            {
                fileNameField.setText("");
            }

            EditorGuiStatusBar.setSelection(this.getNumSelectedDatablocks() + " Datablocks Selected");
        }
        // This function pushes the color picker dialog and returns to a callback the selected value
        public static void GetColorI(string currentColor, string callback, string root, string updateCallback,
                                     string cancelCallback)
        {
            GuiSwatchButtonCtrl oldColor         = "oldColor";
            GuiSwatchButtonCtrl myColor          = "myColor";
            GuiColorPickerCtrl  ColorRangeSelect = "ColorRangeSelect";
            GuiColorPickerCtrl  ColorBlendSelect = "ColorBlendSelect";
            GuiSliderCtrl       ColorAlphaSelect = "ColorAlphaSelect";
            GuiCanvas           Canvas           = "Canvas";
            GuiTextEditCtrl     Channel_A_Val    = "Channel_A_Val";
            ColorPickerDlg      ColorPickerDlg   = "ColorPickerDlg";

            omni.bGlobal["$ColorPickerSignal"]         = true;
            omni.sGlobal["$ColorPickerCallback"]       = callback;
            omni.sGlobal["$ColorPickerCancelCallback"] = cancelCallback;
            omni.sGlobal["$ColorPickerUpdateCallback"] = updateCallback;
            omni.iGlobal["$ColorCallbackType"]         = 1; // ColorI

            oldColor.color = ColorIntToFloat(currentColor).AsColorF();
            myColor.color  = ColorIntToFloat(currentColor).AsColorF();

            ColorRangeSelect.showReticle = true;
            ColorBlendSelect.showReticle = true;

            // Set the range according to int
            ColorAlphaSelect.range = "0 255".AsPoint2F();

            // Set the RGBA displays accordingly
            float red   = omni.Util.getWord(currentColor, 0).AsFloat() / 255;
            float green = omni.Util.getWord(currentColor, 1).AsFloat() / 255;
            float blue  = omni.Util.getWord(currentColor, 2).AsFloat() / 255;
            float alpha = omni.Util.getWord(currentColor, 3).AsFloat();

            // set the initial range blend to correct color, no alpha needed
            // this should also set the color blend select right now
            ColorRangeSelect.baseColor = (red.AsString() + " " + green.AsString() + " " + blue.AsString() + " " + "1.0").AsColorF();
            ColorRangeSelect.updateColor();

            if (!root.isObject())
            {
                root = Canvas;
            }

            ((GuiCanvas)root).pushDialog(ColorPickerDlg);

            // update the alpha value first
            ColorAlphaSelect.setValue(alpha.AsString());
            Channel_A_Val.setText(alpha.AsString());
        }