From 4b983cf23e36d04dde0fcdc676704f33759711f6 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 11 Mar 2016 23:36:00 -0600 Subject: [PATCH 1/2] exposes several datablock entries to the particle editor gui subsystem windCoefficient, animateTexture, framesPerSec, animTexFrames*, animTexTiling *at time of writing, it will read and write this entry to disk, but will not update in realtime. --- .../particleEditor/ParticleEditor.ed.gui | 191 ++++++++++++++++++ .../particleParticleEditor.ed.cs | 14 ++ 2 files changed, 205 insertions(+) diff --git a/Templates/Full/game/tools/particleEditor/ParticleEditor.ed.gui b/Templates/Full/game/tools/particleEditor/ParticleEditor.ed.gui index 3ec447504..5d337b80f 100644 --- a/Templates/Full/game/tools/particleEditor/ParticleEditor.ed.gui +++ b/Templates/Full/game/tools/particleEditor/ParticleEditor.ed.gui @@ -2343,6 +2343,52 @@ $PE_guielement_ext_colorpicker = "18 18"; Extent = $PE_guielement_ext_value; altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"dragCoefficient\", $ThisControl.getText());"; }; + }; //End Particle Drag + new GuiControl(){ // Particle Wind + class = "AggregateControl"; + isContainer = "1"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = $PE_guielement_pos_single_container ; + Extent = $PE_guielement_ext_single_container ; + + new GuiTextCtrl() { + Profile = "ToolsGuiTextProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + position = $PE_guielement_pos_name; + Extent = $PE_guielement_ext_name; + text = "Wind Coeff"; + }; + new GuiSliderCtrl(PEP_windCoefficient) { + internalName = "PEP_windCoefficient_slider"; + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiSliderProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = $PE_guielement_pos_slider; + Extent = $PE_guielement_ext_slider; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "PE_ParticleEditor.updateParticle( \"windCoefficient\", $ThisControl.getValue(), true, true );"; + altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"windCoefficient\", $ThisControl.getValue(), true, false );"; + hovertime = "1000"; + range = "0 1"; + ticks = "0"; + value = "0.298143"; + }; + new GuiTextEditCtrl() { + internalName = "PEP_windCoefficient_textEdit"; + Profile = "ToolsGuiTextEditProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = $PE_guielement_pos_value; + Extent = $PE_guielement_ext_value; + altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"windCoefficient\", $ThisControl.getText());"; + }; }; }; // end stack }; // end "motion" rollout @@ -2548,6 +2594,151 @@ $PE_guielement_ext_colorpicker = "18 18"; }; }; // end stack }; // end "Spin" rollout + new GuiRolloutCtrl() { + class = "BehaviorQuickEditRollout"; + superclass = LBQuickEditRollout; + Profile = "GuiRolloutProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = "197 0"; + Caption = "Animation"; + Margin = "4 4 4 0"; + DragSizable = false; + container = true; + parentRollout = %this.rollout; + object = %behavior; + + new GuiStackControl() { + StackingType = "Vertical"; + HorizStacking = "Left to Right"; + VertStacking = "Top to Bottom"; + Padding = "0"; + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = "1 3"; + Extent = "197 16"; + MinExtent = "16 16"; + canSave = "1"; + isDecoy = "0"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + + new GuiCheckBoxCtrl() { + internalName = "PEP_animateTexture"; + HorizSizing = "width"; + VertSizing = "bottom"; + position = "55 14"; + Extent = "84 18"; + MinExtent = "8 2"; + text = "Animate Texture"; + command = "PE_ParticleEditor.updateParticle( \"animateTexture\", $ThisControl.getValue());"; + }; + new GuiControl(){ // Particle framesPerSec + class = "AggregateControl"; + isContainer = "1"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = $PE_guielement_pos_single_container ; + Extent = $PE_guielement_ext_single_container ; + + new GuiTextCtrl() { + Profile = "ToolsGuiTextProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + position = $PE_guielement_pos_name; + Extent = $PE_guielement_ext_name; + text = "framesPerSec"; + }; + new GuiSliderCtrl(PEP_framesPerSec) { + internalName = "PEP_framesPerSec_slider"; + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiSliderProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = $PE_guielement_pos_slider; + Extent = $PE_guielement_ext_slider; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + range = "0 60"; + ticks = "0"; + value = "0"; + Command = "PE_ParticleEditor.updateParticle( \"framesPerSec\", $ThisControl.getValue(), true, true );"; + altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"framesPerSec\", $ThisControl.getValue(), true, false );"; + }; + new GuiTextEditCtrl() { + internalName = "PEP_framesPerSec_textEdit"; + Profile = "ToolsGuiTextEditProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = $PE_guielement_pos_value; + Extent = $PE_guielement_ext_value; + altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"framesPerSec\", $ThisControl.getText());"; + }; + }; // end framesPerSec + new GuiControl(){ // Particle animTexFramesList + class = "AggregateControl"; + isContainer = "1"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = $PE_guielement_pos_single_container; + Extent = $PE_guielement_ext_single_container; + + new GuiTextCtrl() { + Profile = "ToolsGuiTextProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + position = $PE_guielement_pos_name; + Extent = $PE_guielement_ext_name; + text = "animTexFrames"; + }; + new GuiTextEditCtrl() { + internalName = "PEP_animTexFramesList_textEdit"; + Profile = "ToolsGuiTextEditProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = $PE_guielement_pos_textedit; + Extent = $PE_guielement_ext_textedit; + altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"animTexFrames\", $ThisControl.getText());"; + }; + }; // end animTexFramesList + new GuiControl(){ // Particle animTileCount + class = "AggregateControl"; + isContainer = "1"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = $PE_guielement_pos_single_container; + Extent = $PE_guielement_ext_single_container; + + new GuiTextCtrl() { + Profile = "ToolsGuiTextProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + position = $PE_guielement_pos_name; + Extent = $PE_guielement_ext_name; + text = "TileCount (X Y)"; + }; + new GuiTextEditCtrl() { + internalName = "PEP_animTileCount_textEdit"; + Profile = "ToolsGuiTextEditProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = $PE_guielement_pos_value; + Extent = $PE_guielement_ext_value; + altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); PE_ParticleEditor.updateParticle( \"animTexTiling\", $ThisControl.getText());"; + }; + }; // end animTileCount + }; // end stack + }; // end "Anim" rollout new GuiRolloutCtrl() { class = "BehaviorQuickEditRollout"; superclass = LBQuickEditRollout; diff --git a/Templates/Full/game/tools/particleEditor/particleParticleEditor.ed.cs b/Templates/Full/game/tools/particleEditor/particleParticleEditor.ed.cs index 373e69de3..00a27e5d4 100644 --- a/Templates/Full/game/tools/particleEditor/particleParticleEditor.ed.cs +++ b/Templates/Full/game/tools/particleEditor/particleParticleEditor.ed.cs @@ -91,6 +91,9 @@ function PE_ParticleEditor::guiSync( %this ) PE_ParticleEditor-->PEP_dragCoefficient_slider.setValue( %data.dragCoefficient ); PE_ParticleEditor-->PEP_dragCoefficient_textEdit.setText( %data.dragCoefficient ); + PE_ParticleEditor-->PEP_windCoefficient_slider.setValue( %data.windCoefficient ); + PE_ParticleEditor-->PEP_windCoefficient_textEdit.setText( %data.windCoefficient ); + PE_ParticleEditor-->PEP_spinRandomMin_slider.setValue( %data.spinRandomMin ); PE_ParticleEditor-->PEP_spinRandomMin_textEdit.setText( %data.spinRandomMin ); @@ -131,6 +134,17 @@ function PE_ParticleEditor::guiSync( %this ) PE_ParticleEditor-->PEP_pointTime_slider3.setValue( %data.times[ 3 ] ); PE_ParticleEditor-->PEP_pointTime_textEdit3.setText( %data.times[ 3 ] ); + + //particle animation + PE_ParticleEditor-->PEP_animateTexture.setValue( %data.animateTexture ); + + PE_ParticleEditor-->PEP_framesPerSec_slider.setValue( %data.framesPerSec ); + PE_ParticleEditor-->PEP_framesPerSec_textEdit.setText( %data.framesPerSec ); + + PE_ParticleEditor-->PEP_animTexFramesList_textEdit.setText( %data.animTexFrames ); + + PE_ParticleEditor-->PEP_animTileCount_textEdit.setText( %data.animTexTiling ); + } //--------------------------------------------------------------------------------------------- From 59637bb1c70ce0d9a838aa1833cadb1da4b4b8d6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 6 Jul 2016 22:30:19 -0500 Subject: [PATCH 2/2] Adds a sanity check in the event we don't actually have any animation frames generated. --- Engine/source/T3D/fx/particleEmitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 2391cfe9d..1f1b2a3eb 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1702,7 +1702,7 @@ void ParticleEmitter::setupBillboard( Particle *part, lVerts->color = partCol; } \ // Here we deal with UVs for animated particle (billboard) - if (part->dataBlock->animateTexture) + if (part->dataBlock->animateTexture && !part->dataBlock->animTexFrames.empty()) { S32 fm = (S32)(part->currentAge*(1.0/1000.0)*part->dataBlock->framesPerSec); U8 fm_tile = part->dataBlock->animTexFrames[fm % part->dataBlock->numFrames];