Add autocompletion for AnimatedSprite.play()
This commit is contained in:
parent
7774cbd8f2
commit
0f7f3d08ba
@ -33,6 +33,10 @@
|
||||
#include "core/os/os.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
||||
#define NORMAL_SUFFIX "_normal"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
@ -651,6 +655,23 @@ String AnimatedSprite::get_configuration_warning() const {
|
||||
return warning;
|
||||
}
|
||||
|
||||
void AnimatedSprite::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
|
||||
#else
|
||||
const String quote_style = "\"";
|
||||
#endif
|
||||
|
||||
if (p_idx == 0 && p_function == "play" && frames.is_valid()) {
|
||||
List<StringName> al;
|
||||
frames->get_animation_list(&al);
|
||||
for (List<StringName>::Element *E = al.front(); E; E = E->next()) {
|
||||
r_options->push_back(quote_style + String(E->get()) + quote_style);
|
||||
}
|
||||
}
|
||||
Node::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
|
||||
void AnimatedSprite::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite::set_sprite_frames);
|
||||
ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite::get_sprite_frames);
|
||||
|
@ -196,6 +196,8 @@ public:
|
||||
bool is_flipped_v() const;
|
||||
|
||||
virtual String get_configuration_warning() const;
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
||||
|
||||
AnimatedSprite();
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include "core/core_string_names.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
||||
Color SpriteBase3D::_get_color_accum() {
|
||||
if (!color_dirty) {
|
||||
return color_accum;
|
||||
@ -1176,6 +1180,23 @@ String AnimatedSprite3D::get_configuration_warning() const {
|
||||
return warning;
|
||||
}
|
||||
|
||||
void AnimatedSprite3D::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
|
||||
#else
|
||||
const String quote_style = "\"";
|
||||
#endif
|
||||
|
||||
if (p_idx == 0 && p_function == "play" && frames.is_valid()) {
|
||||
List<StringName> al;
|
||||
frames->get_animation_list(&al);
|
||||
for (List<StringName>::Element *E = al.front(); E; E = E->next()) {
|
||||
r_options->push_back(quote_style + String(E->get()) + quote_style);
|
||||
}
|
||||
}
|
||||
Node::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
|
||||
void AnimatedSprite3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite3D::set_sprite_frames);
|
||||
ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite3D::get_sprite_frames);
|
||||
|
@ -237,6 +237,8 @@ public:
|
||||
virtual Rect2 get_item_rect() const;
|
||||
|
||||
virtual String get_configuration_warning() const;
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
||||
|
||||
AnimatedSprite3D();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user