godotengine / godot

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

Animation and Animation Tree editor UI randomly start referencing stuff in other scenes #62288

Open Ansraer opened 2 years ago

Ansraer commented 2 years ago

Godot version

4.0 alpha 10

System information

Windows 10, amd 6900xt, vulkan clustered

Issue description

Let me preface this by saying that I am not 100% certain what exactly is going wrong here. This might be a duplicate of #62287 or at least somewhat related, but at this point I am not really certain about anything anymore. I am writing this issue to document my own experience in the hopes that it will be useful when other users start encountering similar issues.

I THINK that sometimes the bottom editor panels for editing Animations and Animation Trees don't fully realize that the user has switched scenes and start to use information from the previous scene.

In the case of the Animation Tree this means that while I was definitely editing the correct tree (based on the nodes I was seeing) the "Pick Animation" popup started offering Animations from the previous scene. Sometimes selecting these animations kind of worked in the editor viewport, but stuff always stopped working when I pressed the play button.

In the case of the Animation Player Panel I was suddenly seeing Animation Tracks from Animation Libraries I only added to the Animation Player in the previous scene. The Onion Skinning and the Loop button were also behaving weirdly, but that might have been caused by #62287.

I tried to get some log output, but the only noteworthy thing I found was:

E 0:00:00:0692   _disconnect: Attempt to disconnect a nonexistent connection from '[Animation:-9223372012041272198]'. Signal: 'tracks_changed', callable: 'AnimationPlayer::_animation_changed'.
  <C++ Error>    Condition "signal_is_valid" is true.
  <C++ Source>   core/object/object.cpp:1401 @ _disconnect()

Steps to reproduce

Despite my best efforts I have no clue how to reliably reproduce this, I encountered this randomly three times over two hours. I was working on a project that has two different Animation Players and Animation Trees in two different scenes, but both of them share some of the same AnimationLibraries. After the first time I encountered this I made sure that after switching scene tabs I ALWAYS clicked on the node I wanted to edit before opening the bottom panels, but this didn't really make much of a difference.

Minimal reproduction project

Couldn't figure out how to reproduce this.

bitbrain commented 1 year ago

I can confirm that I also have this problem in my game after upgrading to Godot 4. I searched across my entire codebase via VSCode and could not find anything in my code itself that may cause this to happen. I am not using the tracks_changed signal anywhere. Still, when opening one particular scene of mine it spams the console with:

ERROR: Attempt to disconnect a nonexistent connection from '<Animation#-9223369555521239852>'. Signal: 'tracks_changed', callable: 'AnimationPlayer::_animation_changed'.
   at: (core\object\object.cpp:1326)
bitbrain commented 1 year ago

After the latest change merged into master as part of https://github.com/godotengine/godot/pull/67178 I now get this instead of the issue described above:

ERROR: Disconnecting nonexistent signal 'animation_removed', callable: AnimationPlayer::_animation_removed.
   at: (core\object\object.cpp:1330)
TokageItLab commented 1 year ago

67178 should not be related to this, but #65942 is.