godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.52k stars 21.26k forks source link

No animation name autocomplete for AnimationPlayer in base script #80601

Open timothyqiu opened 1 year ago

timothyqiu commented 1 year ago

Godot version

4.1.1.stable, master[7ba79d68bd0f97797d7cb37452da6a036ba7c7c9]

System information

Arch Linux

Issue description

When an AnimationPlayer onready variable is created in the base script, autocomplete in a derived script won't show animations added in the derived scene.

See "steps to reproduce" for detail.

Steps to reproduce

  1. Create a BaseScene
    • Add an AnimationPlayer node inside
    • Create a script for the root node, and create a onready variable animation_player for the AnimationPlayer node
  2. Create a DerivedScene, inheriting from BaseScene
    • Create a new animation "foo" in the AnimationPlayer
    • Extend the root script
  3. In the extended script, type animation_player.play(
    • Expected: show "foo" in the completion prompt
    • Actual: nothing is show

If the onready variable is defined in the extended script instead of in the base script, then everything works fine.

Minimal reproduction project

test-4.zip

ghost commented 2 months ago

This is a known bug.

You have to do something like:

var animation_player := $AnimationPlayer

instead of

var animation_player: AnimationPlayer = $AnimationPlayer for the animation names to show in auto-complete. Not sure why this happens though... hope it gets fixed!

mmmmmmmmmmmmmmmmmmmdonuts commented 2 weeks ago

Still happening in Godot 4.3