Revert property changes in "[DOCS] AnimationPlayer new props, members/methods"
This partially reverts commitse79456519d
and2d07fe2920
, which introduced API changes needing more in-depth review at this stage. Kept the removal of "get_position" binding, redundant with "get_current_animation_position". Kept docs changes where applicable. Also removed the obsolete "stop_all" method which does the same as "stop". Fixes #14602.
This commit is contained in:
parent
592ce20fc5
commit
aa6772d7ab
4 changed files with 88 additions and 57 deletions
|
@ -90,6 +90,13 @@
|
||||||
Returns the list of stored animation names.
|
Returns the list of stored animation names.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="get_autoplay" qualifiers="const">
|
||||||
|
<return type="String">
|
||||||
|
</return>
|
||||||
|
<description>
|
||||||
|
Returns the name of the animation that will be automatically played when the scene is loaded.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_blend_time" qualifiers="const">
|
<method name="get_blend_time" qualifiers="const">
|
||||||
<return type="float">
|
<return type="float">
|
||||||
</return>
|
</return>
|
||||||
|
@ -101,11 +108,18 @@
|
||||||
Get the blend time (in seconds) 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">
|
||||||
|
<return type="String">
|
||||||
|
</return>
|
||||||
|
<description>
|
||||||
|
Returns the name of the animation being played.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_current_animation_length" qualifiers="const">
|
<method name="get_current_animation_length" qualifiers="const">
|
||||||
<return type="float">
|
<return type="float">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Get the length (in seconds) of the currently playing animation.
|
Get the length (in seconds) of the currently being played animation.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_current_animation_position" qualifiers="const">
|
<method name="get_current_animation_position" qualifiers="const">
|
||||||
|
@ -115,6 +129,12 @@
|
||||||
Get the position (in seconds) of the currently playing animation.
|
Get the position (in seconds) of the currently playing animation.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="get_speed_scale" qualifiers="const">
|
||||||
|
<return type="float">
|
||||||
|
</return>
|
||||||
|
<description>
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="has_animation" qualifiers="const">
|
<method name="has_animation" qualifiers="const">
|
||||||
<return type="bool">
|
<return type="bool">
|
||||||
</return>
|
</return>
|
||||||
|
@ -124,6 +144,13 @@
|
||||||
Returns [code]true[/code] if the [code]AnimationPlayer[/code] stores an [Animation] with key [code]name[/code].
|
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">
|
||||||
|
<return type="bool">
|
||||||
|
</return>
|
||||||
|
<description>
|
||||||
|
Returns [code]true[/code] if the player is active.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="is_playing" qualifiers="const">
|
<method name="is_playing" qualifiers="const">
|
||||||
<return type="bool">
|
<return type="bool">
|
||||||
</return>
|
</return>
|
||||||
|
@ -143,7 +170,8 @@
|
||||||
<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 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.
|
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">
|
||||||
|
@ -194,7 +222,25 @@
|
||||||
<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 the [code]seconds[/code] point in time (in seconds). If 'update' is true, the animation updates too, otherwise it updates at process time.
|
Seek the animation to the [code]seconds[/code] point in time (in seconds). If [code]update[/code] is [code]true[/code], the animation updates too, otherwise it updates at process time.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
|
<method name="set_active">
|
||||||
|
<return type="void">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="active" type="bool">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Sets the player as active (playing). If [code]true[/code], updates animations in response to process-related notifications. Default value: [code]true[/code].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
|
<method name="set_autoplay">
|
||||||
|
<return type="void">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="name" type="String">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Defines the name of the animation to play when the scene loads. Default value: [code]""[/code].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_blend_time">
|
<method name="set_blend_time">
|
||||||
|
@ -210,6 +256,24 @@
|
||||||
Specify a blend time (in seconds) between two animations, referenced by their names.
|
Specify a blend time (in seconds) between two animations, referenced by their names.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="set_current_animation">
|
||||||
|
<return type="void">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="anim" type="String">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Sets 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].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
|
<method name="set_speed_scale">
|
||||||
|
<return type="void">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="speed" type="float">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Sets the speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default value: [code]1[/code].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="stop">
|
<method name="stop">
|
||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
|
@ -219,25 +283,10 @@
|
||||||
Stop the currently playing animation. If [code]reset[/code] is [code]true[/code], the anim position is reset to [code]0[/code].
|
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">
|
|
||||||
<return type="void">
|
|
||||||
</return>
|
|
||||||
<description>
|
|
||||||
Stop playback of animations (deprecated).
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
</methods>
|
</methods>
|
||||||
<members>
|
<members>
|
||||||
<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="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="current_animation" type="String" setter="set_current_animation" getter="get_current_animation">
|
|
||||||
The name of the current animation. Default value: [code]""[/code].
|
|
||||||
</member>
|
|
||||||
<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].
|
The process notification in which to update animations. Default value: [enum ANIMATION_PROCESS_IDLE].
|
||||||
|
@ -245,9 +294,6 @@
|
||||||
<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].
|
The node from which node path references will travel. Default value: [code]".."[/code].
|
||||||
</member>
|
</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>
|
|
||||||
</members>
|
</members>
|
||||||
<signals>
|
<signals>
|
||||||
<signal name="animation_changed">
|
<signal name="animation_changed">
|
||||||
|
@ -256,21 +302,21 @@
|
||||||
<argument index="1" name="new_name" type="String">
|
<argument index="1" name="new_name" type="String">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Emitted when the [Animation] with key [member current_anim] is modified.
|
If the currently being played animation changes, this signal will notify of such change.
|
||||||
</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>
|
||||||
Emitted when an animation finishes.
|
Notifies when an animation finished playing.
|
||||||
</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>
|
||||||
Emitted when an animation starts.
|
Notifies when an animation starts playing.
|
||||||
</description>
|
</description>
|
||||||
</signal>
|
</signal>
|
||||||
</signals>
|
</signals>
|
||||||
|
|
|
@ -225,7 +225,7 @@
|
||||||
<argument index="0" name="path" type="NodePath">
|
<argument index="0" name="path" type="NodePath">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Fetches a node. The [NodePath] can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, a [code]null instance[/code] is returned and attempts to access it will result in an "Attempt to call <method> on a null instance." error.
|
Fetches a node. The [NodePath] can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, a [code]null instance[/code] is returned and attempts to access it will result in an "Attempt to call <method> on a null instance." error.
|
||||||
Note: fetching absolute paths only works when the node is inside the scene tree (see [method is_inside_tree]).
|
Note: fetching absolute paths only works when the node is inside the scene tree (see [method is_inside_tree]).
|
||||||
[i]Example:[/i] Assume your current node is Character and the following tree:
|
[i]Example:[/i] Assume your current node is Character and the following tree:
|
||||||
[codeblock]
|
[codeblock]
|
||||||
|
|
|
@ -379,6 +379,16 @@
|
||||||
Sets the metadata of an item, which might be of any type. You can later get it with [method get_item_metadata], which provides a simple way of assigning context data to items.
|
Sets the metadata of an item, which might be of any type. You can later get it with [method get_item_metadata], which provides a simple way of assigning context data to items.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="set_item_multistate">
|
||||||
|
<return type="void">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="idx" type="int">
|
||||||
|
</argument>
|
||||||
|
<argument index="1" name="state" type="int">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="set_item_shortcut">
|
<method name="set_item_shortcut">
|
||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
|
@ -391,16 +401,6 @@
|
||||||
<description>
|
<description>
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_item_multistate">
|
|
||||||
<return type="void">
|
|
||||||
</return>
|
|
||||||
<argument index="0" name="idx" type="int">
|
|
||||||
</argument>
|
|
||||||
<argument index="1" name="state" type="int">
|
|
||||||
</argument>
|
|
||||||
<description>
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
<method name="set_item_submenu">
|
<method name="set_item_submenu">
|
||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
|
|
|
@ -233,7 +233,6 @@ void AnimationPlayer::_notification(int p_what) {
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
//stop_all();
|
|
||||||
clear_caches();
|
clear_caches();
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -738,7 +737,7 @@ void AnimationPlayer::remove_animation(const StringName &p_name) {
|
||||||
|
|
||||||
ERR_FAIL_COND(!animation_set.has(p_name));
|
ERR_FAIL_COND(!animation_set.has(p_name));
|
||||||
|
|
||||||
stop_all();
|
stop();
|
||||||
_unref_anim(animation_set[p_name].animation);
|
_unref_anim(animation_set[p_name].animation);
|
||||||
animation_set.erase(p_name);
|
animation_set.erase(p_name);
|
||||||
|
|
||||||
|
@ -775,9 +774,7 @@ void AnimationPlayer::rename_animation(const StringName &p_name, const StringNam
|
||||||
ERR_FAIL_COND(String(p_new_name).find("/") != -1 || String(p_new_name).find(":") != -1);
|
ERR_FAIL_COND(String(p_new_name).find("/") != -1 || String(p_new_name).find(":") != -1);
|
||||||
ERR_FAIL_COND(animation_set.has(p_new_name));
|
ERR_FAIL_COND(animation_set.has(p_new_name));
|
||||||
|
|
||||||
//print_line("Rename anim: "+String(p_name)+" name: "+String(p_new_name));
|
stop();
|
||||||
|
|
||||||
stop_all();
|
|
||||||
AnimationData ad = animation_set[p_name];
|
AnimationData ad = animation_set[p_name];
|
||||||
ad.name = p_new_name;
|
ad.name = p_new_name;
|
||||||
animation_set.erase(p_name);
|
animation_set.erase(p_name);
|
||||||
|
@ -1019,13 +1016,6 @@ void AnimationPlayer::stop(bool p_reset) {
|
||||||
playing = false;
|
playing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationPlayer::stop_all() {
|
|
||||||
|
|
||||||
stop();
|
|
||||||
|
|
||||||
_set_process(false); // always process when starting an animation
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnimationPlayer::set_speed_scale(float p_speed) {
|
void AnimationPlayer::set_speed_scale(float p_speed) {
|
||||||
|
|
||||||
speed_scale = p_speed;
|
speed_scale = p_speed;
|
||||||
|
@ -1307,8 +1297,8 @@ void AnimationPlayer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("play", "name", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play, DEFVAL(""), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
|
ClassDB::bind_method(D_METHOD("play", "name", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play, DEFVAL(""), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
|
||||||
ClassDB::bind_method(D_METHOD("play_backwards", "name", "custom_blend"), &AnimationPlayer::play_backwards, DEFVAL(""), DEFVAL(-1));
|
ClassDB::bind_method(D_METHOD("play_backwards", "name", "custom_blend"), &AnimationPlayer::play_backwards, DEFVAL(""), DEFVAL(-1));
|
||||||
ClassDB::bind_method(D_METHOD("stop", "reset"), &AnimationPlayer::stop, DEFVAL(true));
|
ClassDB::bind_method(D_METHOD("stop", "reset"), &AnimationPlayer::stop, DEFVAL(true));
|
||||||
ClassDB::bind_method(D_METHOD("stop_all"), &AnimationPlayer::stop_all);
|
|
||||||
ClassDB::bind_method(D_METHOD("is_playing"), &AnimationPlayer::is_playing);
|
ClassDB::bind_method(D_METHOD("is_playing"), &AnimationPlayer::is_playing);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_current_animation", "anim"), &AnimationPlayer::set_current_animation);
|
ClassDB::bind_method(D_METHOD("set_current_animation", "anim"), &AnimationPlayer::set_current_animation);
|
||||||
ClassDB::bind_method(D_METHOD("get_current_animation"), &AnimationPlayer::get_current_animation);
|
ClassDB::bind_method(D_METHOD("get_current_animation"), &AnimationPlayer::get_current_animation);
|
||||||
ClassDB::bind_method(D_METHOD("queue", "name"), &AnimationPlayer::queue);
|
ClassDB::bind_method(D_METHOD("queue", "name"), &AnimationPlayer::queue);
|
||||||
|
@ -1326,9 +1316,6 @@ void AnimationPlayer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_root", "path"), &AnimationPlayer::set_root);
|
ClassDB::bind_method(D_METHOD("set_root", "path"), &AnimationPlayer::set_root);
|
||||||
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("advance", "delta"), &AnimationPlayer::advance);
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
|
ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("clear_caches"), &AnimationPlayer::clear_caches);
|
ClassDB::bind_method(D_METHOD("clear_caches"), &AnimationPlayer::clear_caches);
|
||||||
|
@ -1339,15 +1326,13 @@ void AnimationPlayer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
|
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("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false));
|
||||||
|
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_animation"), "set_current_animation", "get_current_animation");
|
|
||||||
|
|
||||||
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")));
|
||||||
|
|
Loading…
Add table
Reference in a new issue