Add back AnimationPlayer.get_argument_options

This commit is contained in:
HolonProduction 2024-11-15 13:06:59 +01:00
parent 98ddec4b8b
commit a389eb4608
9 changed files with 64 additions and 0 deletions

View File

@ -1,3 +1,16 @@
[gd_scene load_steps=1 format=3 uid="uid://dl28pdkxcjvym"] [gd_scene load_steps=1 format=3 uid="uid://dl28pdkxcjvym"]
[sub_resource type="Animation" id="Animation_d1pub"]
resource_name = "bounce"
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gs7mj"]
_data = {
"bounce": SubResource("Animation_d1pub")
}
[node name="GetNode" type="Node"] [node name="GetNode" type="Node"]
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_gs7mj")
}

View File

@ -0,0 +1,6 @@
[input]
scene="res://completion/argument_options/argument_options.tscn"
[output]
include=[
{"display": "\"bounce\""},
]

View File

@ -0,0 +1,5 @@
@onready var anim := $AnimationPlayer
func test():
anim.play()
pass

View File

@ -0,0 +1,6 @@
[input]
scene="res://completion/argument_options/argument_options.tscn"
[output]
include=[
{"display": "\"bounce\""},
]

View File

@ -0,0 +1,5 @@
@onready var anim: AnimationPlayer = $AnimationPlayer
func test():
anim.play()
pass

View File

@ -0,0 +1,6 @@
[input]
scene="res://completion/argument_options/argument_options.tscn"
[output]
include=[
{"display": "\"bounce\""},
]

View File

@ -0,0 +1,5 @@
@onready var anim = $AnimationPlayer
func test():
anim.play()
pass

View File

@ -876,6 +876,20 @@ Tween::EaseType AnimationPlayer::get_auto_capture_ease_type() const {
return auto_capture_ease_type; return auto_capture_ease_type;
} }
#ifdef TOOLS_ENABLED
void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
const String pf = p_function;
if (p_idx == 0 && (pf == "play" || pf == "play_backwards" || pf == "has_animation" || pf == "queue")) {
List<StringName> al;
get_animation_list(&al);
for (const StringName &name : al) {
r_options->push_back(String(name).quote());
}
}
AnimationMixer::get_argument_options(p_function, p_idx, r_options);
}
#endif
void AnimationPlayer::_animation_removed(const StringName &p_name, const StringName &p_library) { void AnimationPlayer::_animation_removed(const StringName &p_name, const StringName &p_library) {
AnimationMixer::_animation_removed(p_name, p_library); AnimationMixer::_animation_removed(p_name, p_library);

View File

@ -178,6 +178,10 @@ public:
void set_auto_capture_ease_type(Tween::EaseType p_auto_capture_ease_type); void set_auto_capture_ease_type(Tween::EaseType p_auto_capture_ease_type);
Tween::EaseType get_auto_capture_ease_type() const; Tween::EaseType get_auto_capture_ease_type() const;
#ifdef TOOLS_ENABLED
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
#endif
void play(const StringName &p_name = StringName(), double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false); void play(const StringName &p_name = StringName(), double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);
void play_section_with_markers(const StringName &p_name = StringName(), const StringName &p_start_marker = StringName(), const StringName &p_end_marker = StringName(), double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false); void play_section_with_markers(const StringName &p_name = StringName(), const StringName &p_start_marker = StringName(), const StringName &p_end_marker = StringName(), double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);
void play_section(const StringName &p_name = StringName(), double p_start_time = -1, double p_end_time = -1, double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false); void play_section(const StringName &p_name = StringName(), double p_start_time = -1, double p_end_time = -1, double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);