Is it possible to load animations .tres at same time programmatically to Animation Player (gui tool)? I know animations are resources, I did read some godot docs, I didn't find anything related to 'load to animationPlayer tool (gui)'. I have a lot of animations (.tree file extension) in the FilSystem (res://...) and I would like to load or add them to the Animation Player tool programatically if possible.
Just to clear up, I have attach an iamge of the load button of Animation Player too (gui). I would like to use that load way, but programmatically if possible.
You don't.
The Animation panel (what you are calling "AnimationPlayer Tool (gui)") is to edit
AnimationPlayer
nodes, and there is no API to manipulate it.You might be able to hack your way to it, see Overriding AnimationPlayer functions. But it won't be useful if the
AnimationPlayer
being edited does not have the animations.Thus, what you would do is add
Animation
s to anAnimationPlayer
which is being edited in the Animation panel.If you are writing an
EditorPlugin
, you would get a call to_handles
to check if it can handle aNode
, so you can implement it to tell Godot yourEditorPlugin
handlesAnimationPlayer
s:And then you will get a call to
_edit
:That way you can have a reference to the currently edited
AnimationPlayer
, which should be the same in the Animation panel.To add an animation to an
AnimationPlayer
, you need to get anAnimationLibrary
(either get one from theAnimationPlayer
or add a new one) and calladd_animation
on it. The defaultAnimationLibrary
has empty name).For example: