[DOCS] AnimationPlayer new props, members/methods

This commit is contained in:
Will Nations 2017-12-04 22:13:52 -06:00
parent 5938466c84
commit e79456519d
2 changed files with 51 additions and 41 deletions

View File

@ -19,7 +19,7 @@
<argument index="1" name="animation" type="Animation"> <argument index="1" name="animation" type="Animation">
</argument> </argument>
<description> <description>
Add an animation resource to the player, which will be later referenced by the "name" argument. Adds [code]animation[/code] to the player accessible with the key [code]name[/code].
</description> </description>
</method> </method>
<method name="advance"> <method name="advance">
@ -28,7 +28,7 @@
<argument index="0" name="delta" type="float"> <argument index="0" name="delta" type="float">
</argument> </argument>
<description> <description>
Used to skip ahead or skip back in an animation. Delta is the time in seconds to skip. Shifts position in the animation timeline. Delta is the time in seconds to shift.
</description> </description>
</method> </method>
<method name="animation_get_next" qualifiers="const"> <method name="animation_get_next" qualifiers="const">
@ -37,7 +37,7 @@
<argument index="0" name="anim_from" type="String"> <argument index="0" name="anim_from" type="String">
</argument> </argument>
<description> <description>
Return the name of the next animation in the queue. Returns the name of the next animation in the queue.
</description> </description>
</method> </method>
<method name="animation_set_next"> <method name="animation_set_next">
@ -48,21 +48,21 @@
<argument index="1" name="anim_to" type="String"> <argument index="1" name="anim_to" type="String">
</argument> </argument>
<description> <description>
Set the name of an animation that will be played after. Triggers the [code]anim_to[/code] animation when the [code]anim_from[/code] animation completes.
</description> </description>
</method> </method>
<method name="clear_caches"> <method name="clear_caches">
<return type="void"> <return type="void">
</return> </return>
<description> <description>
The animation player creates caches for faster access to the nodes it will animate. However, if a specific node is removed, it may not notice it, so clear_caches will force the player to search for the nodes again. [code]AnimationPlayer[/code] caches animated nodes. It may not notice if a node disappears, so clear_caches forces it to update the cache again.
</description> </description>
</method> </method>
<method name="clear_queue"> <method name="clear_queue">
<return type="void"> <return type="void">
</return> </return>
<description> <description>
If animations are queued to play, clear them. Clears all queued, unplayed animations.
</description> </description>
</method> </method>
<method name="find_animation" qualifiers="const"> <method name="find_animation" qualifiers="const">
@ -71,7 +71,7 @@
<argument index="0" name="animation" type="Animation"> <argument index="0" name="animation" type="Animation">
</argument> </argument>
<description> <description>
Find an animation name by resource. Returns the name of [code]animation[/code] or empty string if not found.
</description> </description>
</method> </method>
<method name="get_animation" qualifiers="const"> <method name="get_animation" qualifiers="const">
@ -80,21 +80,21 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Get an [Animation] resource by requesting a name. Returns the [Animation] with key [code]name[/code] or [code]null[/code] if not found.
</description> </description>
</method> </method>
<method name="get_animation_list" qualifiers="const"> <method name="get_animation_list" qualifiers="const">
<return type="PoolStringArray"> <return type="PoolStringArray">
</return> </return>
<description> <description>
Get the list of names of the animations stored in the player. Returns the list of stored animation names.
</description> </description>
</method> </method>
<method name="get_autoplay" qualifiers="const"> <method name="get_autoplay" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<description> <description>
Return the name of the animation that will be automatically played when the scene is loaded. Returns the name of the animation played when the scene loads.
</description> </description>
</method> </method>
<method name="get_blend_time" qualifiers="const"> <method name="get_blend_time" qualifiers="const">
@ -105,35 +105,28 @@
<argument index="1" name="anim_to" type="String"> <argument index="1" name="anim_to" type="String">
</argument> </argument>
<description> <description>
Get the blend time between two animations, referenced by their names. Get the blend time (in seconds) between two animations, referenced by their names.
</description> </description>
</method> </method>
<method name="get_current_animation" qualifiers="const"> <method name="get_current_animation" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<description> <description>
Return the name of the animation being played. Returns the name of the currently playing animation.
</description> </description>
</method> </method>
<method name="get_current_animation_length" qualifiers="const"> <method name="get_anim_length" qualifiers="const">
<return type="float"> <return type="float">
</return> </return>
<description> <description>
Get the length (in seconds) of the currently being played animation. Get the length (in seconds) of the currently playing animation.
</description> </description>
</method> </method>
<method name="get_current_animation_position" qualifiers="const"> <method name="get_anim_position" qualifiers="const">
<return type="float"> <return type="float">
</return> </return>
<description> <description>
Get the position (in seconds) of the currently being played animation. Get the position (in seconds) of the currently playing animation.
</description>
</method>
<method name="get_position" qualifiers="const">
<return type="float">
</return>
<description>
Return the playback position (in seconds) in an animation channel (or channel 0 if none is provided).
</description> </description>
</method> </method>
<method name="get_speed_scale" qualifiers="const"> <method name="get_speed_scale" qualifiers="const">
@ -149,21 +142,21 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Request whether an [Animation] name exist within the player. Returns [code]true[/code] if the [code]AnimationPlayer[/code] stores an [Animation] with key [code]name[/code].
</description> </description>
</method> </method>
<method name="is_active" qualifiers="const"> <method name="is_active" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Return true if the player is active. Returns true if the player is active.
</description> </description>
</method> </method>
<method name="is_playing" qualifiers="const"> <method name="is_playing" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Return whether an animation is playing. Returns [code]true[/code] if playing an animation.
</description> </description>
</method> </method>
<method name="play"> <method name="play">
@ -178,7 +171,7 @@
<argument index="3" name="from_end" type="bool" default="false"> <argument index="3" name="from_end" type="bool" default="false">
</argument> </argument>
<description> <description>
Play a given animation by the animation name. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards. Play the animation with key [code]name[/code]. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards.
</description> </description>
</method> </method>
<method name="play_backwards"> <method name="play_backwards">
@ -189,7 +182,7 @@
<argument index="1" name="custom_blend" type="float" default="-1"> <argument index="1" name="custom_blend" type="float" default="-1">
</argument> </argument>
<description> <description>
Play a given animation by the animation name in reverse. Play the animation with key [code]name[/code] in reverse.
</description> </description>
</method> </method>
<method name="queue"> <method name="queue">
@ -207,7 +200,7 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Remove an animation from the player (by supplying the same name used to add it). Remove the animation with key [code]name[/code].
</description> </description>
</method> </method>
<method name="rename_animation"> <method name="rename_animation">
@ -218,7 +211,7 @@
<argument index="1" name="newname" type="String"> <argument index="1" name="newname" type="String">
</argument> </argument>
<description> <description>
Rename an existing animation. Rename an existing animation with key [code]name[/code] to [code]newname[/code].
</description> </description>
</method> </method>
<method name="seek"> <method name="seek">
@ -229,7 +222,7 @@
<argument index="1" name="update" type="bool" default="false"> <argument index="1" name="update" type="bool" default="false">
</argument> </argument>
<description> <description>
Seek the animation to a given position in time (in seconds). If 'update' is true, the animation will be updated too, otherwise it will be updated at process time. Seek the animation to the [code]seconds[/code] point in time (in seconds). If 'update' is true, the animation updates too, otherwise it updates at process time.
</description> </description>
</method> </method>
<method name="set_active"> <method name="set_active">
@ -287,7 +280,7 @@
<argument index="0" name="reset" type="bool" default="true"> <argument index="0" name="reset" type="bool" default="true">
</argument> </argument>
<description> <description>
Stop the currently playing animation. Stop the currently playing animation. If [code]reset[/code] is [code]true[/code], the anim position is reset to [code]0[/code].
</description> </description>
</method> </method>
<method name="stop_all"> <method name="stop_all">
@ -300,10 +293,25 @@
</methods> </methods>
<members> <members>
<member name="playback_default_blend_time" type="float" setter="set_default_blend_time" getter="get_default_blend_time"> <member name="playback_default_blend_time" type="float" setter="set_default_blend_time" getter="get_default_blend_time">
The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. Default value: [code]0[/code].
</member> </member>
<member name="playback_process_mode" type="int" setter="set_animation_process_mode" getter="get_animation_process_mode" enum="AnimationPlayer.AnimationProcessMode"> <member name="playback_process_mode" type="int" setter="set_animation_process_mode" getter="get_animation_process_mode" enum="AnimationPlayer.AnimationProcessMode">
The process notification in which to update animations. Default value: [enum ANIMATION_PROCESS_IDLE].
</member> </member>
<member name="root_node" type="NodePath" setter="set_root" getter="get_root"> <member name="root_node" type="NodePath" setter="set_root" getter="get_root">
The node from which node path references will travel. Default value: [code]".."[/code].
</member>
<member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay">
The name of the animation to play when the scene loads. Default value: [code]""[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
The speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default value: [code]1[/code].
</member>
<member name="active" type="bool" setter="set_active" getter="is_active">
If [code]true[/code] updates animations in response to process-related notifications. Default value: [code]true[/code].
</member>
<member name="current_anim" type="String" setter="set_current_anim" getter="get_current_anim">
The name of the current animation. If already playing, restarts the animation. Ensure [member active] is [code]true[/code] to simulate [method play]. Default value: [code]""[/code].
</member> </member>
</members> </members>
<signals> <signals>
@ -313,21 +321,21 @@
<argument index="1" name="new_name" type="String"> <argument index="1" name="new_name" type="String">
</argument> </argument>
<description> <description>
If the currently being played animation changes, this signal will notify of such change. Emitted when the [Animation] with key [member current_anim] is modified.
</description> </description>
</signal> </signal>
<signal name="animation_finished"> <signal name="animation_finished">
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Notifies when an animation finished playing. Emitted when an animation finishes.
</description> </description>
</signal> </signal>
<signal name="animation_started"> <signal name="animation_started">
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Notifies when an animation starts playing. Emitted when an animation starts.
</description> </description>
</signal> </signal>
</signals> </signals>

View File

@ -1324,7 +1324,9 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_root"), &AnimationPlayer::get_root); ClassDB::bind_method(D_METHOD("get_root"), &AnimationPlayer::get_root);
ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false)); ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_position"), &AnimationPlayer::get_current_animation_position); ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance);
ClassDB::bind_method(D_METHOD("get_anim_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("get_anim_length"), &AnimationPlayer::get_current_animation_length);
ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation); ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
@ -1333,15 +1335,15 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_animation_process_mode", "mode"), &AnimationPlayer::set_animation_process_mode); ClassDB::bind_method(D_METHOD("set_animation_process_mode", "mode"), &AnimationPlayer::set_animation_process_mode);
ClassDB::bind_method(D_METHOD("get_animation_process_mode"), &AnimationPlayer::get_animation_process_mode); ClassDB::bind_method(D_METHOD("get_animation_process_mode"), &AnimationPlayer::get_animation_process_mode);
ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance);
ADD_GROUP("Playback Options", "playback_"); ADD_GROUP("Playback Options", "playback_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_animation_process_mode", "get_animation_process_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_animation_process_mode", "get_animation_process_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_default_blend_time", "get_default_blend_time"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_default_blend_time", "get_default_blend_time");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "autoplay"), "set_autoplay", "get_autoplay");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_anim"), "set_current_anim", "get_current_anim");
ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "name"))); ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "name")));
ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name"))); ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name")));