コード例 #1
0
        public override void onSelect(string id, string text)
        {
            // Attempt to keep the same resolution settings:
            GuiPopUpMenuCtrl resMenu =
                ((OptionsDlg)"OptionsDlg").findObjectByInternalName("OptGraphicsResolutionMenu", true);
            string currRes = resMenu.getText();

            // If its empty the use the current.
            if (currRes == "")
            {
                currRes = OptionsDlg._makePrettyResString(((GuiCanvas)"Canvas").getVideoMode());
            }

            // Fill the resolution list.
            ((OptionsDlg)"optionsDlg").initResMenu();
            // Try to select the previous settings:

            int selId = resMenu.findText(currRes);

            if (selId == -1)
            {
                selId = 0;
            }
            resMenu.setSelected(selId);

            ((OptionsDlg)"optionsDlg")._updateApplyState();

            sGlobal["$pref::Video::displayDevice"] = this.getText();
        }
コード例 #2
0
        public void setKeyframe(float frame)
        {
            CodeBehind.ShapeEditor.ShapeEdSeqSlider    ShapeEdSeqSlider    = "ShapeEdSeqSlider";
            CodeBehind.ShapeEditor.ShapeEdThreadSlider ShapeEdThreadSlider = "ShapeEdThreadSlider";
            CodeBehind.ShapeEditor ShapeEditor = "ShapeEditor";
            CodeBehind.ShapeEditor.ShapeEdShapeView    ShapeEdShapeView    = "ShapeEdShapeView";
            CodeBehind.ShapeEditor.ShapeEdThreadWindow ShapeEdThreadWindow = "ShapeEdThreadWindow";
            GuiPopUpMenuCtrl transitionTo = ShapeEdThreadWindow.FOT("transitionTo");

            ShapeEdSeqSlider.setValue(frame, true);
            if (transitionTo.getText() == "synched position")
            {
                ShapeEdThreadSlider.setValue(frame, true);
            }

            // Update the position of the active thread => if outside the in/out range,
            // need to switch to the proxy sequence
            if (!this.usingProxySeq)
            {
                if ((frame < this.seqStartFrame) || (frame > this.seqEndFrame))
                {
                    this.usingProxySeq = true;
                    string proxyName = ShapeEditor.getProxyName(ShapeEdShapeView.getThreadSequence());
                    ShapeEdShapeView.setThreadSequence(proxyName, 0, 0, false);
                }
            }

            ShapeEdShapeView["threadPos"] = this.keyframeToThreadPos(frame).AsString();
        }
コード例 #3
0
        public void createPromptNameCheck()
        {
            GuiControl       DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt";
            editor           Editor             = "Editor";
            GuiPopUpMenuCtrl copySourceDropdown =
                DatablockEditorCreatePrompt.findObjectByInternalName("copySourceDropdown", true);

            string name =
                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .getText();

            if (!Editor.validateObjectName(name, true))
            {
                return;
            }

            // Fetch the copy source and clear the list.

            string copySource = copySourceDropdown.getText();

            copySourceDropdown.clear();

            // Remove the dialog and create the datablock.

            ((GuiCanvas)"canvas").popDialog(DatablockEditorCreatePrompt);
            this.createDatablockFinish(name, copySource);
        }
コード例 #4
0
            public void updateParticlesFields()
            {
                ParticleParticleEditor.PE_ParticleEditor PE_ParticleEditor = "PE_ParticleEditor";

                string particles = "";

                for (int i = 1; i < 5; i++)
                {
                    GuiControl       emitterParticle = "PEE_EmitterParticle" + i;
                    GuiPopUpMenuCtrl popup           = emitterParticle.FOT("PopUpMenu");
                    string           text            = popup.getText();

                    if (text == "" || text == "None")
                    {
                        continue;
                    }

                    if (particles == "")
                    {
                        particles = text;
                    }
                    else
                    {
                        particles = particles + ' ' + text;
                    }
                }

                int    changedEditParticle = 1;
                string currParticle        = PE_ParticleEditor.currParticle.getName();

                foreach (string particleName in particles.Split(' '))
                {
                    if (particleName == currParticle)
                    {
                        changedEditParticle = 0;
                        break;
                    }
                }

                // True only if the currently edited particle has not been found and the
                // ParticleEditor is dirty.

                if (changedEditParticle == 1 && PE_ParticleEditor.dirty)
                {
                    messageBox.MessageBoxYesNoCancel("Save Particle Changes?",
                                                     "Do you wish to save the changes made to the <br>current particle before changing the particle?",
                                                     "PE_ParticleEditor.saveParticle( " + PE_ParticleEditor.currParticle.getName() +
                                                     " ); PE_EmitterEditor.updateEmitter( \"particles\"," + particles + ");",
                                                     "PE_ParticleEditor.saveParticleDialogDontSave( " + PE_ParticleEditor.currParticle.getName() +
                                                     " ); PE_EmitterEditor.updateEmitter( \"particles\"," + particles + ");",
                                                     "PE_EmitterEditor.guiSync();");
                }
                else
                {
                    this.updateEmitter("particles", particles, false, false);
                }
            }
コード例 #5
0
        /// Parse the categories for the parameter from the given comma-separated list.
        public void updateParameterCategories(SFXParameter parameter, string list)
        {
            GuiPopUpMenuCtrl SFXParameterFilter = this.FOT("SFXParameterFilter");

            this.persistenceMgr.setDirty(parameter);

            // Parse the list.

            int len = Util.strlen(list);
            int pos = 0;

            int idx = 0;

            while (pos < len)
            {
                int startPos = pos;
                pos = Util.strchrpos(list, ",", pos);
                if (pos == -1)
                {
                    pos = len;
                }

                if (pos > startPos)
                {
                    string category = Util.getSubStr(list, startPos, pos - startPos);
                    category = Util.trim(category);
                    parameter["categories[" + idx + "]"] = category;
                    idx++;
                }

                pos++;
            }

            // Clear out excess categories existing from before.

            while (parameter["categories[" + idx + "]"] != "")
            {
                parameter["categories[" + idx + "]"] = "";
                this.persistenceMgr.removeField(parameter, "categories" + idx);
                idx++;
            }

            // Save the parameter.

            this.saveParameter(parameter);

            // Re-initialize the filter list.

            this.initFilterList(SFXParameterFilter.getText());
        }
コード例 #6
0
        public void writeSettings()
        {
            Settings         EditorSettings      = "EditorSettings";
            GuiPopUpMenuCtrl PEE_EmitterSelector = "PEE_EmitterSelector";

            ParticleEditor.PE_TabBook PE_TabBook           = "PE_TabBook";
            GuiPopUpMenuCtrl          PEP_ParticleSelector = "PEP_ParticleSelector";

            EditorSettings.beginGroup("ParticleEditor", true);

            EditorSettings.setValue("selectedEmitter", PEE_EmitterSelector.getText());
            EditorSettings.setValue("selectedParticle", PEP_ParticleSelector.getText());
            EditorSettings.setValue("selectedTab", PE_TabBook.getSelectedPage().AsString());

            EditorSettings.endGroup();
        }
コード例 #7
0
            public void saveParticle(SimObject particle)
            {
                GuiPopUpMenuCtrl   PEP_ParticleSelector = "PEP_ParticleSelector";
                ParticleData       PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle";
                PersistenceManager PE_ParticleSaver = "PE_ParticleSaver";
                ParticleEditor     ParticleEditor   = "ParticleEditor";

                particle.setName(PEP_ParticleSelector.getText());

                PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom(particle);
                PE_ParticleEditor_NotDirtyParticle["originalName"] = particle.getName();

                PE_ParticleSaver.saveDirty();
                this.setParticleNotDirty();

                ParticleEditor.createParticleList();
            }
コード例 #8
0
        public void onOK()
        {
            GuiTextEditCtrl  nameField     = this.FOT("nameField");
            GuiPopUpMenuCtrl classDropdown = this.FOT("classDropdown");
            editor           Editor        = "Editor";

            string name      = nameField.getValue();
            string className = classDropdown.getText();

            // Make sure we don't clash with an existing object.
            // If there's an existing GUIControl with the name, ask to replace.
            // If there's an existing non-GUIControl with the name, or the name is invalid, refuse to create.

            if (name.isObject() && ((SimObject)name).isMemberOfClass("GuiControl"))
            {
                if (
                    Util.messageBox("Warning", "Replace the existing control '" + name + "'?", "OkCancel", "Question") ==
                    iGlobal["$MROk"])
                {
                    name.delete();
                }
                else
                {
                    return;
                }
            }

            if (Editor.validateObjectName(name, false))
            {
                ((GuiCanvas)this.getRoot()).popDialog(this);
                SimObject obj = Util.eval("return new " + className + "(" + name + ");");

                // Make sure we have no association with a filename.
                obj.setFilename("");

                GuiEditorGui.GuiEditContent(obj);
            }
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public void create()
        {
            /*
             * %terrainName = %this-->theName.getText();
             * %resolution = %this-->theRezList.getSelected();
             * %materialName = %this-->theMaterialList.getText();
             * %genNoise = %this-->noiseRadio.getValue();
             *
             * %obj = TerrainBlock::createNew( %terrainName, %resolution, %materialName, %genNoise );
             *
             * if( %genNoise )
             *    ETerrainEditor.isDirty = true;
             *
             * if( isObject( %obj ) )
             * {
             *    // Submit an undo action.
             *    MECreateUndoAction::submit(%obj);
             *
             *    assert( isObject( EWorldEditor ),
             *       "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( true );
             * }
             *
             * Canvas.popDialog( %this );
             */

            string           terrainName  = ((GuiTextEditCtrl)this.findObjectByInternalName("theName", true)).getText();
            GuiPopUpMenuCtrl rezList      = this.findObjectByInternalName("theRezList", true);
            GuiPopUpMenuCtrl matList      = this.findObjectByInternalName("theMaterialList", true);
            string           resolution   = rezList.getSelected().AsString();
            string           materialName = matList.getText();
            string           genNoise     = ((GuiRadioCtrl)this.findObjectByInternalName("noiseRadio", true)).getValue();

            TerrainBlock obj = console.Eval("TerrainBlock::createNew(\"" + terrainName + "\",\"" + resolution + "\",\"" + materialName + "\",\"" + genNoise + "\");", true);

            if (genNoise.AsBool())
            {
                ((SimObject)"ETerrainEditor")["isDirty"] = "1";
            }

            if (obj.isObject())
            {
                EWorldEditor EWorldEditor = "EWorldEditor";
                // Submit an undo action.
                Extendable.MECreateUndoAction.submit(obj);
                // 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(true);
            }
            ((GuiCanvas)"Canvas").popDialog(this);
        }