You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Merge pull request #19087 from danvalho/master
SpriteFrames: expose method to get array containing animation names
This commit is contained in:
@@ -192,6 +192,16 @@ void SpriteFrames::get_animation_list(List<StringName> *r_animations) const {
|
||||
}
|
||||
}
|
||||
|
||||
Vector<String> SpriteFrames::get_animation_names() const {
|
||||
|
||||
Vector<String> names;
|
||||
for (const Map<StringName, Anim>::Element *E = animations.front(); E; E = E->next()) {
|
||||
names.push_back(E->key());
|
||||
}
|
||||
names.sort();
|
||||
return names;
|
||||
}
|
||||
|
||||
void SpriteFrames::set_animation_speed(const StringName &p_anim, float p_fps) {
|
||||
|
||||
ERR_FAIL_COND(p_fps < 0);
|
||||
@@ -283,6 +293,8 @@ void SpriteFrames::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("remove_animation", "anim"), &SpriteFrames::remove_animation);
|
||||
ClassDB::bind_method(D_METHOD("rename_animation", "anim", "newname"), &SpriteFrames::rename_animation);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_animation_names"), &SpriteFrames::get_animation_names);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_animation_speed", "anim", "speed"), &SpriteFrames::set_animation_speed);
|
||||
ClassDB::bind_method(D_METHOD("get_animation_speed", "anim"), &SpriteFrames::get_animation_speed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user