Allow attaching scripts to nodes in the Advanced Import Settings dialog #103418
+57
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some advanced users have been using scenes with an imported glTF scene as a child node in order to attach scripts to the nodes and save that. This is a good use case for inherited scenes, and the editable children checkbox, but there are currently some issues with those.
Regardless of improving imported scenes, being able to attach scripts to nodes in imported scenes within the import process itself is a highly useful feature. We already allow customizing mesh nodes with common things like physics, but other nodes are missing customizability. For many things like physics, ideally users would use glTF extensions. However, there will always be a need for custom game-specific scripts that do not make sense to store in the glTF at all.
This PR adds the ability to use the Advanced Import Settings dialog to attach scripts to nodes so they are available when directly dragging the glTF into the scene. Here's a video showcasing using this feature. The node type will automatically change to accommodate the script if needed, or will use the user-specified type when possible.
adv_import_dialog_attach_script.mp4
Essentially, for any node type or script that can't be determined in the green circle, this PR allows attaching the script or setting node type in the orange circle, instead of using an inherited scene or other scene to attach the script. Also, in the red part, you can't change the type of an existing node if the script would require a different base Godot node type.