Merge pull request #91437 from TokageItLab/auto-capture

Add `auto_capture` option to AnimationPlayer
This commit is contained in:
Rémi Verschelde 2024-05-02 14:01:25 +02:00
commit 06d105e268
No known key found for this signature in database
GPG key ID: C3336907360768E1
7 changed files with 113 additions and 65 deletions

View file

@ -595,6 +595,9 @@
</method>
</methods>
<members>
<member name="capture_included" type="bool" setter="_set_capture_included" getter="is_capture_included" default="false">
Returns [code]true[/code] if the capture track is included. This is a cached readonly value for performance.
</member>
<member name="length" type="float" setter="set_length" getter="get_length" default="1.0">
The total length of the animation (in seconds).
[b]Note:[/b] Length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping.
@ -658,7 +661,7 @@
Update at the keyframes.
</constant>
<constant name="UPDATE_CAPTURE" value="2" enum="UpdateMode">
Same as [constant UPDATE_CONTINUOUS] but works as a flag to capture the value of the current object and perform interpolation in some methods. See also [method AnimationMixer.capture] and [method AnimationPlayer.play_with_capture].
Same as [constant UPDATE_CONTINUOUS] but works as a flag to capture the value of the current object and perform interpolation in some methods. See also [method AnimationMixer.capture], [member AnimationPlayer.playback_auto_capture], and [method AnimationPlayer.play_with_capture].
</constant>
<constant name="LOOP_NONE" value="0" enum="LoopMode">
At both ends of the animation, the animation will stop playing.

View file

@ -112,7 +112,7 @@
</method>
<method name="play_with_capture">
<return type="void" />
<param index="0" name="name" type="StringName" />
<param index="0" name="name" type="StringName" default="&amp;&quot;&quot;" />
<param index="1" name="duration" type="float" default="-1.0" />
<param index="2" name="custom_blend" type="float" default="-1" />
<param index="3" name="custom_speed" type="float" default="1.0" />
@ -120,12 +120,13 @@
<param index="5" name="trans_type" type="int" enum="Tween.TransitionType" default="0" />
<param index="6" name="ease_type" type="int" enum="Tween.EaseType" default="0" />
<description>
See [method AnimationMixer.capture]. It is almost the same as the following:
See also [method AnimationMixer.capture].
You can use this method to use more detailed options for capture than those performed by [member playback_auto_capture]. When [member playback_auto_capture] is [code]false[/code], this method is almost the same as the following:
[codeblock]
capture(name, duration, trans_type, ease_type)
play(name, custom_blend, custom_speed, from_end)
[/codeblock]
If name is blank, it specifies [member assigned_animation].
If [param name] is blank, it specifies [member assigned_animation].
If [param duration] is a negative value, the duration is set to the interval between the current position and the first key, when [param from_end] is [code]true[/code], uses the interval between the current position and the last key instead.
[b]Note:[/b] The [param duration] takes [member speed_scale] into account, but [param custom_speed] does not, because the capture cache is interpolated with the blend result and the result may contain multiple animations.
</description>
@ -210,6 +211,9 @@
If [code]true[/code] and the engine is running in Movie Maker mode (see [MovieWriter]), exits the engine with [method SceneTree.quit] as soon as an animation is done playing in this [AnimationPlayer]. A message is printed when the engine quits for this reason.
[b]Note:[/b] This obeys the same logic as the [signal AnimationMixer.animation_finished] signal, so it will not quit the engine if the animation is set to be looping.
</member>
<member name="playback_auto_capture" type="bool" setter="set_auto_capture" getter="is_auto_capture" default="true">
If [code]true[/code], performs [method AnimationMixer.capture] before playback automatically. This means just [method play_with_capture] is executed with default arguments instead of [method play].
</member>
<member name="playback_default_blend_time" type="float" setter="set_default_blend_time" getter="get_default_blend_time" default="0.0">
The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision.
</member>