-
-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Describe the project you are working on
A platformer with some custom Resources.
Describe the problem or limitation you are having in your project
I have several fields I would like to export without the storage usage flag. The Export attribute has hint and hintString exposed, but not usage.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It would be nice to have usage as a field, even if it isn't in the constructor. If it were there, I could extend the attribute to make attributes like a [ExportNoStorage] or [EditorOnly] or something. The property list aggregation glue could then use the usage field to build the PropertyInfo dictionaries.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
As stated above, it doen't necessarily need to be added to the constructor. A bare minimum version would be:
public class ExportAttribute : Attribute
{
private PropertyHint hint;
private string hintString;
private PropertyUsageFlags usage = PropertyUsageFlags.Default; // < Add this!
...
}As for where this field would be parsed out, looks like the code in question can be found here:
https://github.com/godotengine/godot/blob/4fcc5891450a7dca9c8ebae6ff3765f5f060c442/modules/mono/csharp_script.cpp#L2734-L2769
and would involve grabbing the attributes value, ensuring the usual bits like PROPERTY_USAGE_SCRIPT_VARIABLE, then setting it on line 2768.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes. A workaround is to override the _GetPropertyList function and export stuff the long way.
Is there a reason why this should be core and not an add-on in the asset library?
It would involve changing the csharp_script.cpp core file.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status