-
-
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
Allow resources without class_name to be created in the EditorResourcePicker #8102
Comments
What's the problem with naming the class? Pollution aside this would make things more complicated code side I'd say, and it works against how the system is designed |
Naming the class isn't a huge problem or anything, but it does make things less sharable. I'll give the context of my project as an example The plugin I'm working on is a custom stylebox that accepts a list of resources to change its properties via code. This is specifically to tackle the pain point of getting things like the 'accent_color' and 'base_color' from editor settings. Ideally someone would only have to share the theme.tres file to get the same theme, so it would be beneficial to have everything built in and anonymous, in case there is some naming clash Again not a huge deal, but I think it should be possible at least |
Built in scripts wouldn't work with this, they're limited and adding support for them would be a lot more work |
You can create empty Resource and attach script. |
Ok so my main issue was that I thought built in resources was not possible without class_name, but I just realized that clicking "make unique" literally just makes a resource, even scripts, built in. So I can work with that |
I think adding namespaces would be the ideal solution here as far as I'm concerned (namespace proposal) since I also would be for adding a "Load Script" option into the inspector's resource picker and the create resource dialog to facilitate creating new anonymous resources, but I think with namespaces there wouldn't be much incentive to have anonymous resources in the first place. Something related to this though that I think is a bug is that resources with anonymous scripts (existing |
It seems not possible to attach a resource to a node using the editor (drag-n-drop or EditorResourcePicker). extends Resource
@export var name : String
@export var production_time : int extends Node
const Recipe = preload("res://recipe.gd")
@export var selected_recipe : Recipe Via scripting, it works. There are any workarounds to this issue (if I do not want to use the class_name)? |
Ii you export |
Yeah, I see. It misses the point of exporting the variable for me since it could lead to the wrong resource type being attached to the node or more code to type check. Class names still are not an option for me without namespaces. Thanks for the clarification. |
Describe the project you are working on
Editor plugins
Describe the problem or limitation you are having in your project
When exporting a resource, you get an EditorResourcePicker in the inspector. It shows a list of extended resources which can be created, but only ones that have an explicit class_name. Subsequently it seems like you can't have built-in anonymouse resources at all, since to create that resource you'd have to make a new file and drag that in
I'd like anonymouse resource classes so that it doesn't pollute the list of class names
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allow anonymous resource classes to be created in the resource picker. This would enable anonymouse resources to be built in and not pollute the class list namespace or the filesystem
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I have 2 suggestions
Include anonymous resource classes in the ResourcePicker list. Their 'name' would be the script's resource_path. Since that could be really long and ugly, make a submenu for anonymous resources under "more ->"
Allow dragging and dropping a script into the resoruce picker, and if it inherits the proper resource, create a built in instance (a new resource with that script attatched). Of course, since scripts are also resources, ignore this feature when the resource picker expects a script
If this enhancement will not be used often, can it be worked around with a few lines of script?
Possibly? But it would be very hacky and not easy
Is there a reason why this should be core and not an add-on in the asset library?
EditorResourcePicker is core
The text was updated successfully, but these errors were encountered: