godotengine / godot

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

Pinning `AnimationPlayer` doesn't actually keep it pinned #94041

Open mihe opened 3 months ago

mihe commented 3 months ago

Tested versions

Reproducible in: 4.3.beta [b97110cd307e4d78e20bfafe5de6c082194b2cd6]

System information

Windows 11 (10.0.22631)

Issue description

When using the "Pin AnimationPlayer" button that's found in the upper-right corner of the Animation dock, it doesn't actually seem to keep it pinned, as selecting other types of nodes in the Scene dock (that are meant to prompt other docks to open) causes the Animation dock to disappear in favor of these other docks.

You should hopefully be able to see this happening in this video:

https://github.com/godotengine/godot/assets/4884246/9be3cc37-c155-4524-950c-b0f3164a0ab0

When looking at the code for this button, and doing some git blame, it seems to me that the actual intention of this button is rather to keep a specific AnimationPlayer active in the Animation dock, even when selecting another AnimationPlayer, rather than forcing the Animation dock to be the active dock at all times.

However, I do think the current behavior is odd and unintuitive, and could perhaps be extended to pin the Animation dock even when selecting other types of nodes, which would be quite useful. It would also make it a lot easier to animate something like an AnimatedSprite2D, as you're currently forced to switch back to the Animation dock every time you select one (for keying one of its properties).

Steps to reproduce

  1. Open the MRP
  2. Select the AnimationPlayer node in the Scene dock
  3. Note that the Animation dock opens up
  4. Click the "Pin AnimationPlayer" button in the top-right corner of the Animation dock
  5. Select the AnimationTree node in the Scene dock
  6. Note how the AnimationTree dock replaces the Animation dock
  7. Select the AnimatedSprite2D node in the Scene dock
  8. Note how the SpriteFrames dock replaces the AnimationTree dock
  9. Select the AnimationPlayer node in the Scene dock again
  10. Note how the Animation dock replaces the SpriteFrames dock
  11. Note how the "Pin AnimationPlayer" button is still enabled

Minimal reproduction project (MRP)

pin-animationplayer-bug.zip

passivestar commented 3 months ago

If it's not only pinning the contents of a tab but the tab itself it shouldn't be a button inside of the tab, but rather be handled externally. For example Right Click Tab -> Pin. To unpin you'll either click on the pin icon or another tab

pin

It could expose some basic API so that tabs could pin contents if applicable (i.e animation player would pin the current player). User addons would be able to take advantage of this API too

mihe commented 3 months ago

Agreed, a more general behavior would be preferable, and likely needed as well, as I doubt that AnimationPlayerEditor could enforce the desired behavior purely on its own.