예제 #1
0
            public void loadNewEmitter(string emitter)
            {
                ParticleEditor      ParticleEditor      = "ParticleEditor";
                GuiPopUpMenuCtrl    PEE_EmitterSelector = "PEE_EmitterSelector";
                ParticleEmitterData PE_EmitterEditor_NotDirtyEmitter = "PE_EmitterEditor_NotDirtyEmitter";

                ParticleParticleEditor.PE_ParticleEditor PE_ParticleEditor = "PE_ParticleEditor";

                GuiCheckBoxCtrl PEE_infiniteLoop = this.FOT("PEE_infiniteLoop");

                SimObject current;

                if (emitter.isObject())
                {
                    current = emitter.getID();
                }
                else
                {
                    current = PEE_EmitterSelector.getSelected();
                }

                this.currEmitter = current;
                PE_EmitterEditor_NotDirtyEmitter.assignFieldsFrom(current);
                PE_EmitterEditor_NotDirtyEmitter["originalName"] = current["name"];

                this.guiSync();
                this.setEmitterNotDirty();

                PE_ParticleEditor.loadNewParticle(Util.getWord(current["particles"], 0));

                ParticleEditor.updateEmitterNode();

                PEE_infiniteLoop.setStateOn(current["lifetimeMS"].AsInt() == 0);
            }
        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");
        }
예제 #3
0
        public virtual void initClassList()
        {
            ArrayObject classArray = new ObjectCreator("ArrayObject").Create();

            this["classArray"] = classArray;

            // Add all classes to the array.

            string classes = Util._call("enumerateConsoleClasses");

            foreach (string className in classes.Split('\t'))
            {
                if (!includeClass(className))
                {
                    continue;
                }

                classArray.push_back(className, "true");
            }
            // Sort the class list.
            classArray.sortk(true);

            // Add checkboxes for all classes to the list.

            GuiStackControl classList = findObjectByInternalName("classList", true);
            int             count     = classArray.count();

            for (int i = 0; i < count; i++)
            {
                string className  = classArray.getKey(i);
                int    textLength = className.Length;
                string text       = " " + className;

                ObjectCreator oc = new ObjectCreator("GuiCheckBoxCtrl");
                oc["canSaveDynamicFields"] = "0";
                oc["isContainer"]          = "0";
                oc["Profile"]          = "ToolsGuiCheckBoxListFlipedProfile";
                oc["HorizSizing"]      = "right";
                oc["VertSizing"]       = "bottom";
                oc["Position"]         = "0 0";
                oc["Extent"]           = (textLength * 4) + " 18";
                oc["MinExtent"]        = "8 2";
                oc["canSave"]          = "0";
                oc["Visible"]          = "1";
                oc["tooltipprofile"]   = "ToolsGuiToolTipProfile";
                oc["hovertime"]        = "1000";
                oc["tooltip"]          = "Include/exclude all " + className + " objects.";
                oc["text"]             = text;
                oc["groupNum"]         = "-1";
                oc["buttonType"]       = "ToggleButton";
                oc["useMouseEvents"]   = "0";
                oc["useInactiveState"] = "0";
                oc["command"]          = classArray + ".setValue( $ThisControl.getValue(), " + i + " );";

                GuiCheckBoxCtrl checkBox = oc.Create();
                checkBox.setStateOn(true);
                classList.addGuiControl(checkBox);
            }
        }
        public void RotRelativeChanged()
        {
            GuiCheckBoxCtrl RotRelative = this.FOT("RotRelative");
            GuiCheckBoxCtrl RotLocal    = this.FOT("RotLocal");

            if (RotRelative.getValue().AsInt() == 0)
            {
                // With absolute rotation, it must happen locally
                RotLocal.setStateOn(true);
            }
        }
        public void RotLocalChanged()
        {
            GuiCheckBoxCtrl RotRelative = this.FOT("RotRelative");
            GuiCheckBoxCtrl RotLocal    = this.FOT("RotLocal");

            if (RotLocal.getValue().AsInt() == 0)
            {
                // Non-local rotation can only happen relatively
                RotRelative.setStateOn(true);
            }
        }
예제 #6
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);
            }
        }
        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");
        }
예제 #9
0
        public void createDatablock()
        {
            GuiTreeViewCtrl DatablockEditorTypeTree     = "DatablockEditorTypeTree";
            GuiControl      DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt";

            string className = DatablockEditorTypeTree.getItemText(DatablockEditorTypeTree.getSelectedItem());

            if (className != "")
            {
                // Need to prompt for a name.

                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .setText("Name");
                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .selectAllText();

                // Populate the copy source dropdown.

                GuiPopUpMenuCtrl list = DatablockEditorCreatePrompt.findObjectByInternalName("CopySourceDropdown",
                                                                                             true);
                list.clear();
                list.add("", 0);

                SimSet set   = "DataBlockSet";
                int    count = set.getCount();
                for (uint i = 0; i < count; i++)
                {
                    SimObject datablock      = set.getObject(i);
                    string    datablockClass = datablock.getClassName();

                    if (!Util.isMemberOfClass(datablockClass, className))
                    {
                        continue;
                    }

                    list.add(datablock.getName(), ((int)i + 1));
                }

                // Set up state of client-side checkbox.

                GuiCheckBoxCtrl clientSideCheckBox =
                    DatablockEditorCreatePrompt.findObjectByInternalName("ClientSideCheckBox", true);
                bool canBeClientSide = this.canBeClientSideDatablock(className);
                clientSideCheckBox.setStateOn(canBeClientSide);
                clientSideCheckBox.setActive(canBeClientSide);

                // Show the dialog.

                ((GuiCanvas)"canvas").pushDialog(DatablockEditorCreatePrompt, 0, true);
            }
        }
예제 #10
0
        public void updateOptions()
        {
            GuiStackControl theVisOptionsList = this.findObjectByInternalName("theVisOptionsList", true);

            theVisOptionsList.clear();

            // Go through all the
            // parameters in our array and
            // create a check box for each.
            for (int i = 0; i < array.count(); i++)
            {
                string text           = "  " + array.getValue(i);
                string val            = array.getKey(i);
                string var            = Util.getWord(val, 0);
                string toggleFunction = Util.getWord(val, 1);

                int textLength = text.Length;

                string cmd = "";

                if (toggleFunction != "")
                {
                    cmd = toggleFunction + "( $thisControl.getValue() );";
                }

                ObjectCreator oc = new ObjectCreator("GuiCheckBoxCtrl");
                oc["canSaveDynamicFields"] = "0";
                oc["isContainer"]          = "0";
                oc["Profile"]          = "ToolsGuiCheckBoxListProfile";
                oc["HorizSizing"]      = "right";
                oc["VertSizing"]       = "bottom";
                oc["Position"]         = "0 0";
                oc["Extent"]           = (textLength * 4) + " 18";
                oc["MinExtent"]        = "8 2";
                oc["canSave"]          = "1";
                oc["Visible"]          = "1";
                oc["Variable"]         = var;
                oc["tooltipprofile"]   = "ToolsGuiToolTipProfile";
                oc["hovertime"]        = "1000";
                oc["text"]             = text;
                oc["groupNum"]         = "-1";
                oc["buttonType"]       = "ToggleButton";
                oc["useMouseEvents"]   = "0";
                oc["useInactiveState"] = "0";
                oc["Command"]          = cmd;

                GuiCheckBoxCtrl ctrl = oc.Create();

                theVisOptionsList.addGuiControl(ctrl);
            }
        }
예제 #11
0
        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();
        }
예제 #12
0
        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();
        }
        public void getAbsPosition()
        {
            EWorldEditor EWorldEditor = "EWorldEditor";

            GuiCheckBoxCtrl DoPosition  = this.FOT("DoPosition");
            GuiCheckBoxCtrl PosRelative = this.FOT("PosRelative");
            GuiTextEditCtrl PosY        = this.FOT("PosY");
            GuiTextEditCtrl PosX        = this.FOT("PosX");
            GuiTextEditCtrl PosZ        = this.FOT("PosZ");

            string pos = EWorldEditor.getSelectionCentroid();

            PosX.setText(Util.getWord(pos, 0));
            PosY.setText(Util.getWord(pos, 1));
            PosZ.setText(Util.getWord(pos, 2));

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

            // Finally, set the Position check box as active.  The user
            // likely wants this if they're getting the position.
            DoPosition.setValue("1");
        }
        public override void onWake()
        {
            EWorldEditor EWorldEditor = "EWorldEditor";

            GuiCheckBoxCtrl PosRelative    = this.FOT("PosRelative");
            GuiCheckBoxCtrl RotRelative    = this.FOT("RotRelative");
            GuiCheckBoxCtrl ScaleRelative  = this.FOT("ScaleRelative");
            GuiCheckBoxCtrl SizeRelative   = this.FOT("SizeRelative");
            GuiButtonCtrl   GetPosButton   = this.FOT("GetPosButton");
            GuiButtonCtrl   GetRotButton   = this.FOT("GetRotButton");
            GuiButtonCtrl   GetScaleButton = this.FOT("GetScaleButton");
            GuiButtonCtrl   GetSizeButton  = this.FOT("GetSizeButton");
            GuiCheckBoxCtrl SizeLocal      = this.FOT("SizeLocal");
            GuiTabBookCtrl  ScaleTabBook   = this.FOT("ScaleTabBook");
            GuiButtonCtrl   ApplyButton    = this.FOT("ApplyButton");

            // Make everything relative
            PosRelative.setStateOn(true);
            RotRelative.setStateOn(true);
            ScaleRelative.setStateOn(true);
            SizeRelative.setStateOn(false);

            GetPosButton.setActive(false);
            GetRotButton.setActive(false);
            GetScaleButton.setActive(false);
            GetSizeButton.setActive(false);

            // Size is always local
            SizeLocal.setStateOn(true);
            SizeLocal.setActive(false);

            ScaleTabBook.selectPage(0); // Scale page

            ApplyButton.setActive(false);

            EWorldEditor["ETransformSelectionDisplayed"] = false.AsString();
        }
            public void updateLifeFieldsInfiniteLoop()
            {
                GuiCheckBoxCtrl PEE_infiniteLoop = this.FOT("PEE_infiniteLoop");
                GuiTextEditCtrl PEE_lifetimeVarianceMS_textEdit = this.FOT("PEE_lifetimeVarianceMS_textEdit");
                GuiTextEditCtrl PEE_lifetimeMS_textEdit         = this.FOT("PEE_lifetimeMS_textEdit");
                ParticleEditor  ParticleEditor = "ParticleEditor";

                SimObject emitter   = this.currEmitter;
                bool      isEnabled = PEE_infiniteLoop.isStateOn();

                // Submit undo.

                var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields>("Update Active Emitter");

                action["emitter"] = emitter;

                if (isEnabled)
                {
                    action["newValueLifetimeMS"]         = "0";
                    action["newvalueLifetimeVarianceMS"] = "0";
                    action["oldValueLifetimeMS"]         = PEE_lifetimeMS_textEdit.getText();
                    action["oldValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                }
                else
                {
                    action["newValueLifetimeMS"]         = PEE_lifetimeMS_textEdit.getText();
                    action["newvalueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                    action["oldValueLifetimeMS"]         = "0";
                    action["oldValueLifetimeVarianceMS"] = "0";
                }

                ParticleEditor.submitUndo(action);

                // Execute action.

                action.redo();
            }
        public void setSequence(string seqName)
        {
            CodeBehind.ShapeEditor.ShapeEdThreadWindow ShapeEdThreadWindow = "ShapeEdThreadWindow";
            GuiCheckBoxCtrl  useTransitions   = ShapeEdThreadWindow.FOT("useTransitions");
            GuiTextEditCtrl  transitionTime   = ShapeEdThreadWindow.FOT("transitionTime");
            GuiPopUpMenuCtrl transitionTo     = ShapeEdThreadWindow.FOT("transitionTo");
            GuiPopUpMenuCtrl transitionTarget = ShapeEdThreadWindow.FOT("transitionTarget");

            CodeBehind.ShapeEditor.ShapeEdThreadSlider ShapeEdThreadSlider = "ShapeEdThreadSlider";
            CodeBehind.ShapeEditor.ShapeEdShapeView    ShapeEdShapeView    = "ShapeEdShapeView";
            CodeBehind.ShapeEditor ShapeEditor = "ShapeEditor";

            float transPos;
            float transTime;
            bool  transPlay;

            this.usingProxySeq = false;

            if (useTransitions.getValue().AsBool())
            {
                transTime = transitionTime.getText().AsFloat();
                if (transitionTo.getText() == "synched position")
                {
                    transPos = -1;
                }
                else
                {
                    transPos = this.keyframeToThreadPos(ShapeEdThreadSlider.getValue());
                }
                transPlay = (transitionTarget.getText() == "plays during transition");
            }
            else
            {
                transTime = 0;
                transPos  = 0;
                transPlay = false;
            }

            // No transition when sequence is not changing
            if (seqName == ShapeEdShapeView.getThreadSequence())
            {
                transTime = 0;
            }

            if (seqName != "")
            {
                // To be able to effectively scrub through the animation, we need to have all
                // frames available, even if it was added with only a subset. If that is the
                // case, then create a proxy sequence that has all the frames instead.
                string sourceData = ShapeEditor.getSequenceSource(seqName);
                string from       = Util.rtrim(Util.getFields(sourceData, 0, 1));
                int    startFrame = Util.getField(sourceData, 2).AsInt();
                int    endFrame   = Util.getField(sourceData, 3).AsInt();
                int    frameCount = Util.getField(sourceData, 4).AsInt();

                if ((startFrame != 0) || (endFrame != (frameCount - 1)))
                {
                    string proxyName = ShapeEditor.getProxyName(seqName);
                    if (ShapeEditor.shape.getSequenceIndex(proxyName) != -1)
                    {
                        ShapeEditor.shape.removeSequence(proxyName);
                        ShapeEdShapeView.refreshThreadSequences();
                    }
                    ShapeEditor.shape.addSequence(from, proxyName);

                    // Limit the transition position to the in/out range
                    transPos = Util.mClamp(transPos, 0, 1);
                }
            }

            ShapeEdShapeView.setThreadSequence(seqName, transTime, transPos, transPlay);
        }
예제 #17
0
        public void addClassOptions()
        {
            GuiStackControl visList = this.findObjectByInternalName("theClassVisList", true);
            GuiStackControl selList = this.findObjectByInternalName("theClassSelList", true);

            // First clear the stack control.
            visList.clear();
            selList.clear();

            string classList  = Util._call("enumerateConsoleClasses", "SceneObject");
            int    classCount = Util.getFieldCount(classList);

            for (int i = 0; i < classCount; i++)
            {
                string className = Util.getField(classList, i);
                classArray.push_back(className, "");
            }

            // Remove duplicates and sort by key.
            this.classArray.uniqueKey();
            this.classArray.sortkd();

            // Go through all the
            // parameters in our array and
            // create a check box for each.

            for (int i = 0; i < classArray.count(); i++)
            {
                string Class = classArray.getKey(i);

                string visVar = "$" + Class + "::isRenderable";
                string selVar = "$" + Class + "::isSelectable";

                int textLength = Class.Length;

                string text = "  " + Class;

                // Add visibility toggle.

                ObjectCreator oc = new ObjectCreator("GuiCheckBoxCtrl");
                oc["canSaveDynamicFields"] = "0";
                oc["isContainer"]          = "0";
                oc["Profile"]          = "ToolsGuiCheckBoxListFlipedProfile";
                oc["HorizSizing"]      = "right";
                oc["VertSizing"]       = "bottom";
                oc["Position"]         = "0 0";
                oc["Extent"]           = (textLength * 4) + " 18";
                oc["MinExtent"]        = "8 2";
                oc["canSave"]          = "1";
                oc["Visible"]          = "1";
                oc["Variable"]         = visVar;
                oc["tooltipprofile"]   = "ToolsGuiToolTipProfile";
                oc["hovertime"]        = "1000";
                oc["tooltip"]          = "Show/hide all " + Class + " objects.";
                oc["text"]             = text;
                oc["groupNum"]         = "-1";
                oc["buttonType"]       = "ToggleButton";
                oc["useMouseEvents"]   = "0";
                oc["useInactiveState"] = "0";

                GuiCheckBoxCtrl ctrl = oc.Create();
                visList.addGuiControl(ctrl);
                // Add selectability toggle.
                oc = new ObjectCreator("GuiCheckBoxCtrl");
                oc["canSaveDynamicFields"] = "0";
                oc["isContainer"]          = "0";
                oc["Profile"]          = "ToolsGuiCheckBoxListFlipedProfile";
                oc["HorizSizing"]      = "right";
                oc["VertSizing"]       = "bottom";
                oc["Position"]         = "0 0";
                oc["Extent"]           = (textLength * 4) + " 18";
                oc["MinExtent"]        = "8 2";
                oc["canSave"]          = "1";
                oc["Visible"]          = "1";
                oc["Variable"]         = selVar;
                oc["tooltipprofile"]   = "ToolsGuiToolTipProfile";
                oc["hovertime"]        = "1000";
                oc["tooltip"]          = "Enable/disable selection of all " + Class + " objects.";
                oc["text"]             = text;
                oc["groupNum"]         = "-1";
                oc["buttonType"]       = "ToggleButton";
                oc["useMouseEvents"]   = "0";
                oc["useInactiveState"] = "0";
                ctrl = oc.Create();

                selList.addGuiControl(ctrl);
            }
        }
예제 #18
0
        // Add a new SFXParameter to the list.
        public void addParameter(SFXParameter parameter)
        {
            GuiStackControl SFXParametersStack = this.FOT("SFXParametersStack");

            #region GuiRolloutCtrl ()        oc_Newobject23

            ObjectCreator oc_Newobject23 = new ObjectCreator("GuiRolloutCtrl", "");
            oc_Newobject23["Margin"]               = "0 0 0 0";
            oc_Newobject23["DefaultHeight"]        = "40";
            oc_Newobject23["Expanded"]             = "1";
            oc_Newobject23["ClickCollapse"]        = "1";
            oc_Newobject23["HideHeader"]           = "0";
            oc_Newobject23["isContainer"]          = "1";
            oc_Newobject23["Profile"]              = "GuiRolloutProfile";
            oc_Newobject23["HorizSizing"]          = "right";
            oc_Newobject23["VertSizing"]           = "bottom";
            oc_Newobject23["position"]             = "0 0";
            oc_Newobject23["Extent"]               = "421 114";
            oc_Newobject23["MinExtent"]            = "8 2";
            oc_Newobject23["canSave"]              = "1";
            oc_Newobject23["Visible"]              = "1";
            oc_Newobject23["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject23["hovertime"]            = "1000";
            oc_Newobject23["canSaveDynamicFields"] = "0";
            oc_Newobject23["caption"]              = parameter.getInternalName();

            #region GuiControl ()        oc_Newobject22

            ObjectCreator oc_Newobject22 = new ObjectCreator("GuiControl", "");
            oc_Newobject22["isContainer"]          = "1";
            oc_Newobject22["Profile"]              = "ToolsGuiDefaultProfile";
            oc_Newobject22["HorizSizing"]          = "right";
            oc_Newobject22["VertSizing"]           = "bottom";
            oc_Newobject22["position"]             = "0 17";
            oc_Newobject22["Extent"]               = "421 94";
            oc_Newobject22["MinExtent"]            = "421 94";
            oc_Newobject22["canSave"]              = "1";
            oc_Newobject22["Visible"]              = "1";
            oc_Newobject22["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject22["hovertime"]            = "1000";
            oc_Newobject22["canSaveDynamicFields"] = "0";

            #region GuiTextCtrl ()        oc_Newobject3

            ObjectCreator oc_Newobject3 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject3["text"]                 = "Value";
            oc_Newobject3["maxLength"]            = "1024";
            oc_Newobject3["Margin"]               = "0 0 0 0";
            oc_Newobject3["Padding"]              = "0 0 0 0";
            oc_Newobject3["AnchorTop"]            = "1";
            oc_Newobject3["AnchorBottom"]         = "0";
            oc_Newobject3["AnchorLeft"]           = "1";
            oc_Newobject3["AnchorRight"]          = "0";
            oc_Newobject3["isContainer"]          = "0";
            oc_Newobject3["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject3["HorizSizing"]          = "right";
            oc_Newobject3["VertSizing"]           = "bottom";
            oc_Newobject3["position"]             = "7 4";
            oc_Newobject3["Extent"]               = "27 17";
            oc_Newobject3["MinExtent"]            = "8 2";
            oc_Newobject3["canSave"]              = "1";
            oc_Newobject3["Visible"]              = "1";
            oc_Newobject3["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject3["hovertime"]            = "1000";
            oc_Newobject3["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject3"] = oc_Newobject3;

            #region GuiTextCtrl ()        oc_Newobject4

            ObjectCreator oc_Newobject4 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject4["text"]                 = "Channel";
            oc_Newobject4["maxLength"]            = "1024";
            oc_Newobject4["Margin"]               = "0 0 0 0";
            oc_Newobject4["Padding"]              = "0 0 0 0";
            oc_Newobject4["AnchorTop"]            = "1";
            oc_Newobject4["AnchorBottom"]         = "0";
            oc_Newobject4["AnchorLeft"]           = "1";
            oc_Newobject4["AnchorRight"]          = "0";
            oc_Newobject4["isContainer"]          = "0";
            oc_Newobject4["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject4["HorizSizing"]          = "right";
            oc_Newobject4["VertSizing"]           = "bottom";
            oc_Newobject4["position"]             = "7 27";
            oc_Newobject4["Extent"]               = "45 17";
            oc_Newobject4["MinExtent"]            = "8 2";
            oc_Newobject4["canSave"]              = "1";
            oc_Newobject4["Visible"]              = "1";
            oc_Newobject4["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject4["hovertime"]            = "1000";
            oc_Newobject4["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject4"] = oc_Newobject4;

            #region GuiTextCtrl ()        oc_Newobject5

            ObjectCreator oc_Newobject5 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject5["text"]                 = "Comment";
            oc_Newobject5["maxLength"]            = "1024";
            oc_Newobject5["Margin"]               = "0 0 0 0";
            oc_Newobject5["Padding"]              = "0 0 0 0";
            oc_Newobject5["AnchorTop"]            = "1";
            oc_Newobject5["AnchorBottom"]         = "0";
            oc_Newobject5["AnchorLeft"]           = "1";
            oc_Newobject5["AnchorRight"]          = "0";
            oc_Newobject5["isContainer"]          = "0";
            oc_Newobject5["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject5["HorizSizing"]          = "right";
            oc_Newobject5["VertSizing"]           = "bottom";
            oc_Newobject5["position"]             = "7 50";
            oc_Newobject5["Extent"]               = "47 17";
            oc_Newobject5["MinExtent"]            = "8 2";
            oc_Newobject5["canSave"]              = "1";
            oc_Newobject5["Visible"]              = "1";
            oc_Newobject5["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject5["hovertime"]            = "1000";
            oc_Newobject5["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject5"] = oc_Newobject5;

            #region GuiTextCtrl ()        oc_Newobject6

            ObjectCreator oc_Newobject6 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject6["text"]                 = "Tags";
            oc_Newobject6["maxLength"]            = "1024";
            oc_Newobject6["Margin"]               = "0 0 0 0";
            oc_Newobject6["Padding"]              = "0 0 0 0";
            oc_Newobject6["AnchorTop"]            = "1";
            oc_Newobject6["AnchorBottom"]         = "0";
            oc_Newobject6["AnchorLeft"]           = "1";
            oc_Newobject6["AnchorRight"]          = "0";
            oc_Newobject6["isContainer"]          = "0";
            oc_Newobject6["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject6["HorizSizing"]          = "right";
            oc_Newobject6["VertSizing"]           = "bottom";
            oc_Newobject6["position"]             = "7 73";
            oc_Newobject6["Extent"]               = "25 17";
            oc_Newobject6["MinExtent"]            = "8 2";
            oc_Newobject6["canSave"]              = "1";
            oc_Newobject6["Visible"]              = "1";
            oc_Newobject6["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject6["hovertime"]            = "1000";
            oc_Newobject6["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject6"] = oc_Newobject6;

            #region GuiTextCtrl ()        oc_Newobject7

            ObjectCreator oc_Newobject7 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject7["text"]                 = "Min";
            oc_Newobject7["maxLength"]            = "1024";
            oc_Newobject7["Margin"]               = "0 0 0 0";
            oc_Newobject7["Padding"]              = "0 0 0 0";
            oc_Newobject7["AnchorTop"]            = "1";
            oc_Newobject7["AnchorBottom"]         = "0";
            oc_Newobject7["AnchorLeft"]           = "1";
            oc_Newobject7["AnchorRight"]          = "0";
            oc_Newobject7["isContainer"]          = "0";
            oc_Newobject7["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject7["HorizSizing"]          = "left";
            oc_Newobject7["VertSizing"]           = "bottom";
            oc_Newobject7["position"]             = "205 27";
            oc_Newobject7["Extent"]               = "17 17";
            oc_Newobject7["MinExtent"]            = "8 2";
            oc_Newobject7["canSave"]              = "1";
            oc_Newobject7["Visible"]              = "1";
            oc_Newobject7["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject7["hovertime"]            = "1000";
            oc_Newobject7["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject7"] = oc_Newobject7;

            #region GuiTextCtrl ()        oc_Newobject8

            ObjectCreator oc_Newobject8 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject8["text"]                 = "Max";
            oc_Newobject8["maxLength"]            = "1024";
            oc_Newobject8["Margin"]               = "0 0 0 0";
            oc_Newobject8["Padding"]              = "0 0 0 0";
            oc_Newobject8["AnchorTop"]            = "1";
            oc_Newobject8["AnchorBottom"]         = "0";
            oc_Newobject8["AnchorLeft"]           = "1";
            oc_Newobject8["AnchorRight"]          = "0";
            oc_Newobject8["isContainer"]          = "0";
            oc_Newobject8["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject8["HorizSizing"]          = "left";
            oc_Newobject8["VertSizing"]           = "bottom";
            oc_Newobject8["position"]             = "271 27";
            oc_Newobject8["Extent"]               = "21 17";
            oc_Newobject8["MinExtent"]            = "8 2";
            oc_Newobject8["canSave"]              = "1";
            oc_Newobject8["Visible"]              = "1";
            oc_Newobject8["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject8["hovertime"]            = "1000";
            oc_Newobject8["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject8"] = oc_Newobject8;

            #region GuiTextCtrl ()        oc_Newobject9

            ObjectCreator oc_Newobject9 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject9["text"]                 = "Initial";
            oc_Newobject9["maxLength"]            = "1024";
            oc_Newobject9["Margin"]               = "0 0 0 0";
            oc_Newobject9["Padding"]              = "0 0 0 0";
            oc_Newobject9["AnchorTop"]            = "1";
            oc_Newobject9["AnchorBottom"]         = "0";
            oc_Newobject9["AnchorLeft"]           = "1";
            oc_Newobject9["AnchorRight"]          = "0";
            oc_Newobject9["isContainer"]          = "0";
            oc_Newobject9["Profile"]              = "ToolsGuiAutoSizeTextProfile";
            oc_Newobject9["HorizSizing"]          = "left";
            oc_Newobject9["VertSizing"]           = "bottom";
            oc_Newobject9["position"]             = "340 27";
            oc_Newobject9["Extent"]               = "24 17";
            oc_Newobject9["MinExtent"]            = "8 2";
            oc_Newobject9["canSave"]              = "1";
            oc_Newobject9["Visible"]              = "1";
            oc_Newobject9["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject9["hovertime"]            = "1000";
            oc_Newobject9["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject9"] = oc_Newobject9;

            #region GuiSliderCtrl ()        oc_Newobject10

            ObjectCreator oc_Newobject10 = new ObjectCreator("GuiSliderCtrl", "");
            oc_Newobject10["range"]                = "0 1";
            oc_Newobject10["ticks"]                = "0";
            oc_Newobject10["snap"]                 = "0";
            oc_Newobject10["value"]                = "0.5";
            oc_Newobject10["isContainer"]          = "0";
            oc_Newobject10["Profile"]              = "ToolsGuiSliderProfile";
            oc_Newobject10["HorizSizing"]          = "width";
            oc_Newobject10["VertSizing"]           = "bottom";
            oc_Newobject10["position"]             = "65 5";
            oc_Newobject10["Extent"]               = "263 15";
            oc_Newobject10["MinExtent"]            = "8 2";
            oc_Newobject10["canSave"]              = "1";
            oc_Newobject10["Visible"]              = "1";
            oc_Newobject10["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject10["hovertime"]            = "1000";
            oc_Newobject10["internalName"]         = "valueSlider";
            oc_Newobject10["canSaveDynamicFields"] = "0";
            oc_Newobject10["command"]              = parameter + ".value = $thisControl.getValue();";

            #endregion

            oc_Newobject22["#Newobject10"] = oc_Newobject10;

            #region GuiTextEditCtrl ()        oc_Newobject11

            ObjectCreator oc_Newobject11 = new ObjectCreator("GuiTextEditCtrl", "");
            oc_Newobject11["historySize"]          = "0";
            oc_Newobject11["password"]             = "******";
            oc_Newobject11["tabComplete"]          = "0";
            oc_Newobject11["sinkAllKeyEvents"]     = "0";
            oc_Newobject11["passwordMask"]         = "•";
            oc_Newobject11["maxLength"]            = "1024";
            oc_Newobject11["Margin"]               = "0 0 0 0";
            oc_Newobject11["Padding"]              = "0 0 0 0";
            oc_Newobject11["AnchorTop"]            = "1";
            oc_Newobject11["AnchorBottom"]         = "0";
            oc_Newobject11["AnchorLeft"]           = "1";
            oc_Newobject11["AnchorRight"]          = "0";
            oc_Newobject11["isContainer"]          = "0";
            oc_Newobject11["Profile"]              = "ToolsGuiTextEditProfile";
            oc_Newobject11["HorizSizing"]          = "left";
            oc_Newobject11["VertSizing"]           = "bottom";
            oc_Newobject11["position"]             = "336 4";
            oc_Newobject11["Extent"]               = "39 17";
            oc_Newobject11["MinExtent"]            = "8 2";
            oc_Newobject11["canSave"]              = "1";
            oc_Newobject11["Visible"]              = "1";
            oc_Newobject11["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject11["hovertime"]            = "1000";
            oc_Newobject11["internalName"]         = "valueField";
            oc_Newobject11["canSaveDynamicFields"] = "0";
            oc_Newobject11["altCommand"]           = parameter + ".value = $thisControl.getValue();";

            #endregion

            oc_Newobject22["#Newobject11"] = oc_Newobject11;

            #region GuiBitmapButtonCtrl ()        oc_Newobject12

            ObjectCreator oc_Newobject12 = new ObjectCreator("GuiBitmapButtonCtrl", "");
            oc_Newobject12["bitmap"]               = "tools/gui/images/reset-icon";
            oc_Newobject12["autoFit"]              = "0";
            oc_Newobject12["groupNum"]             = "-1";
            oc_Newobject12["buttonType"]           = "PushButton";
            oc_Newobject12["useMouseEvents"]       = "0";
            oc_Newobject12["isContainer"]          = "0";
            oc_Newobject12["Profile"]              = "ToolsGuiDefaultProfile";
            oc_Newobject12["HorizSizing"]          = "left";
            oc_Newobject12["VertSizing"]           = "bottom";
            oc_Newobject12["position"]             = "381 4";
            oc_Newobject12["Extent"]               = "17 17";
            oc_Newobject12["MinExtent"]            = "8 2";
            oc_Newobject12["canSave"]              = "1";
            oc_Newobject12["Visible"]              = "1";
            oc_Newobject12["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject12["hovertime"]            = "1000";
            oc_Newobject12["internalName"]         = "resetButton";
            oc_Newobject12["canSaveDynamicFields"] = "0";
            oc_Newobject12["command"]              = parameter + ".reset();";

            #endregion

            oc_Newobject22["#Newobject12"] = oc_Newobject12;

            #region GuiBitmapButtonCtrl ()        oc_Newobject13

            ObjectCreator oc_Newobject13 = new ObjectCreator("GuiBitmapButtonCtrl", "");
            oc_Newobject13["bitmap"]               = "tools/gui/images/delete";
            oc_Newobject13["autoFit"]              = "0";
            oc_Newobject13["groupNum"]             = "-1";
            oc_Newobject13["buttonType"]           = "PushButton";
            oc_Newobject13["useMouseEvents"]       = "0";
            oc_Newobject13["isContainer"]          = "0";
            oc_Newobject13["Profile"]              = "ToolsGuiDefaultProfile";
            oc_Newobject13["HorizSizing"]          = "left";
            oc_Newobject13["VertSizing"]           = "bottom";
            oc_Newobject13["position"]             = "398 4";
            oc_Newobject13["Extent"]               = "17 17";
            oc_Newobject13["MinExtent"]            = "8 2";
            oc_Newobject13["canSave"]              = "1";
            oc_Newobject13["Visible"]              = "1";
            oc_Newobject13["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject13["hovertime"]            = "1000";
            oc_Newobject13["internalName"]         = "deleteButton";
            oc_Newobject13["canSaveDynamicFields"] = "0";
            oc_Newobject13["command"]              = "EManageSFXParameters.showDeleteParameterDlg( " + parameter + ");";

            #endregion

            oc_Newobject22["#Newobject13"] = oc_Newobject13;

            #region GuiPopUpMenuCtrl ()        oc_Newobject14

            ObjectCreator oc_Newobject14 = new ObjectCreator("GuiPopUpMenuCtrl", "");
            oc_Newobject14["maxPopupHeight"]       = "200";
            oc_Newobject14["sbUsesNAColor"]        = "0";
            oc_Newobject14["reverseTextList"]      = "0";
            oc_Newobject14["bitmapBounds"]         = "16 16";
            oc_Newobject14["maxLength"]            = "1024";
            oc_Newobject14["Margin"]               = "0 0 0 0";
            oc_Newobject14["Padding"]              = "0 0 0 0";
            oc_Newobject14["AnchorTop"]            = "1";
            oc_Newobject14["AnchorBottom"]         = "0";
            oc_Newobject14["AnchorLeft"]           = "1";
            oc_Newobject14["AnchorRight"]          = "0";
            oc_Newobject14["isContainer"]          = "0";
            oc_Newobject14["Profile"]              = "ToolsGuiPopUpMenuProfile";
            oc_Newobject14["HorizSizing"]          = "width";
            oc_Newobject14["VertSizing"]           = "bottom";
            oc_Newobject14["position"]             = "65 26";
            oc_Newobject14["Extent"]               = "135 18";
            oc_Newobject14["MinExtent"]            = "8 2";
            oc_Newobject14["canSave"]              = "1";
            oc_Newobject14["Visible"]              = "1";
            oc_Newobject14["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject14["hovertime"]            = "1000";
            oc_Newobject14["internalName"]         = "channelDropdown";
            oc_Newobject14["canSaveDynamicFields"] = "0";
            oc_Newobject14["command"]              = parameter + ".channel = $ThisControl.getText(); EManageSFXParameters.saveParameter( " + parameter + ");";

            #endregion

            oc_Newobject22["#Newobject14"] = oc_Newobject14;

            #region GuiTextEditCtrl ()        oc_Newobject15

            ObjectCreator oc_Newobject15 = new ObjectCreator("GuiTextEditCtrl", "");
            oc_Newobject15["historySize"]          = "0";
            oc_Newobject15["password"]             = "******";
            oc_Newobject15["tabComplete"]          = "0";
            oc_Newobject15["sinkAllKeyEvents"]     = "0";
            oc_Newobject15["passwordMask"]         = "•";
            oc_Newobject15["maxLength"]            = "1024";
            oc_Newobject15["Margin"]               = "0 0 0 0";
            oc_Newobject15["Padding"]              = "0 0 0 0";
            oc_Newobject15["AnchorTop"]            = "1";
            oc_Newobject15["AnchorBottom"]         = "0";
            oc_Newobject15["AnchorLeft"]           = "1";
            oc_Newobject15["AnchorRight"]          = "0";
            oc_Newobject15["isContainer"]          = "0";
            oc_Newobject15["Profile"]              = "ToolsGuiTextEditProfile";
            oc_Newobject15["HorizSizing"]          = "width";
            oc_Newobject15["VertSizing"]           = "bottom";
            oc_Newobject15["position"]             = "65 50";
            oc_Newobject15["Extent"]               = "350 17";
            oc_Newobject15["MinExtent"]            = "8 2";
            oc_Newobject15["canSave"]              = "1";
            oc_Newobject15["Visible"]              = "1";
            oc_Newobject15["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject15["hovertime"]            = "1000";
            oc_Newobject15["internalName"]         = "descriptionField";
            oc_Newobject15["canSaveDynamicFields"] = "0";
            oc_Newobject15["altCommand"]           = parameter + ".description = $ThisControl.getText(); EManageSFXParameters.saveParameter( " + parameter + ");";

            #endregion

            oc_Newobject22["#Newobject15"] = oc_Newobject15;

            #region GuiTextEditCtrl ()        oc_Newobject16

            ObjectCreator oc_Newobject16 = new ObjectCreator("GuiTextEditCtrl", "");
            oc_Newobject16["historySize"]          = "0";
            oc_Newobject16["password"]             = "******";
            oc_Newobject16["tabComplete"]          = "0";
            oc_Newobject16["sinkAllKeyEvents"]     = "0";
            oc_Newobject16["passwordMask"]         = "•";
            oc_Newobject16["maxLength"]            = "1024";
            oc_Newobject16["Margin"]               = "0 0 0 0";
            oc_Newobject16["Padding"]              = "0 0 0 0";
            oc_Newobject16["AnchorTop"]            = "1";
            oc_Newobject16["AnchorBottom"]         = "0";
            oc_Newobject16["AnchorLeft"]           = "1";
            oc_Newobject16["AnchorRight"]          = "0";
            oc_Newobject16["isContainer"]          = "0";
            oc_Newobject16["Profile"]              = "ToolsGuiTextEditProfile";
            oc_Newobject16["HorizSizing"]          = "width";
            oc_Newobject16["VertSizing"]           = "bottom";
            oc_Newobject16["position"]             = "65 73";
            oc_Newobject16["Extent"]               = "230 17";
            oc_Newobject16["MinExtent"]            = "8 2";
            oc_Newobject16["canSave"]              = "1";
            oc_Newobject16["Visible"]              = "1";
            oc_Newobject16["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject16["hovertime"]            = "1000";
            oc_Newobject16["internalName"]         = "tagsField";
            oc_Newobject16["canSaveDynamicFields"] = "0";
            oc_Newobject16["altCommand"]           = "EManageSFXParameters.updateParameterCategories( " + parameter +
                                                     ", $ThisControl.getText() );";

            #endregion

            oc_Newobject22["#Newobject16"] = oc_Newobject16;

            #region GuiTextEditCtrl ()        oc_Newobject17

            ObjectCreator oc_Newobject17 = new ObjectCreator("GuiTextEditCtrl", "");
            oc_Newobject17["historySize"]          = "0";
            oc_Newobject17["password"]             = "******";
            oc_Newobject17["tabComplete"]          = "0";
            oc_Newobject17["sinkAllKeyEvents"]     = "0";
            oc_Newobject17["passwordMask"]         = "•";
            oc_Newobject17["maxLength"]            = "1024";
            oc_Newobject17["Margin"]               = "0 0 0 0";
            oc_Newobject17["Padding"]              = "0 0 0 0";
            oc_Newobject17["AnchorTop"]            = "1";
            oc_Newobject17["AnchorBottom"]         = "0";
            oc_Newobject17["AnchorLeft"]           = "1";
            oc_Newobject17["AnchorRight"]          = "0";
            oc_Newobject17["isContainer"]          = "0";
            oc_Newobject17["Profile"]              = "ToolsGuiTextEditProfile";
            oc_Newobject17["HorizSizing"]          = "left";
            oc_Newobject17["VertSizing"]           = "bottom";
            oc_Newobject17["position"]             = "372 27";
            oc_Newobject17["Extent"]               = "43 17";
            oc_Newobject17["MinExtent"]            = "8 2";
            oc_Newobject17["canSave"]              = "1";
            oc_Newobject17["Visible"]              = "1";
            oc_Newobject17["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject17["hovertime"]            = "1000";
            oc_Newobject17["internalName"]         = "defaultField";
            oc_Newobject17["canSaveDynamicFields"] = "0";
            oc_Newobject17["command"]              = parameter + ".defaultValue = $ThisControl.getValue(); EManageSFXParameters.saveParameter( " + parameter + ");";

            #endregion

            oc_Newobject22["#Newobject17"] = oc_Newobject17;

            #region GuiTextEditCtrl ()        oc_Newobject18

            ObjectCreator oc_Newobject18 = new ObjectCreator("GuiTextEditCtrl", "");
            oc_Newobject18["historySize"]          = "0";
            oc_Newobject18["password"]             = "******";
            oc_Newobject18["tabComplete"]          = "0";
            oc_Newobject18["sinkAllKeyEvents"]     = "0";
            oc_Newobject18["passwordMask"]         = "•";
            oc_Newobject18["maxLength"]            = "1024";
            oc_Newobject18["Margin"]               = "0 0 0 0";
            oc_Newobject18["Padding"]              = "0 0 0 0";
            oc_Newobject18["AnchorTop"]            = "1";
            oc_Newobject18["AnchorBottom"]         = "0";
            oc_Newobject18["AnchorLeft"]           = "1";
            oc_Newobject18["AnchorRight"]          = "0";
            oc_Newobject18["isContainer"]          = "0";
            oc_Newobject18["Profile"]              = "ToolsGuiTextEditProfile";
            oc_Newobject18["HorizSizing"]          = "left";
            oc_Newobject18["VertSizing"]           = "bottom";
            oc_Newobject18["position"]             = "297 27";
            oc_Newobject18["Extent"]               = "39 17";
            oc_Newobject18["MinExtent"]            = "8 2";
            oc_Newobject18["canSave"]              = "1";
            oc_Newobject18["Visible"]              = "1";
            oc_Newobject18["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject18["hovertime"]            = "1000";
            oc_Newobject18["internalName"]         = "rangeMaxField";
            oc_Newobject18["canSaveDynamicFields"] = "0";
            oc_Newobject18["altCommand"]           = parameter + ".range = " + parameter + ".range.x SPC $ThisControl.getValue(); $ThisControl.parentGroup-->valueSlider.range = " + parameter + ".range; EManageSFXParameters.saveParameter( " + parameter + ");";

            #endregion

            oc_Newobject22["#Newobject18"] = oc_Newobject18;

            #region GuiTextEditCtrl ()        oc_Newobject19

            ObjectCreator oc_Newobject19 = new ObjectCreator("GuiTextEditCtrl", "");
            oc_Newobject19["historySize"]          = "0";
            oc_Newobject19["password"]             = "******";
            oc_Newobject19["tabComplete"]          = "0";
            oc_Newobject19["sinkAllKeyEvents"]     = "0";
            oc_Newobject19["passwordMask"]         = "•";
            oc_Newobject19["maxLength"]            = "1024";
            oc_Newobject19["Margin"]               = "0 0 0 0";
            oc_Newobject19["Padding"]              = "0 0 0 0";
            oc_Newobject19["AnchorTop"]            = "1";
            oc_Newobject19["AnchorBottom"]         = "0";
            oc_Newobject19["AnchorLeft"]           = "1";
            oc_Newobject19["AnchorRight"]          = "0";
            oc_Newobject19["isContainer"]          = "0";
            oc_Newobject19["Profile"]              = "ToolsGuiTextEditProfile";
            oc_Newobject19["HorizSizing"]          = "left";
            oc_Newobject19["VertSizing"]           = "bottom";
            oc_Newobject19["position"]             = "229 27";
            oc_Newobject19["Extent"]               = "39 17";
            oc_Newobject19["MinExtent"]            = "8 2";
            oc_Newobject19["canSave"]              = "1";
            oc_Newobject19["Visible"]              = "1";
            oc_Newobject19["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject19["hovertime"]            = "1000";
            oc_Newobject19["internalName"]         = "rangeMinField";
            oc_Newobject19["canSaveDynamicFields"] = "0";
            oc_Newobject19["altCommand"]           = parameter + ".range = $ThisControl.getValue() SPC " + parameter + ".range.y; $ThisControl.parentGroup-->valueSlider.range = " + parameter + ".range; EManageSFXParameters.saveParameter( " + parameter + ");";

            #endregion

            oc_Newobject22["#Newobject19"] = oc_Newobject19;

            #region GuiCheckBoxCtrl ()        oc_Newobject20

            ObjectCreator oc_Newobject20 = new ObjectCreator("GuiCheckBoxCtrl", "");
            oc_Newobject20["useInactiveState"]     = "0";
            oc_Newobject20["text"]                 = "Local";
            oc_Newobject20["groupNum"]             = "-1";
            oc_Newobject20["buttonType"]           = "ToggleButton";
            oc_Newobject20["useMouseEvents"]       = "0";
            oc_Newobject20["isContainer"]          = "0";
            oc_Newobject20["Profile"]              = "ToolsGuiCheckBoxProfile";
            oc_Newobject20["HorizSizing"]          = "left";
            oc_Newobject20["VertSizing"]           = "bottom";
            oc_Newobject20["position"]             = "302 73";
            oc_Newobject20["Extent"]               = "45 17";
            oc_Newobject20["MinExtent"]            = "8 2";
            oc_Newobject20["canSave"]              = "1";
            oc_Newobject20["Visible"]              = "1";
            oc_Newobject20["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject20["hovertime"]            = "1000";
            oc_Newobject20["internalName"]         = "localCheckbox";
            oc_Newobject20["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject20"] = oc_Newobject20;

            #region GuiPopUpMenuCtrl ()        oc_Newobject21

            ObjectCreator oc_Newobject21 = new ObjectCreator("GuiPopUpMenuCtrl", "");
            oc_Newobject21["maxPopupHeight"]       = "200";
            oc_Newobject21["sbUsesNAColor"]        = "0";
            oc_Newobject21["reverseTextList"]      = "0";
            oc_Newobject21["bitmapBounds"]         = "16 16";
            oc_Newobject21["maxLength"]            = "1024";
            oc_Newobject21["Margin"]               = "0 0 0 0";
            oc_Newobject21["Padding"]              = "0 0 0 0";
            oc_Newobject21["AnchorTop"]            = "1";
            oc_Newobject21["AnchorBottom"]         = "0";
            oc_Newobject21["AnchorLeft"]           = "1";
            oc_Newobject21["AnchorRight"]          = "0";
            oc_Newobject21["isContainer"]          = "0";
            oc_Newobject21["Profile"]              = "ToolsGuiPopUpMenuProfile";
            oc_Newobject21["HorizSizing"]          = "left";
            oc_Newobject21["VertSizing"]           = "bottom";
            oc_Newobject21["position"]             = "349 73";
            oc_Newobject21["Extent"]               = "64 17";
            oc_Newobject21["MinExtent"]            = "8 2";
            oc_Newobject21["canSave"]              = "1";
            oc_Newobject21["Visible"]              = "1";
            oc_Newobject21["tooltipprofile"]       = "ToolsGuiToolTipProfile";
            oc_Newobject21["hovertime"]            = "1000";
            oc_Newobject21["internalName"]         = "sourceDropdown";
            oc_Newobject21["canSaveDynamicFields"] = "0";

            #endregion

            oc_Newobject22["#Newobject21"] = oc_Newobject21;

            #endregion

            oc_Newobject23["#Newobject22"] = oc_Newobject22;

            #endregion

            GuiRolloutCtrl ctrl = oc_Newobject23.Create();

            ctrl["sfxParameter"] = parameter;

            // Deactivate the per-source controls for now as these are not
            // yet implemented in SFX.

            GuiCheckBoxCtrl  localCheckbox    = ctrl.FOT("localCheckbox");
            GuiPopUpMenuCtrl sourceDropdown   = ctrl.FOT("sourceDropdown");
            GuiTextEditCtrl  valueField       = ctrl.FOT("valueField");
            GuiTextEditCtrl  rangeMinField    = ctrl.FOT("rangeMinField");
            GuiTextEditCtrl  rangeMaxField    = ctrl.FOT("rangeMaxField");
            GuiTextEditCtrl  defaultField     = ctrl.FOT("defaultField");
            GuiTextEditCtrl  descriptionField = ctrl.FOT("descriptionField");
            GuiSliderCtrl    valueSlider      = ctrl.FOT("valueSlider");
            GuiPopUpMenuCtrl channelDropdown  = ctrl.FOT("channelDropdown");
            GuiTextEditCtrl  tagsField        = ctrl.FOT("tagsField");

            localCheckbox.setActive(false);
            sourceDropdown.setActive(false);

            // Set the fields to reflect the parameter's current settings.

            valueField.setValue(parameter.value.AsString());
            rangeMinField.setText(parameter.range.x.AsString());
            rangeMaxField.setText(parameter.range.y.AsString());
            defaultField.setValue(parameter.defaultValue.AsString());
            descriptionField.setText(parameter.description);

            valueSlider.range = parameter.range;
            valueSlider.setValue(parameter.value.AsString());

            // Set up the channels dropdown.

            GuiPopUpMenuCtrl list = channelDropdown;
            for (int i = 0; i < iGlobal["$SFX_PARAMETER_CHANNELS_COUNT"]; i++)
            {
                list.add(sGlobal["$SFX_PARAMETER_CHANNELS[" + i + "]"], i);
            }
            list.sort();
            list.setSelected(list.findText(parameter["channel"]));

            SFXParametersStack.addGuiControl(ctrl);

            // Fill tagging field.

            string tags    = "";
            bool   isFirst = true;
            for (int i = 0; parameter["categories[" + i + "]"] != ""; i++)
            {
                if (!isFirst)
                {
                    tags = tags + ", ";
                }

                tags = tags + parameter["categories[" + i + "]"];

                isFirst = false;
            }

            tagsField.setText(tags);
        }
        public void apply()
        {
            EWorldEditor EWorldEditor = "EWorldEditor";

            GuiCheckBoxCtrl DoPosition    = this.FOT("DoPosition");
            GuiCheckBoxCtrl DoRotation    = this.FOT("DoRotation");
            GuiCheckBoxCtrl DoScale       = this.FOT("DoScale");
            GuiCheckBoxCtrl DoSize        = this.FOT("DoSize");
            GuiCheckBoxCtrl PosRelative   = this.FOT("PosRelative");
            GuiCheckBoxCtrl RotRelative   = this.FOT("RotRelative");
            GuiCheckBoxCtrl RotLocal      = this.FOT("RotLocal");
            GuiCheckBoxCtrl ScaleRelative = this.FOT("ScaleRelative");
            GuiCheckBoxCtrl ScaleLocal    = this.FOT("ScaleLocal");
            GuiCheckBoxCtrl SizeRelative  = this.FOT("SizeRelative");
            GuiCheckBoxCtrl SizeLocal     = this.FOT("SizeLocal");
            GuiTextEditCtrl PosY          = this.FOT("PosY");
            GuiTextEditCtrl PosX          = this.FOT("PosX");
            GuiTextEditCtrl PosZ          = this.FOT("PosZ");
            GuiTextEditCtrl ScaleX        = this.FOT("ScaleX");
            GuiTextEditCtrl ScaleY        = this.FOT("ScaleY");
            GuiTextEditCtrl ScaleZ        = this.FOT("ScaleZ");
            GuiTextEditCtrl SizeX         = this.FOT("SizeX");
            GuiTextEditCtrl SizeY         = this.FOT("SizeY");
            GuiTextEditCtrl SizeZ         = this.FOT("SizeZ");
            GuiTextEditCtrl Pitch         = this.FOT("Pitch");
            GuiTextEditCtrl Bank          = this.FOT("Bank");
            GuiTextEditCtrl Heading       = this.FOT("Heading");
            GuiTabBookCtrl  ScaleTabBook  = this.FOT("ScaleTabBook");

            string position    = DoPosition.getValue().AsString();
            string p           = PosX.getValue() + ' ' + PosY.getValue() + ' ' + PosZ.getValue();
            string relativePos = PosRelative.getValue();

            string rotate = DoRotation.getValue();
            string r      = Util.mDegToRad(Pitch.getValue().AsFloat()) + ' ' + Util.mDegToRad(Bank.getValue().AsFloat()) +
                            ' ' + Util.mDegToRad(Heading.getValue().AsFloat()).AsString();
            string relativeRot = RotRelative.getValue();
            string rotLocal    = RotLocal.getValue();

            string scale, s, sRelative, sLocal, size;

            // We need to check which Tab page is active
            if (ScaleTabBook.getSelectedPage() == 0)
            {
                // Scale Page
                scale     = DoScale.getValue();
                s         = ScaleX.getValue() + ' ' + ScaleY.getValue() + ' ' + ScaleZ.getValue();
                sRelative = ScaleRelative.getValue();
                sLocal    = ScaleLocal.getValue();

                size = false.AsString();
            }
            else
            {
                // Size Page
                size      = DoSize.getValue();
                s         = SizeX.getValue() + ' ' + SizeY.getValue() + ' ' + SizeZ.getValue();
                sRelative = SizeRelative.getValue();
                sLocal    = SizeLocal.getValue();

                scale = false.AsString();
            }

            EWorldEditor.transformSelection(position.AsBool(), p.AsPoint3F(), relativePos.AsBool(), rotate.AsBool(), r.AsPoint3F(), relativeRot.AsBool(), rotLocal.AsBool(),
                                            (scale.AsBool() ? 1 : (size.AsBool() ? 2 : 0)), s.AsPoint3F(), sRelative.AsBool(), sLocal.AsBool());
        }
예제 #20
0
            public void updateLifeFields(bool isRandom, float value, bool isSlider, bool onMouseUp)
            {
                GuiCheckBoxCtrl PEE_infiniteLoop                = this.FOT("PEE_infiniteLoop");
                GuiSliderCtrl   PEE_lifetimeMS_slider           = this.FOT("PEE_lifetimeMS_slider");
                GuiSliderCtrl   PEE_lifetimeVarianceMS_slider   = this.FOT("PEE_lifetimeVarianceMS_slider");
                GuiTextEditCtrl PEE_lifetimeVarianceMS_textEdit = this.FOT("PEE_lifetimeVarianceMS_textEdit");
                GuiTextEditCtrl PEE_lifetimeMS_textEdit         = this.FOT("PEE_lifetimeMS_textEdit");
                editor          Editor         = "Editor";
                ParticleEditor  ParticleEditor = "ParticleEditor";

                this.setEmitterDirty();

                SimObject emitter = this.currEmitter;

                // Transfer values over to gui controls.

                if (isRandom)
                {
                    if (value > 0)
                    {
                        value++;
                    }

                    if (value > PEE_lifetimeMS_slider.getValue())
                    {
                        PEE_lifetimeMS_textEdit.setText(value.AsString());
                        PEE_lifetimeMS_slider.setValue(value.AsString());
                    }
                }
                else
                {
                    if (value > 0)
                    {
                        value--;
                    }

                    if (value < PEE_lifetimeVarianceMS_slider.getValue())
                    {
                        PEE_lifetimeVarianceMS_textEdit.setText(value.AsString());
                        PEE_lifetimeVarianceMS_slider.setValue(value.AsString());
                    }
                }

                // Submit undo.

                SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool()))
                {
                    last["isSlider"]                   = isSlider.AsString();
                    last["onMouseUp"]                  = onMouseUp.AsString();
                    last["newValueLifetimeMS"]         = PEE_lifetimeMS_textEdit.getText();
                    last["newValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                }
                else
                {
                    ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields>("Update Active Emitter");
                    action["emitter"]   = emitter;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();

                    action["newValueLifetimeMS"] = PEE_lifetimeMS_textEdit.getText();
                    action["oldValueLifetimeMS"] = emitter["lifetimeMS"];

                    action["newValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                    action["oldValueLifetimeVarianceMS"] = emitter["lifetimeVarianceMS"];

                    ParticleEditor.submitUndo(action);
                }

                // Set the values on the current emitter.

                emitter["lifetimeMS"]         = PEE_lifetimeMS_textEdit.getText();
                emitter["lifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                emitter.call("reload");

                // Keep the infiniteLoop checkbox up to date.

                PEE_infiniteLoop.setStateOn(emitter["lifetimeMS"].AsInt() == 0);
            }
예제 #21
0
            public void guiSync()
            {
                GuiCheckBoxCtrl  PEE_infiniteLoop                = this.FOT("PEE_infiniteLoop");
                GuiCheckBoxCtrl  PEE_orientParticles             = this.FOT("PEE_orientParticles");
                GuiCheckBoxCtrl  PEE_alignParticles              = this.FOT("PEE_alignParticles");
                GuiCheckBoxCtrl  PEE_softParticles               = this.FOT("PEE_softParticles");
                GuiCheckBoxCtrl  PEE_reverseOrder                = this.FOT("PEE_reverseOrder");
                GuiCheckBoxCtrl  PEE_useEmitterSizes             = this.FOT("PEE_useEmitterSizes");
                GuiCheckBoxCtrl  PEE_useEmitterColors            = this.FOT("PEE_useEmitterColors");
                GuiSliderCtrl    PEE_lifetimeMS_slider           = this.FOT("PEE_lifetimeMS_slider");
                GuiSliderCtrl    PEE_lifetimeVarianceMS_slider   = this.FOT("PEE_lifetimeVarianceMS_slider");
                GuiSliderCtrl    PEE_ejectionVelocity_slider     = this.FOT("PEE_ejectionVelocity_slider");
                GuiSliderCtrl    PEE_ejectionPeriodMS_slider     = this.FOT("PEE_ejectionPeriodMS_slider");
                GuiSliderCtrl    PEE_periodVarianceMS_slider     = this.FOT("PEE_periodVarianceMS_slider");
                GuiSliderCtrl    PEE_velocityVariance_slider     = this.FOT("PEE_velocityVariance_slider");
                GuiSliderCtrl    PEE_thetaMin_slider             = this.FOT("PEE_thetaMin_slider");
                GuiSliderCtrl    PEE_thetaMax_slider             = this.FOT("PEE_thetaMax_slider");
                GuiSliderCtrl    PEE_phiVariance_slider          = this.FOT("PEE_phiVariance_slider");
                GuiSliderCtrl    PEE_ejectionOffset_slider       = this.FOT("PEE_ejectionOffset_slider");
                GuiSliderCtrl    PEE_softnessDistance_slider     = this.FOT("PEE_softnessDistance_slider");
                GuiSliderCtrl    PEE_ambientFactor_slider        = this.FOT("PEE_ambientFactor_slider");
                GuiTextEditCtrl  PEE_lifetimeMS_textEdit         = this.FOT("PEE_lifetimeMS_textEdit");
                GuiTextEditCtrl  PEE_lifetimeVarianceMS_textEdit = this.FOT("PEE_lifetimeVarianceMS_textEdit");
                GuiTextEditCtrl  PEE_ejectionPeriodMS_textEdit   = this.FOT("PEE_ejectionPeriodMS_textEdit");
                GuiTextEditCtrl  PEE_periodVarianceMS_textEdit   = this.FOT("PEE_periodVarianceMS_textEdit");
                GuiTextEditCtrl  PEE_ejectionVelocity_textEdit   = this.FOT("PEE_ejectionVelocity_textEdit");
                GuiTextEditCtrl  PEE_velocityVariance_textEdit   = this.FOT("PEE_velocityVariance_textEdit");
                GuiTextEditCtrl  PEE_alignDirection              = this.FOT("PEE_alignDirection");
                GuiTextEditCtrl  PEE_thetaMin_textEdit           = this.FOT("PEE_thetaMin_textEdit");
                GuiTextEditCtrl  PEE_thetaMax_textEdit           = this.FOT("PEE_thetaMax_textEdit");
                GuiTextEditCtrl  PEE_phiVariance_textEdit        = this.FOT("PEE_phiVariance_textEdit");
                GuiTextEditCtrl  PEE_ejectionOffset_textEdit     = this.FOT("PEE_ejectionOffset_textEdit");
                GuiTextEditCtrl  PEE_softnessDistance_textEdit   = this.FOT("PEE_softnessDistance_textEdit");
                GuiTextEditCtrl  PEE_ambientFactor_textEdit      = this.FOT("PEE_ambientFactor_textEdit");
                GuiPopUpMenuCtrl PEE_blendType = this.FOT("PEE_blendType");

                SimObject data = this.currEmitter;

                // Sync up sliders and number boxes.

                if (PEE_infiniteLoop.isStateOn())
                {
                    PEE_lifetimeMS_slider.setActive(false);
                    PEE_lifetimeMS_textEdit.setActive(false);
                    PEE_lifetimeVarianceMS_slider.setActive(false);
                    PEE_lifetimeVarianceMS_textEdit.setActive(false);
                }
                else
                {
                    PEE_lifetimeMS_slider.setActive(true);
                    PEE_lifetimeMS_textEdit.setActive(true);
                    PEE_lifetimeVarianceMS_slider.setActive(true);
                    PEE_lifetimeVarianceMS_textEdit.setActive(true);

                    PEE_lifetimeMS_slider.setValue(data["lifetimeMS"]);
                    PEE_lifetimeMS_textEdit.setText(data["lifetimeMS"]);
                    PEE_lifetimeVarianceMS_slider.setValue(data["lifetimeVarianceMS"]);
                    PEE_lifetimeVarianceMS_textEdit.setText(data["lifetimeVarianceMS"]);
                }

                PEE_ejectionPeriodMS_slider.setValue(data["ejectionPeriodMS"]);
                PEE_ejectionPeriodMS_textEdit.setText(data["ejectionPeriodMS"]);

                PEE_periodVarianceMS_slider.setValue(data["periodVarianceMS"]);
                PEE_periodVarianceMS_textEdit.setText(data["periodVarianceMS"]);

                PEE_ejectionVelocity_slider.setValue(data["ejectionVelocity"]);
                PEE_ejectionVelocity_textEdit.setText(data["ejectionVelocity"]);

                PEE_velocityVariance_slider.setValue(data["velocityVariance"]);
                PEE_velocityVariance_textEdit.setText(data["velocityVariance"]);

                PEE_orientParticles.setValue(data["orientParticles"]);
                PEE_alignParticles.setValue(data["alignParticles"]);
                PEE_alignDirection.setText(data["alignDirection"]);

                PEE_thetaMin_slider.setValue(data["thetaMin"]);
                PEE_thetaMin_textEdit.setText(data["thetaMin"]);

                PEE_thetaMax_slider.setValue(data["thetaMax"]);
                PEE_thetaMax_textEdit.setText(data["thetaMax"]);

                PEE_phiVariance_slider.setValue(data["phiVariance"]);
                PEE_phiVariance_textEdit.setText(data["phiVariance"]);

                PEE_ejectionOffset_slider.setValue(data["ejectionOffset"]);
                PEE_ejectionOffset_textEdit.setText(data["ejectionOffset"]);

                int blendTypeId = PEE_blendType.findText(data["blendStyle"]);

                PEE_blendType.setSelected(blendTypeId, false);

                PEE_softnessDistance_slider.setValue(data["softnessDistance"]);
                PEE_softnessDistance_textEdit.setText(data["softnessDistance"]);

                PEE_ambientFactor_slider.setValue(data["ambientFactor"]);
                PEE_ambientFactor_textEdit.setText(data["ambientFactor"]);

                PEE_softParticles.setValue(data["softParticles"]);
                PEE_reverseOrder.setValue(data["reverseOrder"]);
                PEE_useEmitterSizes.setValue(data["useEmitterSizes"]);
                PEE_useEmitterColors.setValue(data["useEmitterColors"]);

                // Sync up particle selectors.

                for (int index = 0; index < 4; index++)
                {
                    GuiControl       ctrl  = "PEE_EmitterParticle" + (index + 1);
                    GuiPopUpMenuCtrl popup = ctrl.FOT("PopUpMenu");

                    string particle = Util.getWord(data["particles"], index);
                    if (particle.Trim() == "")
                    {
                        popup.setSelected(0, false); // Select "None".
                    }
                    else if (particle.isObject())
                    {
                        popup.setSelected(particle.getID(), false);
                    }
                    else
                    {
                        popup.setSelected(0, false); // Select "None".
                    }
                }
            }
        public void import()
        {
            // Gather all the import settings.
            GuiTextEditCtrl HeightfieldFilename = this.findObjectByInternalName("HeightfieldFilename", true);
            string          heightMapPng        = HeightfieldFilename.getText();
            GuiTextEditCtrl MetersPerPixel      = this.findObjectByInternalName("MetersPerPixel", true);
            string          metersPerPixel      = MetersPerPixel.getText();
            GuiTextEditCtrl HeightScale         = findObjectByInternalName("HeightScale", true);
            string          heightScale         = HeightScale.getText();
            GuiCheckBoxCtrl FlipYAxis           = findObjectByInternalName("FlipYAxis", true);
            bool            flipYAxis           = FlipYAxis.isStateOn();

            editor Editor = "Editor";
            // Grab and validate terrain object name.

            string terrainName = ((GuiTextEditCtrl)this.findObjectByInternalName("TerrainName", true)).getText();

            if (!terrainName.isObject() && ((SimObject)terrainName).isMemberOfClass("TerrainBlock") &&
                !Editor.validateObjectName(terrainName, false))
            {
                return;
            }

            string opacityNames  = "";
            string materialNames = "";

            GuiTextListCtrl opacityList = this.findObjectByInternalName("OpacityLayerTextList", true);


            ArrayObject namesArray    = this["namesArray"];
            ArrayObject channelsArray = this["channelsArray"];

            for (int i = 0; i < opacityList.rowCount(); i++)
            {
                string itemText    = opacityList.getRowTextById(i);
                string opacityName = namesArray.getValue(i);
                string channelInfo = channelsArray.getValue(i);
                string channel     = Util.getWord(channelInfo, 0);

                string materialName = Util.getField(itemText, 2);
                opacityNames  += opacityName + "\t" + channel + "\n";
                materialNames += materialName + "\n";
            }

            int updated = Util.nameToID(terrainName);
            // This will update an existing terrain with the name %terrainName,
            // or create a new one if %terrainName isn't a TerrainBlock

            String obj = console.Call_Classname("TerrainBlock", "import",
                                                new string[]
            {
                terrainName, heightMapPng, metersPerPixel, heightScale, opacityNames, materialNames,
                flipYAxis.AsString()
            });

            ((GuiCanvas)"Canvas").popDialog(this);

            if (obj.isObject())
            {
                if (obj != updated.AsString())
                {
                    // created a new TerrainBlock
                    // Submit an undo action.
                    Extendable.MECreateUndoAction.submit(obj);
                }

                EWorldEditor EWorldEditor = "EWorldEditor";

                if (!EWorldEditor.isObject())
                {
                    throw new Exception("ObjectBuilderGui::processNewObject - EWorldEditor is missing!");
                }

                // Select it in the editor.
                EWorldEditor.clearSelection();
                EWorldEditor.selectObject(obj);
                // When we drop the selection don't store undo
                // state for it... the creation deals with it.

                EWorldEditor.dropSelection(obj.AsBool());

                EWorldEditor.isDirty = true;
                //Copyright Winterleaf Entertainment L.L.C. 2013
                ((TerrainPainter)"TerrainPainter").updateLayers("");
                //Copyright Winterleaf Entertainment L.L.C. 2013
            }
            else
            {
                messageBox.MessageBoxOK("Import Terrain", "Terrain import failed! Check console for error messages.",
                                        "Ok");
            }
        }
        public override void onSelectObjects(bool val, bool reuseExistingSet = false)
        {
            string sel = "";
            // See if we should create an independent selection set.
            GuiCheckBoxCtrl createSelectionSet = this.findObjectByInternalName("createSelectionSet", true);

            if (createSelectionSet.isStateOn())
            {
                string sname = ((GuiTextEditCtrl)this.findObjectByInternalName("selectionSetName", true)).getText();
                // See if we should create or re-use a set.

                if (sname.isObject())
                {
                    SimObject name = sname;
                    if (name.isMemberOfClass("WorldEditorSelection"))
                    {
                        messageBox.MessageBoxOK("Error",
                                                "An object called '" + name +
                                                "' already exists and is not a selection.  Please choose a different name.");
                        return;
                    }
                    else if (!reuseExistingSet)
                    {
                        messageBox.MessageBoxYesNo("Question",
                                                   "A selection called '" + name + "' already exists. Modify the existing selection?",
                                                   this + ".onSelectObjects( " + val + ", true );", "");
                        return;
                    }
                    else
                    {
                        sel = name;
                    }
                }
                else
                {
                    editor Editor = "Editor";
                    if (!Editor.validateObjectName(name, false))
                    {
                        return;
                    }

                    // Create a new selection set.
                    sel =
                        console.Eval("%sel = new WorldEditorSelection( " + name +
                                     " ) { parentGroup = Selections; canSave = true; };return sel;", true);

                    if (!sel.isObject())
                    {
                        messageBox.MessageBoxOK("Error",
                                                "Could not create the selection set.  Please look at the console.log for details.");
                        return;
                    }
                }

                this["selectionSet"] = sel;
            }
            else
            {
                this["selectionSet"] = "";
            }

            base.onSelectObjects(val, false);

            // Refresh editor tree just in case.
            EditorTree EditorTree = "EditorTree";

            EditorTree.buildVisibleTree();
        }
        public void onSelectionChanged()
        {
            EWorldEditor EWorldEditor = "EWorldEditor";

            GuiCheckBoxCtrl RotRelative    = this.FOT("RotRelative");
            GuiCheckBoxCtrl RotLocal       = this.FOT("RotLocal");
            GuiButtonCtrl   GetPosButton   = this.FOT("GetPosButton");
            GuiButtonCtrl   GetRotButton   = this.FOT("GetRotButton");
            GuiButtonCtrl   GetScaleButton = this.FOT("GetScaleButton");
            GuiButtonCtrl   GetSizeButton  = this.FOT("GetSizeButton");
            GuiButtonCtrl   ApplyButton    = this.FOT("ApplyButton");

            // Count the number of selected SceneObjects.  There are
            // other object classes that could be selected, such
            // as SimGroups.
            int count               = EWorldEditor.getSelectionSize();
            int sceneObjects        = 0;
            int globalBoundsObjects = 0;

            for (int i = 0; i < count; i++)
            {
                SimObject obj = EWorldEditor.getSelectedObject(i);
                if (obj.isMemberOfClass("SceneObject"))
                {
                    sceneObjects++;

                    if (obj.call("isGlobalBounds").AsBool())
                    {
                        globalBoundsObjects++;
                    }
                }
            }

            if (sceneObjects == 0)
            {
                // With nothing selected, disable all Get buttons
                this.disableAllButtons();
            }
            else if (sceneObjects == 1)
            {
                // With one selected, all Get buttons are active
                GetPosButton.setActive(true);
                GetRotButton.setActive(true);

                // Special case for Scale and Size for global bounds objects
                if (globalBoundsObjects == 1)
                {
                    GetSizeButton.setActive(false);
                    GetScaleButton.setActive(false);
                }
                else
                {
                    GetSizeButton.setActive(true);
                    GetScaleButton.setActive(true);
                }

                ApplyButton.setActive(true);
            }
            else
            {
                // With more than one selected, only the position button
                // is active
                GetPosButton.setActive(true);
                GetRotButton.setActive(false);
                GetScaleButton.setActive(false);
                GetSizeButton.setActive(false);

                ApplyButton.setActive(true);

                // If both RotRelative and RotLocal are unchecked, then go with RotLocal
                if (RotRelative.getValue().AsInt() == 0 && RotLocal.getValue().AsInt() == 0)
                {
                    RotLocal.setStateOn(true);
                }
            }
        }
예제 #25
0
        public void open(string filename)
        {
            EditorGui             EditorGui             = "EditorGui";
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdAnimWindow     ShapeEdAnimWindow     = "ShapeEdAnimWindow";
            ShapeEditorToolbar    ShapeEditorToolbar    = "ShapeEditorToolbar";

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                base.onActivated();
            }

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

                // 'fitToShape' only works after the GUI has been rendered, so force a repaint first
                Canvas.repaint(0);
                ShapeEdShapeView.fitToShape();
            }
        }
예제 #26
0
        public void saveDirtyMaterial(TerrainMaterial mat)
        {
            // Skip over obviously bad cases.
            if (!mat.isObject())
            {
                return;
            }

            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");

            // Read out properties from the dialog.
            string newDiffuse = "";
            string newNormal  = "";
            string newDetail  = "";
            string newMacro   = "";

            string newName = matNameCtrl.getText();

            if (baseTexCtrl.bitmap != "tools/materialeditor/gui/unknownImage")
            {
                newDiffuse = baseTexCtrl.bitmap;
            }

            if (normTexCtrl.bitmap != "tools/materialeditor/gui/unknownImage")
            {
                newNormal = normTexCtrl.bitmap;
            }

            if (detailTexCtrl.bitmap != "tools/materialeditor/gui/unknownImage")
            {
                newDetail = detailTexCtrl.bitmap;
            }

            if (macroTexCtrl.bitmap != "tools/materialeditor/gui/unknownImage")
            {
                newMacro = macroTexCtrl.bitmap;
            }

            string detailSize        = detSizeCtrl.getText();
            string diffuseSize       = baseSizeCtrl.getText();
            string detailStrength    = detStrengthCtrl.getText();
            string detailDistance    = detDistanceCtrl.getText();
            string useSideProjection = sideProjectionCtrl.getValue();
            string parallaxScale     = parallaxScaleCtrl.getText();

            string macroSize     = macroSizeCtrl.getText();
            string macroStrength = macroStrengthCtrl.getText();
            string macroDistance = macroDistanceCtrl.getText();

            string terrainFolder = terrainFolderCtrl.getText();

            if (mat.internalName == newName && mat.diffuseMap == newDiffuse && mat.normalMap == newNormal && mat.detailMap == newDetail && mat["macroMap"] == newMacro && mat["detailSize"] == detailSize && mat["diffuseSize"] == diffuseSize && mat["detailStrength"] == detailStrength && mat["detailDistance"] == detailDistance && mat["useSideProjection"] == useSideProjection && mat["macroSize"] == macroSize && mat["macroStrength"] == macroStrength && mat["macroDistance"] == macroDistance && mat.parallaxScale.AsString() == parallaxScale && mat["terrainFolder"] == terrainFolder)
            {
                return;
            }

            // Make sure the material name is unique.
            if (mat.internalName != newName)
            {
                TerrainMaterial existingMat = ((SimSet)"TerrainMaterialSet").findObjectByInternalName(newName, true);
                if (existingMat.isObject())
                {
                    messageBox.MessageBoxOK("Error", "There already is a terrain material called '" + newName + "'.");
                    // Reset the name edit control to the old name.
                    matNameCtrl.setText(mat.internalName);
                }
                else
                {
                    mat.setInternalName(newName);
                }
            }
            mat["diffuseMap"]        = newDiffuse;
            mat["normalMap"]         = newNormal;
            mat["detailMap"]         = newDetail;
            mat["macroMap"]          = newMacro;
            mat["detailSize"]        = detailSize;
            mat["diffuseSize"]       = diffuseSize;
            mat["detailStrength"]    = detailStrength;
            mat["detailDistance"]    = detailDistance;
            mat["macroSize"]         = macroSize;
            mat["macroStrength"]     = macroStrength;
            mat["macroDistance"]     = macroDistance;
            mat["useSideProjection"] = useSideProjection;
            mat["parallaxScale"]     = parallaxScale;

            //TerrainPainterAddition
            mat["terrainFolder"] = terrainFolder;

            // Mark the material as dirty and needing saving.

            string fileName = mat.getFilename();

            if (fileName == "")
            {
                fileName = "art/terrains/materials.cs";
            }

            PersistenceManager ETerrainMaterialPersistMan = "ETerrainMaterialPersistMan";

            ETerrainMaterialPersistMan.setDirty(mat, fileName);
        }
            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]"]);
            }