godot icon indicating copy to clipboard operation
godot copied to clipboard

BlendSpace2D outputs `This function in this node... Use call_deferred() instead.` many times when creating a new point.

Open Mantissa-23 opened this issue 1 year ago • 10 comments
trafficstars

Godot version

4.2.rc2.mono

System information

Godot v4.2.rc2.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3734) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

Issue description

The following error is output to the console when performing the below reproduction steps:

Add Animation Point
  This function in this node (/root/@EditorNode@17119/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@PanelContainer@6818/@VBoxContainer@6819/@AnimationTreeEditor@12449) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
  This function in this node (/root/@EditorNode@17119/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@PanelContainer@6818/@VBoxContainer@6819/@AnimationTreeEditor@12449) can only be accessed from either the main thread or a thread group. Use call_deferred() instead

The error will print 32 times on my machine per created point on my machine.

Steps to reproduce

Assuming the provided MRP:

  1. Open res://Games/Kinship/Characters/HumanoidBase.tscn
  2. Enter the AnimationTree editor
  3. Open either of the BlendSpace2D editors
  4. Use the "Create point" tool to create a point with any animation

Minimal reproduction project

AnimationTreeErrorReproduction.zip

Mantissa-23 avatar Nov 28 '23 04:11 Mantissa-23

I guess this is a bug related to the GraphNode rework since this bug might appeared at a time unrelated to the animation rework. It would be helpful if you could bisect.

cc @Geometror

TokageItLab avatar Nov 28 '23 08:11 TokageItLab

I guess this is a bug related to the GraphNode rework since this bug might appeared at a time unrelated to the animation rework.

GUI code must be called from the main thread. You should check if any methods of the animation editor are calling methods of GUI nodes, especially related to tree manipulation, from a sub-thread. I don't think there is any threading in GraphEdit so it shouldn't be the cause of the issue.

YuriSizov avatar Nov 28 '23 14:11 YuriSizov

I believe I'm encountering the same bug. Version 4.2.1 stable. My project also uses BlendSpace2D as mentioned. image

Kylemcarthur avatar Feb 06 '24 19:02 Kylemcarthur

I'm not sure if this is the same bug or a different, but related bug..

I'm getting the following error 3 times any time I save a change to my code while my animation tree is open. I don't have any blend trees, just an animation state machine with a nested animation state machine and a few animation nodes.

This function in this node (/root/@EditorNode@17120/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@PanelContainer@6819/@VBoxContainer@6820/@AnimationTreeEditor@12462) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.

Edit: Further testing revealed that moving all the animations into the root state machine and deleting the nested one eliminated the error.

Edit 2: Never mind.. the errors are back. I'm not sure why..

Eluem avatar Mar 19 '24 06:03 Eluem

If I close the editor when a scene with an animation tree in it is open, when opening the project again I get a number of errors as per

This function in this node (/root/@EditorNode@17120/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@PanelContainer@6819/@VBoxContainer@6820/@AnimationTreeEditor@12462) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.

If the scene isn't the highlighted/open scene then the errors don't occur, and if I switch to that scene then no errors are reported.

baz-atak avatar Apr 11 '24 22:04 baz-atak

I'm getting the same behaviour on 4.2.1 and 4.2.2. Whenever I open my project with an AnimationTree in it I get 15 of these error messages. My tree has a state machine and 2 BlendSpace2D in it.

tiloc avatar Apr 18 '24 20:04 tiloc

image change [Callback Mode]-->[Method]-->Immediate. revise back。

MicroGame0 avatar May 26 '24 05:05 MicroGame0

@MicroGame0 I tried changing the setting to Immediate just in case that's what you meant, errors were still reported so changed back to deferred. My guess is that the blendspace code in the background isn't following the instruction.

baz-atak avatar May 27 '24 13:05 baz-atak

Not sure if people are still having issue with this - very likely - but I just stumbled across this very same problem and it turns out I had both an AnimationPlayer node and an AnimationTree node, this one using said AnimationPlayer node, with the property active on. Turning off the AnimationPlayer node active property did the trick.

The error printed in the terminal seems very misleading and should be looked upon by the developers, assuming that is indeed the root of the problem.

Fichberg avatar Jun 25 '24 22:06 Fichberg

@Fichberg Unchecking active on the AnimationPlayer node solved the issue for me too. Thanks!

David-DiGioia avatar Aug 25 '24 17:08 David-DiGioia

I have the same error but in my case it seems Blend2 causes the issue. eg. blendSpace2D -> Output (this works) blendSpace2D -> Blend2 -> Output (blendSpace2D no longer works) godot 4.3 window10

j3du avatar Oct 19 '24 03:10 j3du

If I close the project with any animationtree node running and open it again, this error appears. If I close the project without any animation running in the editor (END state) then the error does not appear.

Saulo-de-Souza avatar Nov 03 '24 19:11 Saulo-de-Souza