示例#1
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);
            }
示例#2
0
            public void updateSpeedFields(bool isRandom, float value, bool isSlider, bool onMouseUp)
            {
                GuiSliderCtrl   PEE_ejectionVelocity_slider   = this.FOT("PEE_ejectionVelocity_slider");
                GuiSliderCtrl   PEE_velocityVariance_slider   = this.FOT("PEE_velocityVariance_slider");
                GuiTextEditCtrl PEE_ejectionVelocity_textEdit = this.FOT("PEE_ejectionVelocity_textEdit");
                GuiTextEditCtrl PEE_velocityVariance_textEdit = this.FOT("PEE_velocityVariance_textEdit");
                editor          Editor         = "Editor";
                ParticleEditor  ParticleEditor = "ParticleEditor";

                this.setEmitterDirty();
                SimObject emitter = this.currEmitter;

                // Transfer values over to gui controls.

                if (isRandom)
                {
                    if (value > PEE_ejectionVelocity_slider.getValue())
                    {
                        PEE_ejectionVelocity_textEdit.setText(value.AsString());
                        PEE_ejectionVelocity_slider.setValue(value.AsString());
                    }
                }
                else
                {
                    if (value < PEE_velocityVariance_slider.getValue())
                    {
                        PEE_velocityVariance_textEdit.setText(value.AsString());
                        PEE_velocityVariance_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["newValueEjectionVelocity"] = PEE_ejectionVelocity_textEdit.getText();
                    last["newValueVelocityVariance"] = PEE_velocityVariance_textEdit.getText();
                }
                else
                {
                    ParticleEditorUndo.ActionUpdateActiveEmitterSpeedFields action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterSpeedFields>("Update Active Emitter");
                    action["emitter"]   = emitter;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();

                    action["newValueEjectionVelocity"] = PEE_ejectionVelocity_textEdit.getText();
                    action["oldValueEjectionVelocity"] = emitter["ejectionVelocity"];

                    action["newValueVelocityVariance"] = PEE_velocityVariance_textEdit.getText();
                    action["oldValueVelocityVariance"] = emitter["velocityVariance"];

                    ParticleEditor.submitUndo(action);
                }

                // Set the values on the current emitter.

                emitter["ejectionVelocity"] = PEE_ejectionVelocity_textEdit.getText();
                emitter["velocityVariance"] = PEE_velocityVariance_textEdit.getText();
                emitter.call("reload");
            }
            public void updateSpinFields(bool isMax, float value, bool isSlider, bool onMouseUp)
            {
                editor         Editor         = "Editor";
                ParticleEditor ParticleEditor = "ParticleEditor";

                GuiTextEditCtrl PEP_spinRandomMin_textEdit = this.FOT("PEP_spinRandomMin_textEdit");
                GuiTextEditCtrl PEP_spinRandomMax_textEdit = this.FOT("PEP_spinRandomMax_textEdit");
                GuiSliderCtrl   PEP_spinRandomMin_slider   = this.FOT("PEP_spinRandomMin_slider");
                GuiSliderCtrl   PEP_spinRandomMax_slider   = this.FOT("PEP_spinRandomMax_slider");

                this.setParticleDirty();
                SimObject particle = this.currParticle;

                // Transfer values over to gui controls.
                if (isMax)
                {
                    value++;
                    if (value > PEP_spinRandomMax_slider.getValue())
                    {
                        PEP_spinRandomMax_textEdit.setText(value.AsString());
                        PEP_spinRandomMax_slider.setValue(value.AsString());
                    }
                }
                else
                {
                    value--;
                    if (value < PEP_spinRandomMin_slider.getValue())
                    {
                        PEP_spinRandomMin_textEdit.setText(value.AsString());
                        PEP_spinRandomMin_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["newValueSpinRandomMax"] = PEP_spinRandomMax_textEdit.getText();
                    last["newValueSpinRandomMin"] = PEP_spinRandomMin_textEdit.getText();
                }
                else
                {
                    var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveParticleSpinFields>("Update Active Particle");
                    action["particle"]              = particle;
                    action["isSlider"]              = isSlider.AsString();
                    action["onMouseUp"]             = onMouseUp.AsString();
                    action["newValueSpinRandomMax"] = PEP_spinRandomMax_textEdit.getText();
                    action["oldValueSpinRandomMax"] = particle["spinRandomMax"];

                    action["newValueSpinRandomMin"] = PEP_spinRandomMin_textEdit.getText();
                    action["oldValueSpinRandomMin"] = particle["spinRandomMin"];

                    ParticleEditor.submitUndo(action);
                }

                particle["spinRandomMax"] = PEP_spinRandomMax_textEdit.getText();
                particle["spinRandomMin"] = PEP_spinRandomMin_textEdit.getText();
                particle.call("reload");
            }