godotengine / godot

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

Saving and restoring AnimationNodeStateMachine works unreliably/unpredictably #84068

Open mikest opened 1 year ago

mikest commented 1 year ago

Godot version

4.2.beta3

System information

Godot v4.2.beta3 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (NVIDIA; 31.0.15.3598) - 13th Gen Intel(R) Core(TM) i9-13900K (32 Threads)

Issue description

I have an AnimationTree with several sub-AnimationNodeStateMachines. I have made edits to the AnimationNodeStateMachines and used the "Save" popup menu on the node to try and save the state machine out as a resource.

Sometimes it works. Sometimes it does nothing and I see errors in the console. Attempting to save a node as "block_playback.tres" produces errors in the debugger and errors in the output.

Some examples of the errors:

E 2:20:57:0103   set_node_position: Condition "!nodes.has(p_node)" is true.
  <C++ Source>   scene/animation/animation_blend_tree.cpp:1233 @ set_node_position()

Some examples of the output pane errors:

  EditorProperty is outside inspector.
  EditorProperty is outside inspector.
  EditorProperty is outside inspector.
  EditorProperty is outside inspector.
  Another resource is loaded from path 'res://weapons/block_playback.tres' (possible cyclic resource inclusion).

Some notes:

  1. The save operation appears to work on the first save and shows the object on the StateMachine node as the saved tres.
  2. When the scene is reloaded the AnimationNodeStateMachine no longer points to the resource, and instead points to an internally generated one.
  3. If I try and update this same AnimationNodeStateMachine and save it out again it will not update to match the resource.

Steps to reproduce

Steps to Reproduce:

  1. Create a new scene
  2. Add an AnimationTree and open the AnimationTree editor
  3. Add a single StateMachine to the canvas.
  4. Open Editor for the new StateMachine and add a single node to it so that it has been edited.
  5. Close the StateMachine editor and click on the popup menu for saving the resource out. image
  6. Save out the resource and give it a name. image
  7. Notice the name of the resource has update on the node. image
  8. Save the AnimationTree scene you created in step 1.
  9. Close the scene.
  10. Open the scene, and switch to the AnimationTree editor.

Results:

Further unexpected behavior:

  1. Try and update the resource on the node by choosing "Quick Load" and referencing the file you previously saved.
  2. Notice the resource does not update.

Further unexpected behavior:

  1. Try and update the resource on the node by choosing "Quick Load" and referencing a different AnimationNodeStateMachine resource.
  2. Open the StateMachine editor.
  3. Notice that the StateMachine still has the old configuration. The load failed.

Expectations:

The saving and restoring of StateMachine resources doesn't appear to work for existing StateMachines. The workaround for the current behavior is to delete the old state machine, create a new one, load the config from disk, and then continue. This workaround is hard to discover, as the Save/Open commands only appear to work for the first edit. They fail on subsequent edits.

Minimal reproduction project

N/A

Biran0 commented 7 months ago

Indeed, I just deleted/and replaced the points(animations) that a had in a Blendspace2D , in my AnimationTree and now when I first open my project I get too red errors:

EditorProperty is outside inspector. EditorProperty is outside inspector. EditorProperty is outside inspector. EditorProperty is outside inspector.

I dont have any idea how to fix this.. but at least it only does it when I first open the project , it doesnt show errors when I run it.