You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a custom Control node in C# that derives from the base Control node.
Describe the problem or limitation you are having in your project
When trying to instance this new node, I have to create a blank control node and attach the script. This isn't a huge problem, but a small slowdown because I have to find the script in the File tree. If I had done this in GDScript (which doesn't work for performance reasons), I could use the class_name keyword and it would show up.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Do it like GDScript. There, when you use the class_name keyword, the script automatically gets added to the Create New Node dialogue.
There would be 2 solutions for C#. Either, we could just add every C# class to the dialogue automatically, or create an attribute which exposes the node to the 'Create New Node' dialogue and optionally give it an icon.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If we were to go for the first solution, it would already work like this (this is a mockup):
If we went for the second solution, I would suggest adding this Attribute: [ExposeAsNode(string iconPath = null)]. Having this attribute on the class will expose it in the dialogue. The optional parameter is for the icon. If it's left as null, it will inherit the icon from the super class. If the path is specified, it will use that.
So now, the class would look like this if we want it exposed and with a custom icon:
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, since it's not code related. However, it can be worked around by creating the base node and adding the script manually, which is tedious because you have to do the additional step of looking up the script in the file system and dragging it onto the new node.
Is there a reason why this should be core and not an add-on in the asset library?
C# support is still in its early stages, and this for consistency between GDScript and C#. It can probably be worked around with an editor plugin that registers a custom type, but that has been made obsolete by the superior class_name (at least that's what I think. Research has shown contradicting results about custom types in editor plugins being obsolete).
The text was updated successfully, but these errors were encountered:
This is a duplicate (or sub-issue) of #22. As a workaround, you can use add_custom_type in EditorPlugin, but this requires that you place your script inside of a plugin.
Describe the project you are working on
I'm working on a custom Control node in C# that derives from the base
Control
node.Describe the problem or limitation you are having in your project
When trying to instance this new node, I have to create a blank control node and attach the script. This isn't a huge problem, but a small slowdown because I have to find the script in the File tree. If I had done this in GDScript (which doesn't work for performance reasons), I could use the
class_name
keyword and it would show up.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Do it like GDScript. There, when you use the
class_name
keyword, the script automatically gets added to the Create New Node dialogue.There would be 2 solutions for C#. Either, we could just add every C# class to the dialogue automatically, or create an attribute which exposes the node to the 'Create New Node' dialogue and optionally give it an icon.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Let's say we have this oversimplified C# class:
If we were to go for the first solution, it would already work like this (this is a mockup):
If we went for the second solution, I would suggest adding this Attribute:
[ExposeAsNode(string iconPath = null)]
. Having this attribute on the class will expose it in the dialogue. The optional parameter is for the icon. If it's left as null, it will inherit the icon from the super class. If the path is specified, it will use that.So now, the class would look like this if we want it exposed and with a custom icon:
which would result in this (this is a mockup):
I'm open for suggestions on how to improve this.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, since it's not code related. However, it can be worked around by creating the base node and adding the script manually, which is tedious because you have to do the additional step of looking up the script in the file system and dragging it onto the new node.
Is there a reason why this should be core and not an add-on in the asset library?
C# support is still in its early stages, and this for consistency between GDScript and C#. It can probably be worked around with an editor plugin that registers a custom type, but that has been made obsolete by the superior
class_name
(at least that's what I think. Research has shown contradicting results about custom types in editor plugins being obsolete).The text was updated successfully, but these errors were encountered: