Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With latest godot getting 4.1 a lot of "This function in this node can only be accessed from either the main thread or a thread group" #4

Closed
Ughuuu opened this issue May 28, 2023 · 3 comments
Labels

Comments

@Ughuuu
Copy link

Ughuuu commented May 28, 2023

About 25 errors similar to this one.

E 0:00:01:0591   get_viewport_rid: This function in this node can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
  <C++ Error>    Condition "!is_readable_from_caller_thread()" is true. Returning: (RID())
  <C++ Source>   scene/main/viewport.cpp:927 @ get_viewport_rid()
@Ughuuu Ughuuu changed the title With latest godot getting a lot of "This function in this node can only be accessed from either the main thread or a thread group" With latest godot getting 4.1 a lot of "This function in this node can only be accessed from either the main thread or a thread group" May 28, 2023
@Calinou
Copy link
Member

Calinou commented May 28, 2023

cc @Ark2000

Does this occur with version 1.0.0 of this add-on? See #1 which moved some computations to a thread.

@Calinou Calinou added the bug label May 28, 2023
@matmas
Copy link

matmas commented Jun 4, 2023

I can also replicate the issue in v4.1.dev4.official [5c2295ff5] and 1.1.0 of this plugin. When I move the mentioned computations from the thread back to the _ready function to be called directly there then there are no errors produced.

@Calinou
Copy link
Member

Calinou commented Jun 26, 2023

Still reproducible as of 3aaa78709 with version 1.1.1 of the add-on/demo:

ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_viewport_rid (scene/main/viewport.cpp:913)
ERROR: Condition "!viewport" is true.
   at: viewport_set_measure_render_time (servers/rendering/renderer_viewport.cpp:1253)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3045)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3045)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3045)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3045)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_content_scale_mode (scene/main/window.cpp:1309)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_size (scene/main/window.cpp:353)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_size (scene/main/window.cpp:353)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_size (scene/main/window.cpp:353)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3045)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_camera_3d (scene/main/viewport.cpp:3668)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_msaa_2d (scene/main/viewport.cpp:3159)

Fixed by e73e837, which is designed to be backwards-compatible with 4.0.x.

@Calinou Calinou closed this as completed Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants