-
-
Notifications
You must be signed in to change notification settings - Fork 22.7k
Allow instantiating scenes without any scripts #107817
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
base: master
Are you sure you want to change the base?
Allow instantiating scenes without any scripts #107817
Conversation
The functionality seems useful, but I'm unsure about putting it into GenEditState. It's currently an editor-only enum, and you're adding an unrelated entry to it that also has a runtime effect. I think this needs a proper design proposal first. https://github.com/godotengine/godot-proposals |
ff912c6
to
b7d211f
Compare
Agreed, I've updated the PR to separate it out and will make a dedicated proposal. |
b7d211f
to
6358590
Compare
doc/classes/PackedScene.xml
Outdated
Default instantiation behavior with no special flags. | ||
</constant> | ||
<constant name="INSTANTIATION_NO_SCRIPTS" value="1" enum="InstantiationFlags"> | ||
If passed to [method instantiate], the scene will be instantiated without any attached scripts. |
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.
Docs should likely mention whether this affects child scenes as well, or only nodes from its own scene. (Same goes for SceneState docs).
276334d
to
2cf2042
Compare
2cf2042
to
35a40e0
Compare
35a40e0
to
77f1538
Compare
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.
As far as I can tell, this is not needed:
// Note: In most situations, compatibility methods should be registered via ClassDB::bind_compatibility_method().
// This class is only meant to be used in exceptional circumstances, for example, when Godot's hashing
// algorithm changes and registering compatibility methods for all affect methods would be onerous.
Closes: godotengine/godot-proposals#12647
This would be useful when need a scene for purely visual elements such as generating thumbnails or creating decorative versions.
We already have the ability the include flags to remove scripts when duplicating, so this just removes the extra step in a performant way.