Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | danelel |
Hello,
Is it possible to @export a dropdown list of animations from an AnimationPlayer?
I currently have:
@export animation_player : AnimationPlayer
@export chosen_animation := ""
That’s what I do currently, but I have to type in the name of an animation from AnimationPlayer. It would be nice if I could populate a dropdown of the available animations within AnimationPlayer to be selected. (Like what’s done when you can select the current_animation from AnimationPlayer itself)
There’s get_animation_list that will give you a list of animations here, albeit it unlikely to work unless you’re running a @tool
script; but even then, I’m not sure how you manage @export
update calling an internal method at design time. Runtime, sure.
spaceyjase | 2023-05-24 16:38
A manual way of achieving it is via exporting enums, but it’s required to do this for every scene. It also doesn’t update when the animation list changes.
@export_enum("anim1", "anim2", "anim3", ...) var chosen_animation: String = "anim1"
GDScript exports — Godot Engine (4.0) documentation in English
umaruru | 2023-05-25 07:08