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

Change scene reimport behaviour to address corruption/crashes #92182

Closed
wants to merge 1 commit into from

Conversation

SaracenOne
Copy link
Member

@SaracenOne SaracenOne commented May 21, 2024

This PR makes an important change to how the dynamic scene reimporting works in order to hopefully prevent the crashing regression.

The issue described seems to have been triggered the introduction of PhysicalBoneSimulator3D node which is created by the Skeleton3D node automatically upon entry to the scene tree. The existing function scans the children of all nodes that require reimporting and will attempt preserve them in the hierarchy as best they can. It will also attempt to preserve ownerless nodes which I believe was the main issue with initial implementation. The PR instead does NOT preserve these ownerless nodes and makes the assumption that they are transient and should be left to the discretion of the nodes which created them.

However, for any nodes (including user's custom editor scripts) which create ownerless nodes for visual feedback purposes, there is currently no direct way to tell these nodes that these will require recreating. Since it was decided that a dedicated NOTIFICATION for this event was undesirable, the system will now recurisvely walk the scene tree and attempt to call a script-facing method called '_nodes_scene_reimported' with a list of nodes which have scenes which were reimported, giving the opportunity to recreate the missing nodes, consistent with other editor behaviours. An example project of this in action is attached to this PR.

To test it, open the test_scene then attempt to reimport xbot.gltf. The editor script will automatically instantiate the xbot scene as an ownerless child but also attach a Sprite3D node to it too. The script uses the _nodes_scene_reimported function to detect if the PackedScene used by the 'model_scene' property has changed and will recache everything according, as well as creating a new Sprite3D node and attach it.

container_nodes.zip

* The reimported instance attempt to preserve ownerless nodes.
* A recursive function call to '_nodes_scene_reimported' so these can be recreated if required.
* Clears instance scene_state on new instantiated replacement nodes.
@SaracenOne SaracenOne force-pushed the scene_reload_crashfix branch from 904f127 to 338675d Compare May 21, 2024 04:26
@SaracenOne SaracenOne marked this pull request as ready for review May 21, 2024 04:27
@fire fire requested review from fire and a team May 21, 2024 04:47
@SaracenOne SaracenOne changed the title Change scene reimport behaviour to address corruption/crashes. Change scene reimport behaviour to address corruption/crashes May 21, 2024
@akien-mga
Copy link
Member

Superseded by #92279.

@akien-mga akien-mga closed this May 29, 2024
@akien-mga akien-mga removed this from the 4.3 milestone May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The engine crashes when re-importing .gtlf file
2 participants