Beispiel #1
0
            public void createEmitter()
            {
                ParticleEditor ParticleEditor = "ParticleEditor";

                ParticleParticleEditor.PE_ParticleEditor PE_ParticleEditor = "PE_ParticleEditor";

                // Create a new emitter.
                string           emitter     = Util.getUniqueName("newEmitter");
                DatablockCreator oc          = new DatablockCreator("ParticleEmitterData", emitter + " : DefaultEmitter", typeof(ParticleEmitterData));
                SimObject        emitterNode = oc.Create();

                // Submit undo.

                ParticleEditorUndo.ActionCreateNewEmitter action = ParticleEditor.createUndo <ParticleEditorUndo.ActionCreateNewEmitter>("Create New Emitter");
                action["prevEmitter"] = this.currEmitter;
                action["emitter"]     = emitterNode;
                action["emitterName"] = emitter;

                ParticleEditor.submitUndo(action);

                // Execute action.

                action.redo();

                PE_ParticleEditor.createParticle("");
            }
Beispiel #2
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 showNewDialog()
            {
                ParticleParticleEditor.PE_ParticleEditor PE_ParticleEditor = "PE_ParticleEditor";
                //FIXME: disregards particle tab dirty state

                // Open a dialog if the current emitter is 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 + ");"
                                               );
                }

                if (this.dirty)
                {
                    messageBox.MessageBoxYesNoCancel("Save Emitter Changes?",
                                                     "Do you wish to save the changes made to the <br>current emitter before changing the emitter?",
                                                     "PE_EmitterEditor.saveEmitter( " + this.currEmitter.getName() +
                                                     " ); PE_EmitterEditor.createEmitter();",
                                                     "PE_EmitterEditor.saveEmitterDialogDontSave( " + this.currEmitter.getName() +
                                                     " ); PE_EmitterEditor.createEmitter();"
                                                     );
                }
                else
                {
                    this.createEmitter();
                }
            }
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("");
                }
            }
            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);
                }
            }