You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To avoid stalling the main thread, I am loading VRM models at run-time in a background thread. The official Godot documentation specifies in the thread-safe API:
Interacting with the active scene tree is NOT thread-safe. However, creating scene chunks (nodes in tree arrangement) outside the active tree is fine. This way, parts of a scene can be built or instantiated in a thread, then added in the main thread.
I have gotten background loading to work, however some models throw an error when loading:
E 0:00:02:0128 vrm_utils.gd:77 @ rotate_scene_180_inner(): This function in this node (AliciaSolid_vrm-0_51) 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: (Transform3D())
<C++ Source> scene/3d/node_3d.cpp:333 @ get_transform()
<Stack Trace> vrm_utils.gd:77 @ rotate_scene_180_inner()
vrm_utils.gd:89 @ rotate_scene_180()
vrm_extension.gd:966 @ _import_post()
vrm_model_loader.gd:94 @ _load_model()
vrm_model_loader.gd:75 @ _load_models_threaded()
...
E 0:00:02:0244 vrm_utils.gd:106 @ apply_node_transforms(): This function in this node (Skeleton3D) 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: (Transform3D())
<C++ Source> scene/3d/node_3d.cpp:333 @ get_transform()
<Stack Trace> vrm_utils.gd:106 @ apply_node_transforms()
vrm_utils.gd:322 @ perform_retarget()
vrm_extension.gd:972 @ _import_post()
vrm_model_loader.gd:94 @ _load_model()
vrm_model_loader.gd:75 @ _load_models_threaded()
There are some points in vrm_utils.gd that modify the scene tree, causing this error to be thrown. I have not delved deep enough to see what impacts it may have (i.e., if it is ignorable), however it is a cause for concern.
I have attached an example Godot 4.2 project that demonstrates the error using the sample VRM models provided by the repository. The project will accept models drag and dropped and load multiple models sequentially in a background thread. On start-up, it will load both Alicia and Godette. The active model can be swapped with the left and right arrow keys.
To avoid stalling the main thread, I am loading VRM models at run-time in a background thread. The official Godot documentation specifies in the thread-safe API:
I have gotten background loading to work, however some models throw an error when loading:
There are some points in
vrm_utils.gd
that modify the scene tree, causing this error to be thrown. I have not delved deep enough to see what impacts it may have (i.e., if it is ignorable), however it is a cause for concern.I have attached an example Godot 4.2 project that demonstrates the error using the sample VRM models provided by the repository. The project will accept models drag and dropped and load multiple models sequentially in a background thread. On start-up, it will load both Alicia and Godette. The active model can be swapped with the left and right arrow keys.
vrm-model-viewer.zip
The text was updated successfully, but these errors were encountered: