From e79456519d0c1dff98ffa5f39e8e7c962b7dd553 Mon Sep 17 00:00:00 2001 From: Will Nations Date: Mon, 4 Dec 2017 22:13:52 -0600 Subject: [PATCH] [DOCS] AnimationPlayer new props, members/methods --- doc/classes/AnimationPlayer.xml | 78 +++++++++++++++------------- scene/animation/animation_player.cpp | 14 ++--- 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index e724f244983..09ace05bfbb 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -19,7 +19,7 @@ - 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]. @@ -28,7 +28,7 @@ - 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. @@ -37,7 +37,7 @@ - Return the name of the next animation in the queue. + Returns the name of the next animation in the queue. @@ -48,21 +48,21 @@ - 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. - 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. - If animations are queued to play, clear them. + Clears all queued, unplayed animations. @@ -71,7 +71,7 @@ - Find an animation name by resource. + Returns the name of [code]animation[/code] or empty string if not found. @@ -80,21 +80,21 @@ - Get an [Animation] resource by requesting a name. + Returns the [Animation] with key [code]name[/code] or [code]null[/code] if not found. - Get the list of names of the animations stored in the player. + Returns the list of stored animation names. - 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. @@ -105,35 +105,28 @@ - Get the blend time between two animations, referenced by their names. + Get the blend time (in seconds) between two animations, referenced by their names. - Return the name of the animation being played. + Returns the name of the currently playing animation. - + - Get the length (in seconds) of the currently being played animation. + Get the length (in seconds) of the currently playing animation. - + - Get the position (in seconds) of the currently being played animation. - - - - - - - Return the playback position (in seconds) in an animation channel (or channel 0 if none is provided). + Get the position (in seconds) of the currently playing animation. @@ -149,21 +142,21 @@ - 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]. - Return true if the player is active. + Returns true if the player is active. - Return whether an animation is playing. + Returns [code]true[/code] if playing an animation. @@ -178,7 +171,7 @@ - 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. @@ -189,7 +182,7 @@ - Play a given animation by the animation name in reverse. + Play the animation with key [code]name[/code] in reverse. @@ -207,7 +200,7 @@ - Remove an animation from the player (by supplying the same name used to add it). + Remove the animation with key [code]name[/code]. @@ -218,7 +211,7 @@ - Rename an existing animation. + Rename an existing animation with key [code]name[/code] to [code]newname[/code]. @@ -229,7 +222,7 @@ - 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. @@ -287,7 +280,7 @@ - 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]. @@ -300,10 +293,25 @@ + The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. Default value: [code]0[/code]. + The process notification in which to update animations. Default value: [enum ANIMATION_PROCESS_IDLE]. + The node from which node path references will travel. Default value: [code]".."[/code]. + + + The name of the animation to play when the scene loads. Default value: [code]""[/code]. + + + The speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default value: [code]1[/code]. + + + If [code]true[/code] updates animations in response to process-related notifications. Default value: [code]true[/code]. + + + 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]. @@ -313,21 +321,21 @@ - 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. - Notifies when an animation finished playing. + Emitted when an animation finishes. - Notifies when an animation starts playing. + Emitted when an animation starts. diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 206f3ccca2f..f3e750d0da9 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1324,7 +1324,9 @@ void AnimationPlayer::_bind_methods() { 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("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); @@ -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("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_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::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_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name")));