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

Allow attaching scripts to nodes in the Advanced Import Settings dialog #103418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Mar 1, 2025

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.

attach_scripts

@aaronfranke aaronfranke force-pushed the adv-imp-attach-script branch from dda1801 to b09f94e Compare March 1, 2025 01:17
@passivestar
Copy link
Contributor

Problem with a script is you can only have one per node, every unique object type would require its unique script with lots of exported variables to allow custom behavior. With child nodes as components you can reuse and combine game logic in an artist-friendly way, a wider range of unique behaviors can be achieved for imported assets in editor without touching any code. One script approach is good for solo projects when everything is code, but won't scale that well to teams where programmers and game designers are separate people focused on solving different problems

This is a good use case for inherited scenes, and the editable children checkbox, but there are currently some issues with those

Why one script instead of improving those workflows? Not only inherited scenes / editable children allow components, they also allow adding and previewing unique node types like particle systems and connect signals in editor

@Zireael07
Copy link
Contributor

Yes please I'm one of said advanced users :)

@aaronfranke
Copy link
Member Author

@passivestar This isn't necessarily "instead of" those workflows, since those can and should be improved too. However, if a script requires a node type change, you can't change the type of existing nodes in an inherited scene, only add new nodes.

Indeed customizing properties on these nodes and previewing their final appearance will require using the regular scene editor with the inspector on an inherited scene, since we don't want the advanced import settings dialog to do that.

@passivestar
Copy link
Contributor

Fair, just wanted to confirm that this isn't intended to be a replacement, good to hear that we're on the same page

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.

3 participants