Skip to content

Commit 597b0a2

Browse files
committed
Merge pull request godotengine#109986 from SomeRanDev/animation_node_state_machine_playback_expansion
Expose `get_fading_...` methods for `AnimationNodeStateMachinePlayback`
2 parents d0626c8 + dc8f7b4 commit 597b0a2

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

doc/classes/AnimationNodeStateMachinePlayback.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,36 @@
4040
Returns the playback position within the current animation state.
4141
</description>
4242
</method>
43+
<method name="get_fading_from_length" qualifiers="const">
44+
<return type="float" />
45+
<description>
46+
Returns the playback state length of the node from [method get_fading_from_node]. Returns [code]0[/code] if no animation fade is occurring.
47+
</description>
48+
</method>
4349
<method name="get_fading_from_node" qualifiers="const">
4450
<return type="StringName" />
4551
<description>
4652
Returns the starting state of currently fading animation.
4753
</description>
4854
</method>
55+
<method name="get_fading_from_play_position" qualifiers="const">
56+
<return type="float" />
57+
<description>
58+
Returns the playback position of the node from [method get_fading_from_node]. Returns [code]0[/code] if no animation fade is occurring.
59+
</description>
60+
</method>
61+
<method name="get_fading_length" qualifiers="const">
62+
<return type="float" />
63+
<description>
64+
Returns the length of the current fade animation. Returns [code]0[/code] if no animation fade is occurring.
65+
</description>
66+
</method>
67+
<method name="get_fading_position" qualifiers="const">
68+
<return type="float" />
69+
<description>
70+
Returns the playback position of the current fade animation. Returns [code]0[/code] if no animation fade is occurring.
71+
</description>
72+
</method>
4973
<method name="get_travel_path" qualifiers="const">
5074
<return type="StringName[]" />
5175
<description>

editor/animation/animation_state_machine_editor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,8 +1760,8 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
17601760
fading_from_node = playback->get_fading_from_node();
17611761
current_play_pos = playback->get_current_play_pos();
17621762
current_length = playback->get_current_length();
1763-
fade_from_current_play_pos = playback->get_fade_from_play_pos();
1764-
fade_from_length = playback->get_fade_from_length();
1763+
fade_from_current_play_pos = playback->get_fading_from_play_pos();
1764+
fade_from_length = playback->get_fading_from_length();
17651765
fading_time = playback->get_fading_time();
17661766
fading_pos = playback->get_fading_pos();
17671767
}

scene/animation/animation_node_state_machine.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ float AnimationNodeStateMachinePlayback::get_current_length() const {
334334
return current_nti.length;
335335
}
336336

337-
float AnimationNodeStateMachinePlayback::get_fade_from_play_pos() const {
337+
float AnimationNodeStateMachinePlayback::get_fading_from_play_pos() const {
338338
return fadeing_from_nti.position;
339339
}
340340

341-
float AnimationNodeStateMachinePlayback::get_fade_from_length() const {
341+
float AnimationNodeStateMachinePlayback::get_fading_from_length() const {
342342
return fadeing_from_nti.length;
343343
}
344344

@@ -1215,6 +1215,10 @@ void AnimationNodeStateMachinePlayback::_bind_methods() {
12151215
ClassDB::bind_method(D_METHOD("get_current_play_position"), &AnimationNodeStateMachinePlayback::get_current_play_pos);
12161216
ClassDB::bind_method(D_METHOD("get_current_length"), &AnimationNodeStateMachinePlayback::get_current_length);
12171217
ClassDB::bind_method(D_METHOD("get_fading_from_node"), &AnimationNodeStateMachinePlayback::get_fading_from_node);
1218+
ClassDB::bind_method(D_METHOD("get_fading_from_play_position"), &AnimationNodeStateMachinePlayback::get_fading_from_play_pos);
1219+
ClassDB::bind_method(D_METHOD("get_fading_from_length"), &AnimationNodeStateMachinePlayback::get_fading_from_length);
1220+
ClassDB::bind_method(D_METHOD("get_fading_position"), &AnimationNodeStateMachinePlayback::get_fading_pos);
1221+
ClassDB::bind_method(D_METHOD("get_fading_length"), &AnimationNodeStateMachinePlayback::get_fading_time);
12181222
ClassDB::bind_method(D_METHOD("get_travel_path"), &AnimationNodeStateMachinePlayback::_get_travel_path);
12191223

12201224
ADD_SIGNAL(MethodInfo(SceneStringName(state_started), PropertyInfo(Variant::STRING_NAME, "state")));

scene/animation/animation_node_state_machine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ class AnimationNodeStateMachinePlayback : public Resource {
340340
float get_current_play_pos() const;
341341
float get_current_length() const;
342342

343-
float get_fade_from_play_pos() const;
344-
float get_fade_from_length() const;
343+
float get_fading_from_play_pos() const;
344+
float get_fading_from_length() const;
345345

346346
float get_fading_time() const;
347347
float get_fading_pos() const;

0 commit comments

Comments
 (0)