public void onNewParticle()
            {
                GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector";

                // Bail if the user selected the same particle.

                SimObject id = PEP_ParticleSelector.getSelected();

                if (id == this.currParticle)
                {
                    return;
                }

                // Load new particle if we're not in a dirty state
                if (this.dirty)
                {
                    messageBox.MessageBoxYesNoCancel("Save Existing Particle?",
                                                     "Do you want to save changes to <br><br>" + this.currParticle.getName(),
                                                     "PE_ParticleEditor.saveParticle(" + this.currParticle + ");",
                                                     "PE_ParticleEditor.saveParticleDialogDontSave(" + this.currParticle +
                                                     "); PE_ParticleEditor.loadNewParticle();"
                                                     );
                }
                else
                {
                    this.loadNewParticle("");
                }
            }
        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();
        }
        public void readSettings()
        {
            Settings         EditorSettings      = "EditorSettings";
            GuiPopUpMenuCtrl PEE_EmitterSelector = "PEE_EmitterSelector";

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

            EditorSettings.beginGroup("ParticleEditor", true);

            string selectedEmitter = EditorSettings.value("selectedEmitter");

            if (selectedEmitter.isObject())
            {
                PEE_EmitterSelector.setSelected(selectedEmitter.getID());
            }

            string selectedParticle = EditorSettings.value("selectedParticle");

            if (selectedParticle.isObject())
            {
                PEP_ParticleSelector.setSelected(selectedParticle.getID());
            }

            PE_TabBook.selectPage(EditorSettings.value("selectedPage").AsInt());

            EditorSettings.endGroup();
        }
Beispiel #4
0
            public void onNewEmitter()
            {
                GuiPopUpMenuCtrl PEE_EmitterSelector = "PEE_EmitterSelector";

                ParticleParticleEditor.PE_ParticleEditor PE_ParticleEditor = "PE_ParticleEditor";

                if (this.currEmitter.isObject() && this.currEmitter == PEE_EmitterSelector.getSelected())
                {
                    return;
                }

                //FIXME: disregards particle tab dirty state

                if (this.dirty)
                {
                    if (PE_ParticleEditor.dirty)
                    {
                        messageBox.MessageBoxYesNo("Save Existing Particle?", "Do you want to save changes to <br><br>" + PE_ParticleEditor.currParticle.getName(), "PE_ParticleEditor.saveParticle(" + PE_ParticleEditor.currParticle + ");");
                    }

                    SimObject savedEmitter = this.currEmitter;
                    messageBox.MessageBoxYesNoCancel("Save Existing Emitter?", "Do you want to save changes to <br><br>" + savedEmitter.getName(), "PE_EmitterEditor.saveEmitter(" + savedEmitter + "); PE_EmitterEditor.loadNewEmitter();", "PE_EmitterEditor.saveEmitterDialogDontSave(" + savedEmitter + "); PE_EmitterEditor.loadNewEmitter();");
                }
                else
                {
                    this.loadNewEmitter("");
                }
            }
Beispiel #5
0
        public void initFilterList(string selectFilter)
        {
            GuiPopUpMenuCtrl SFXParameterFilter = this.FOT("SFXParameterFilter");
            SimSet           SFXParameterGroup  = "SFXParameterGroup";

            GuiPopUpMenuCtrl filterList = SFXParameterFilter;

            filterList.clear();
            filterList.add("", 0);

            for (uint i = 0; i < SFXParameterGroup.getCount(); i++)
            {
                SimObject obj = SFXParameterGroup.getObject(i);
                if (!Util.isMemberOfClass(obj.getClassName(), "SFXParameter"))
                {
                    continue;
                }

                for (int idx = 0; obj["categories[" + idx + "]"] != ""; idx++)
                {
                    string category = obj["categories[" + idx + "]"];
                    if (filterList.findText(category) == -1)
                    {
                        filterList.add(category, filterList.size());
                    }
                }
            }

            // Sort the filters.

            filterList.sort();
            filterList.setSelected(filterList.findText(selectFilter), false);
        }
        public void cleanup()
        {
            GuiStackControl classList = findObjectByInternalName("classList", true);

            if (classList.isObject())
            {
                classList.clear();
            }

            // Initialize the filter list.
            GuiStackControl filterList = findObjectByInternalName("filterList", true);

            if (filterList.isObject())
            {
                filterList.clear();
            }

            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            if (groupList.isObject())
            {
                groupList.clear();
            }

            if (this["classArray"].isObject())
            {
                this["classArray"].delete();
            }
        }
        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();
        }
        public virtual void initGroupList()
        {
            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            int selected = 0;

            if (groupList.size() > 0)
            {
                selected = groupList.getSelected();
            }

            groupList.clear();

            SimGroup root = getRootGroup();

            if (!root.isObject())
            {
                return;
            }
            // Add all non-empty groups.
            scanGroup(root, groupList, 0);

            // Select initial group.
            if (selected != 0 && selected.AsString().isObject())
            {
                groupList.setSelected(selected);
            }
            else
            {
                groupList.setSelected(root.getId());
            }
        }
Beispiel #9
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);
            }
Beispiel #10
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);
        }
Beispiel #11
0
        public void init(string guiName, string guiClass)
        {
            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";
            GuiTextEditCtrl        nameField = this.FOT("nameField");

            nameField.setValue(guiName);

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

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

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

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

                    classDropdown.add(className, 0);
                }

                classDropdown.sort();
            }

            classDropdown.setText("GuiControl");
        }
            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);
                }
            }
Beispiel #13
0
        public static void IOCallback(GuiControl dlg, string callback)
        {
            GuiPopUpMenuCtrl IODropdownMenu = "IODropdownMenu";
            int    id   = IODropdownMenu.getSelected();
            string text = IODropdownMenu.getTextById(id);

            callback = callback.Replace("#", text);
            omni.console.Eval(callback);
            ((GuiCanvas)"Canvas").popDialog(dlg);
        }
 public virtual void updateFromChild(GuiControl ctrl)
 {
     if (ctrl.internalName == "PopupMenu")
     {
         ((GuiControl)this.FOF("TextEdit")).call("setText", ctrl.call("getText"));
     }
     else if (ctrl.internalName == "textEdit")
     {
         GuiPopUpMenuCtrl popup = this.FOF("PopupMenu");
         popup.changeTextById(popup.getSelected(), ctrl.call("getText"));
         onRenameItem();
     }
 }
Beispiel #15
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);
            }
        }
Beispiel #16
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());
        }
Beispiel #17
0
        public override void onWake()
        {
            /*
             * %this-->theName.setText( "" );
             *
             * %matList = %this-->theMaterialList;
             * %matList.clear();
             * %count = TerrainMaterialSet.getCount();
             * for ( %i=0; %i < %count; %i++ )
             * %matList.add( TerrainMaterialSet.getObject( %i ).internalName, %i );
             * %matList.setSelected( 0 );
             *
             * %rezList = %this-->theRezList;
             * %rezList.clear();
             * %rezList.add( "256", 256 );
             * %rezList.add( "512", 512 );
             * %rezList.add( "1024", 1024 );
             * %rezList.add( "2048", 2048 );
             * //%rezList.add( "4096", 4096 );
             * %rezList.setSelected( 256 );
             *
             * %this-->flatRadio.setStateOn( true );
             */
            ((GuiTextEditCtrl)this.findObjectByInternalName("theName", true)).setText("");
            GuiPopUpMenuCtrl matList = this.findObjectByInternalName("theMaterialList", true);

            matList.clear();
            SimSet TerrainMaterialSet = "TerrainMaterialSet";
            int    count = TerrainMaterialSet.getCount();

            for (uint i = 0; i < count; i++)
            {
                matList.add(
                    ((SimObject)TerrainMaterialSet.getObject(i)).internalName,
                    (int)i);
            }
            matList.setSelected(0);

            GuiPopUpMenuCtrl rezList = this.findObjectByInternalName("theRezList", true);

            rezList.clear();
            rezList.add("256", 256);
            rezList.add("512", 512);
            rezList.add("1024", 1024);
            rezList.add("2048", 2048);

            rezList.setSelected(256);

            ((GuiRadioCtrl)this.findObjectByInternalName("flatRadio", true)).setStateOn(true);
        }
Beispiel #18
0
        public void setEase(string ease)
        {
            GuiPopUpMenuCtrl      directionList = this.FOT("directionList");
            GuiPopUpMenuCtrl      typeList      = this.FOT("typeList");
            GuiEaseViewCtrl       easeView      = this.FOT("easeView");
            GuiTextEditSliderCtrl param1Value   = this.FOT("param1Value");
            GuiTextEditSliderCtrl param2Value   = this.FOT("param2Value");

            easeView.ease = ease.AsEaseF();
            directionList.setSelected(omni.Util.getWord(ease, 0).AsInt(), false);
            typeList.setSelected(omni.Util.getWord(ease, 1).AsInt(), false);
            param1Value.setValue(omni.Util.getWord(ease, 2));
            param2Value.setValue(omni.Util.getWord(ease, 3));

            this.onEaseTypeSet();
        }
Beispiel #19
0
            public override void onRenameItem()
            {
                PE_EmitterEditor PE_EmitterEditor = "PE_EmitterEditor";

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

                base.onRenameItem();

                //FIXME: need to check for validity of name and name clashes

                PE_EmitterEditor.setEmitterDirty();

                // Resort menu.

                PopupMenu.sort();
            }
        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();
        }
            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();
            }
Beispiel #22
0
        public override void onSelect(string id, string text)
        {
            // Skip empty provider selections.
            if (text == "")
            {
                return;
            }

            sGlobal["$pref::SFX::provider"] = text;

            GuiPopUpMenuCtrl OptAudioDeviceList = "OptAudioDeviceList";

            OptAudioDeviceList.clear();

            string buffer = Util.sfxGetAvailableDevices();
            int    count  = Util.getRecordCount(buffer);

            for (int i = 0; i < count; i++)
            {
                string record   = Util.getRecord(buffer, i);
                string provider = Util.getField(record, 0);
                string device   = Util.getField(record, 1);

                if (provider != text)
                {
                    continue;
                }

                if (OptAudioDeviceList.findText(device) == -1)
                {
                    OptAudioDeviceList.add(device, i);
                }
            }
            // Find the previous selected device.
            int selId = OptAudioDeviceList.findText(sGlobal["$pref::SFX::device"]);

            if (selId == -1)
            {
                OptAudioDeviceList.setFirstSelected();
            }
            else
            {
                OptAudioDeviceList.setSelected(selId);
            }
        }
        public virtual void onSelectObjects(bool val, bool reuseExistingSet = false)
        {
            SimGroup root;
            // Get the root group to search in.
            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            if (groupList.isObject())
            {
                root = getRootGroup();
            }
            else
            {
                root = groupList.getSelected();
            }

            if (!root.isObject())
            {
                return;
            }
            // Fetch the object name pattern.
            string namePatternField = findObjectByInternalName("namePattern", true);

            if (namePatternField.isObject())
            {
                this["namePattern"] = ((GuiTextEditCtrl)namePatternField).getText();
            }
            else
            {
                this["namePattern"] = "";
            }

            // Clear current selection first, if need be.
            if (val)
            {
                string retainSelectionBox = findObjectByInternalName("retainSelection", true);
                if (retainSelectionBox.isObject() && !((GuiCheckBoxCtrl)retainSelectionBox).isStateOn())
                {
                    clearSelection();
                }
            }

            // (De)Select all matching objects in it.
            selectObjectsIn(root, val, true);
        }
            public override void onCtrlClick()
            {
                PE_ParticleEditor PE_ParticleEditor    = "PE_ParticleEditor";
                GuiPopUpMenuCtrl  PEP_ParticleSelector = "PEP_ParticleSelector";

                int replaceSlot = 0;

                for (int i = 1; i < 5; i++)
                {
                    GuiPopUpMenuCtrl popup = "PEE_EmitterParticleSelector" + i;
                    if (popup.getSelected() == PEP_ParticleSelector.getSelected())
                    {
                        replaceSlot = i;
                        break;
                    }
                }

                PE_ParticleEditor.showNewDialog(replaceSlot.AsString());
            }
        public virtual void scanGroup(SimGroup group, GuiPopUpMenuCtrl list, int indentLevel)
        {
            // Create a display name for the group.
            string text = group.getName();

            if (text == "")
            {
                text = group.getClassName();
            }

            string internalName = group.getInternalName();

            if (internalName != "")
            {
                text = text + "[" + internalName + "]";
            }

            // Indent the name according to the depth in the hierarchy.

            if (indentLevel > 0)
            {
                text = Util.strrepeat(" ", indentLevel, "") + text;
            }

            // Add it to the list.

            list.add(text, group.getId());

            // Recurse into SimSets with at least one child.

            for (uint i = 0; i < group.getCount(); i++)
            {
                SimObject obj = group.getObject(i);
                if (!obj.isMemberOfClass("SimSet") || obj.call("getCount").AsInt() == 0)
                {
                    continue;
                }

                scanGroup(obj.GetID(), list, indentLevel + 1);
            }
        }
Beispiel #26
0
        public static void IODropdown(string title, string message, SimGroup simgroup, string callback, string cancelCallback)
        {
            ((GuiWindowCtrl)"IODropdownFrame").text = title;
            //bug GuiCanvas.pushDialog doesn't seem to work the mouse right.
            ((GuiCanvas)"Canvas").pushDialog("IODropdownDlg");
            MBSetText("IODropdownText", "IODropdownFrame", message);
            GuiPopUpMenuCtrl IODropdownMenu = "IODropdownMenu";

            if (simgroup.isObject())
            {
                for (uint i = 0; i < simgroup.getCount(); i++)
                {
                    IODropdownMenu.add(simgroup.getObject(i).getName());
                }
            }

            IODropdownMenu.sort();
            IODropdownMenu.setFirstSelected(false);
            ((GuiControl)"IODropdownDlg")["callback"]       = callback;
            ((GuiControl)"IODropdownDlg")["cancelCallback"] = cancelCallback;
        }
Beispiel #27
0
        public void init(string ease, string callback)
        {
            GuiPopUpMenuCtrl directionList = this.FOT("directionList");
            GuiPopUpMenuCtrl typeList      = this.FOT("typeList");

            // Initialize direction popup.

            if (directionList.size() == 0)
            {
                directionList.add("InOut", iGlobal["$Ease::InOut"]);
                directionList.add("In", iGlobal["$Ease::In"]);
                directionList.add("Out", iGlobal["$Ease::Out"]);
            }

            // Initialize type popup.

            if (typeList.size() == 0)
            {
                typeList.add("Linear", iGlobal["$Ease::Linear"]);
                typeList.add("Quadratic", iGlobal["$Ease::Quadratic"]);
                typeList.add("Cubic", iGlobal["$Ease::Cubic"]);
                typeList.add("Quartic", iGlobal["$Ease::Quartic"]);
                typeList.add("Quintic", iGlobal["$Ease::Quintic"]);
                typeList.add("Sinusoidal", iGlobal["$Ease::Sinusoidal"]);
                typeList.add("Exponential", iGlobal["$Ease::Exponential"]);
                typeList.add("Circular", iGlobal["$Ease::Circular"]);
                typeList.add("Elastic", iGlobal["$Ease::Elastic"]);
                typeList.add("Back", iGlobal["$Ease::Back"]);
                typeList.add("Bounce", iGlobal["$Ease::Bounce"]);
            }

            // Set the initial easing curve.

            this["oldEase"] = ease;
            this.setEase(ease);

            // Remember callback.

            this["callback"] = callback;
        }
Beispiel #28
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);
            }
        }
Beispiel #29
0
        public void onEaseTypeSet()
        {
            GuiPopUpMenuCtrl      typeList    = this.FOT("typeList");
            GuiTextEditSliderCtrl param1Value = this.FOT("param1Value");
            GuiTextEditSliderCtrl param2Value = this.FOT("param2Value");

            int selected = typeList.getSelected();

            if (selected == iGlobal["$Ease::Elastic"])
            {
                param1Value.setActive(true);
                param2Value.setActive(true);
            }
            else if (selected == iGlobal["Ease::Back"])
            {
                param1Value.setActive(true);
                param2Value.setActive(false);
            }
            else
            {
                param1Value.setActive(false);
                param2Value.setActive(false);
            }
        }
            public void loadNewParticle(SimObject particle)
            {
                GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector";
                ParticleData     PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle";

                if (particle.isObject())
                {
                    particle = particle.getId().AsString();
                }
                else
                {
                    particle = PEP_ParticleSelector.getSelected().AsString();
                }

                this.currParticle = particle;

                particle.call("reload");

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

                this.guiSync();
                this.setParticleNotDirty();
            }