Skip to content

Commit dc8f7b4

Browse files
committed
Expose "fade" methods for AnimationNodeStateMachinePlayback
1 parent 17fb6e3 commit dc8f7b4

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
@@ -1474,8 +1474,8 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
14741474
fading_from_node = playback->get_fading_from_node();
14751475
current_play_pos = playback->get_current_play_pos();
14761476
current_length = playback->get_current_length();
1477-
fade_from_current_play_pos = playback->get_fade_from_play_pos();
1478-
fade_from_length = playback->get_fade_from_length();
1477+
fade_from_current_play_pos = playback->get_fading_from_play_pos();
1478+
fade_from_length = playback->get_fading_from_length();
14791479
fading_time = playback->get_fading_time();
14801480
fading_pos = playback->get_fading_pos();
14811481
}

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
@@ -339,8 +339,8 @@ class AnimationNodeStateMachinePlayback : public Resource {
339339
float get_current_play_pos() const;
340340
float get_current_length() const;
341341

342-
float get_fade_from_play_pos() const;
343-
float get_fade_from_length() const;
342+
float get_fading_from_play_pos() const;
343+
float get_fading_from_length() const;
344344

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

0 commit comments

Comments
 (0)