-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix errors when re-importing 3D asset files #90531
Fix errors when re-importing 3D asset files #90531
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit I don't understand this code very well, but currently I get randomly duplicated nodes and this crash constantly and it's driving me nuts.
If this PR has even a remote chance of solving that, I'm in. It can't possibly make things worse than they are now.
The cube is still duplicated 🤔 godot.windows.editor.dev.x86_64_iwSv4PC1m2.mp4It's gone when you switch scene tab. |
bcc99d4
to
6abf458
Compare
Sorry for the late reply. It reloads scene tabs one by one, so it's better to switch scene tabs first and then process them later. In addition, it does not seem to save scene modifications when necessary, so re-importing resources may cause the scene to lose unsaved modifications. |
Something is still wrong: E90hwCfN2Y.mp4The level scene gets replaced by test (only visually). It doesn't always happen though. I also had a bug where test.tscn had 2 cubes. |
9566621
to
72b0e83
Compare
Two scenes appear to be open in the 3D screen at the same time. It seems that |
Now it seems to work correctly, but there is an error spam 🙃 godot.windows.editor.dev.x86_64_9hPF05HkJ5.mp4Also the current changes make updating scenes after reimport much more expensive. Though maybe it doesn't matter unless someone opens, like, 50 scenes with instances to update. |
Line 5658 in 2149682
Reloading a godot/scene/resources/packed_scene.cpp Lines 1279 to 1280 in 8e2141e
|
20b2b9d
to
9b28fcb
Compare
If the scene has unsaved modifications before reimporting, these modifications will not be saved after reimporting, but the unsaved mark ( Should these modifications be saved before reimporting? |
9b28fcb
to
c9f4a92
Compare
reload_instances_with_path_in_edited_scenes
in EditorNode
IIRC reloading a scene tries to re-apply unsaved changes, so nothing should be lost. Though maybe it's different for regular instances vs imported scenes. |
But it doesn't prompt to save when closing the tab. Peek.2024-05-23.19-13.mp4 |
That's because the scene does not appear unsaved. It should retain the unsaved status after soft-reload. |
c9f4a92
to
dfe3468
Compare
Needs rebase due to conflicts >_> |
Some 3D asset files are treated as scenes and may cause some errors when importing. When working through different scene tabs, we need to temporarily add the scene root to the SceneTree to ensure that `editor_selection->add_node()` can work smoothly. This avoids the error message: `ERROR: Condition "!p_node->is_inside_tree()" is true.` This also ensures that no other scenes are accidentally added to the SceneTree causing the wrong display. When there is an inherited scene tab open and it is not the current tab, the new root node is accidentally added as a child node of `scene_root` during replacement. Instantiate the scene early so caches in SceneState that are cleared due to loading are rebuilt early. This avoids numerous error messages: `This operation requires the node cache to have been built.`
dfe3468
to
9fe902b
Compare
reload_instances_with_path_in_edited_scenes
in EditorNode
The conflict has been resolved. The latest commit in master no longer restores the property changes caused by the import, which should refresh the 3D Screen to show the latest changes, but it seems that only the inherited scene will be refreshed, not other scenes. It needs to be reloaded to refresh. |
Thanks! |
I apologize for adding a comment here, not sure if I should have just posted it in the issue (bit new to issues and all of this honestly), but here goes. While this appears to be an intended result, this is more or less destroying my functionality, or I suppose to some degree a lot of tool functionality that depends on enter_tree, in my case rebuilding my terrain every time I reimport any resource, this includes the resources that are part of the terrain being generated, resulting in an endless loop. I believe the implementation of this commit should be re-reviewed, as this method of fixing the errors when re-importing assets has some pretty impactful downsides. |
Some 3D asset files (gltf/glb) are treated as scenes and may cause some errors when importing.
Manually updating the cache in advance resulted in some bugs whenEditorNode::set_edited_scene()
was automatically called for the second update.When working through different scene tabs, we need to temporarily add the scene root to the SceneTree to ensure that
editor_selection->add_node()
can work smoothly. This avoids the error message:ERROR: Condition "!p_node->is_inside_tree()" is true.
This also ensures that no other scenes are accidentally added to the SceneTree causing the wrong display. When there is an inherited scene tab open and it is not the current tab, the new root node is accidentally added as a child node of
scene_root
during replacement.Instantiate the scene early so caches in SceneState that are cleared due to loading are rebuilt early. This avoids numerous error messages:
This operation requires the node cache to have been built.
Supersedes #89428.
Fixes #87451.