-
-
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
Add the ability to export sub classes #9343
Comments
This would be very complicated and have very limited use I'd say, implementing this would be difficult and error prone, and would not be used by the vast majority of people |
I believe it's very important for the clarity of code. |
If they're internal to the class they are internal, no? That would logically mean they're not to be exported IMO I'd say that if this is a serious issue for you you might need to rethink how you structure things, I'm not sure your data is well structured, rather than this being an issue with the engine or missing feature |
I understand your point about internal class elements not needing to be exported. However, my concern is more about the organization and readability of the code. When a class grows large, having related logic in separate files can make it harder to navigate and maintain the codebase. Now include the amount of times you need a strategy pattern "exported" and it just becomes a mess. Essentially it's a less annoying version of exporting an enum and doing a switch statement that links the enum with the strategies |
I'd argue the opposite is true, having exported details not be in dedicated files makes it impossible to find them I'd suggest exporting the relevant data directly instead |
I think there was a miscommunication here. Probably @sydist did not mean that the exported variables of the inner class should somehow be displayed in the inspector of the outer class (without instantiation the inner class as a property of the outer class). I think that @sydist meant a bug that the inspector cannot work with non-global classes ( |
The concept OP means isn't a sub class but rather an inner (a.k.a nested) class. |
i did not even notice the inner classes had |
I've just hit this desire too, for setting multiple attribution links on the credits screen of my game: class_name CreditsPerson
extends Control
...
class Link extends Resource:
var title : String
var uri : String
@export var links : Array[Link] = [] Right now, adding items to the
In case you're still not sure, in my example above So I think the title of this issue should probably be changed from "sub classes" to "inner/nested classes". |
Describe the project you are working on
I'm working on an rpg where I want different characters to have different "indicators" for when they're talking with the text box.
Maybe one character would float, another would switch to a animated sprite where the mouth moves, etc....
Describe the problem or limitation you are having in your project
Like any programmer I pull out the Strategy pattern, I would like to export the variable of type "TalkStrategy" to the property editor.
However, I can't do this because resources only appear in the property editor if they're in their own script file!
So I would have to create seperate script files when I need them to be consolidated in one place (the npc class, since only npcs will ever talk and only they will ever have the talking strategy)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Instead I would rather be able to inline classes inside the npc class that define the behaviour for different types of talking strategies, and be still be able to select those from the editor.
That way everything is encapsulated neatly.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
I wasn't able to find a way to work around this.
Is there a reason why this should be core and not an add-on in the asset library?
It's intuitive for the property editor to be able to detect sub classes of the node.
The text was updated successfully, but these errors were encountered: