-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 strong access to each loaded resource #12
Comments
The generated file looks like this:
where I can easily access each item from anywhere using e.g. |
Actually, when I started making this library, this was the original thing I wanted to build - a code generator. However, I was not able to come up with an output that would have been universally useful. Some projects would benefit from a list of variables like you have suggested, others would probably benefit more from a database-like structure, where you can ask things like "give me a random fruit" or "give me all tools sorted by price", yet others would like to have a dictionary of enemies grouped by element type or cards grouped into decks or upgrade levels, etc, etc. So whatever output I decided for, would work only for some games and at the same time would not work for a substantial amount of other games. Another problem with a code generator is that this introduces a good amount of edge cases where variable or function names clash with other data or Godot's built-in functions (e.g. if for some reason you name an item But if you have some ideas on how to generate a universally useful output and handle the other problems I mentioned, I'd very much like to know about it! |
I think individual references to each resource is almost universally useful (and in the rare cases it isn't you can just not opt in). Regarding the Amending my earlier suggestion, export an optional string name for the I'm guessing this would cover 90+% of the use cases for your tool, which I understand to be not having to preload each resources by hand, which I'm presently still needing to do in order to reference them individually. If people want different/more functionality they can create their own tool script (or maybe have your generator only write its own part of the script between two comment lines and let people add additional code (if you do this then maybe drop the |
Thanks for taking the time to write this up. I think if it's optional and configurable to some extent it could indeed be a good 80/20 solution. I'll have a deeper look at it, but it will be a few days as I'm currently fully engaged in another thing that needs doing :-). |
I wrote the following code generation tool using your library:
where
res://data/items.tres
is a ResourceGroup. It's been very helpful for referencing specific resources by (in this case) theirid
field. I was wondering if you might incorporate this into your library, perhaps have eachResourceGroup
export at least a file path, which, if set, would make the resource group generate a file similar to the one above, where the details (class_name, the field that becomes the var names, etc..) could be additional exports.The text was updated successfully, but these errors were encountered: