mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-26 09:24:19 +01:00
Ported: Add autocompletion for AnimatedSprite.play() - timothyqiu
0f7f3d08ba
This commit is contained in:
parent
2c4a3f686b
commit
285c02bf76
@ -34,6 +34,10 @@
|
||||
#include "scene/resources/texture.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
||||
#define NORMAL_SUFFIX "_normal"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
@ -274,6 +278,23 @@ void SpriteFrames::_set_animations(const Array &p_animations) {
|
||||
}
|
||||
}
|
||||
|
||||
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 SpriteFrames::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_animation", "anim"), &SpriteFrames::add_animation);
|
||||
ClassDB::bind_method(D_METHOD("has_animation", "anim"), &SpriteFrames::has_animation);
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include "scene/2d/animated_sprite.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;
|
||||
@ -275,6 +279,23 @@ SpatialMaterial::BillboardMode SpriteBase3D::get_billboard_mode() const {
|
||||
return billboard_mode;
|
||||
}
|
||||
|
||||
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 SpriteBase3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_centered", "centered"), &SpriteBase3D::set_centered);
|
||||
ClassDB::bind_method(D_METHOD("is_centered"), &SpriteBase3D::is_centered);
|
||||
|
@ -240,6 +240,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