-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
modify and seperate class_name into two functionalties #3329
Comments
Note I am sure how it would translate to 4.0 please let me know what you think. |
I assume you mean to name a Scene as MyCustomClass. How is that supposed to work? How is Godot to know which scene is meant? |
@zinnschlag It would be registered when you add the script to the node. I would guess it would be added on some sort of script added signal and removed on some sort of script removed signal. This means you would have to not only attach the script but also have to save the scene or keep it open in the editor. |
But a script can be attached to nodes in more than one scene. If you have a script S that is attached to both the root nodes of scene A and scene B, which scene is it then? |
@zinnschlag To save you the trouble, it's the same basic idea they've been asking for across several other proposals, like #2612. The aim is to somehow make scenes into types instead of scripts. Which would imply exclusive, one-to-one binding. |
@zinnschlag Yes it would take the node the script was attached and basically package it as a type with all its node's and script's attached to those node's. I'm not saying it would be a actual new type but the idea is depending on the keywords you use you can register it as a global name and you can export it to the creation dialogs. |
The scene keyword would probably be better as a annotation in 4.0 like willnationsdev's I just don't like the idea of having to hard code a file path that might change. |
The same script can be attached to multiple scenes, so Godot cannot guess which scene is needed. You need to explicitly specify the path to the scene in the script, we already discussed this in #1935. |
Describe the project you are working on
Space ship game
Describe the problem or limitation you are having in your project
Describe the feature / enhancement and how it helps to overcome the problem or limitation
:
at the endDescribe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
export
would export it to the resource or node creation dialog depending on whether its a resource or nodeclass
treats it as a new classscene
treats it as a new composite nodeIf this enhancement will not be used often, can it be worked around with a few lines of script?
The scene keyword would be used to register a whole scene as a type.
The class keyword would reduce the amount of keywords in GDScript
The optional export keyword would be used either at the end of a class, scene, property or field
Is there a reason why this should be core and not an add-on in the asset library?
The text was updated successfully, but these errors were encountered: