Implemented tools around particles seed randomization.

The purpose of this code is to expose the necessary
functions for users and engine devs to develop tooling
for properly timing and seeking inside particles.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
QbieShay
2024-05-18 18:13:57 +02:00
committed by Qbieshay
parent bdf625bd54
commit e9eb0b6082
27 changed files with 653 additions and 108 deletions

View File

@ -46,10 +46,20 @@
Returns the enabled state of the given particle flag (see [enum ParticleFlags] for options).
</description>
</method>
<method name="request_particles_process">
<return type="void" />
<param index="0" name="process_time" type="float" />
<description>
Requests the particles to process for extra process time during a single frame.
Useful for particle playback, if used in combination with [member use_fixed_seed] or by calling [method restart] with parameter [code]keep_seed[/code] set to [code]true[/code].
</description>
</method>
<method name="restart">
<return type="void" />
<param index="0" name="keep_seed" type="bool" default="false" />
<description>
Restarts the particle emitter.
If [param keep_seed] is [code]true[/code], the current random seed will be preserved. Useful for seeking and playback.
</description>
</method>
<method name="set_param_curve">
@ -263,6 +273,9 @@
Each particle's vertical scale will vary along this [Curve]. Should be a unit [Curve].
[member split_scale] must be enabled.
</member>
<member name="seed" type="int" setter="set_seed" getter="get_seed" default="0">
Sets the random seed used by the particle system. Only effective if [member use_fixed_seed] is [code]true[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
Particle system's running speed scaling ratio. A value of [code]0[/code] can be used to pause the particles.
</member>
@ -284,6 +297,9 @@
<member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
Particle texture. If [code]null[/code], particles will be squares.
</member>
<member name="use_fixed_seed" type="bool" setter="set_use_fixed_seed" getter="get_use_fixed_seed" default="false">
If [code]true[/code], particles will use the same seed for every simulation using the seed defined in [member seed]. This is useful for situations where the visual outcome should be consistent across replays, for example when using Movie Maker mode.
</member>
</members>
<signals>
<signal name="finished">