public void update() { GuiStackControl SFXParametersStack = this.FOT("SFXParametersStack"); for (uint i = 0; i < SFXParametersStack.getCount(); i++) { // If either the value field or the slider are currently being // edited, don't update the value in order to not interfere with // user editing. GuiControl ctrl = SFXParametersStack.getObject(i); GuiTextEditCtrl valueField = ctrl.FOT("valueField"); GuiSliderCtrl valueSlider = ctrl.FOT("valueSlider"); if (valueField.isFirstResponder() || valueSlider.isThumbBeingDragged()) { continue; } SFXParameter parameter = ctrl["sfxParameter"]; valueField.setValue(parameter.value.AsString()); valueSlider.setValue(parameter.value.AsString()); } // If the control is still awake, schedule another // update. if (this.isVisible()) { this.schedule(iGlobal["$SFX_PARAMETERS_UPDATE_INTERVAL"].AsString(), "update"); } }
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); } }
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". } } }