ErnSur / UI-Toolkit-Plus

Boilerplate Code Generation, Tabs, Reorderable Manipulator, Built-in USS Exporter
MIT License
182 stars 8 forks source link

Generating C# script from UXML #4

Closed ErnSur closed 1 year ago

ErnSur commented 1 year ago

TODO:

ErnSur commented 1 year ago

Should we add an option to format field names to your liking? Like adding a prefix to generated field names.

added code gen settings in a form of new UXML root tag attributes. code-gen-prefix="_" attribute can be added to UXML root tag.

ErnSur commented 1 year ago

should the generated cs file always be in the same dir as UXML or should the user be able to relocate generated script? if so how to ensure that the regenerated script overrides the old one? if we want to allow relocation of this file we need to track it somehow for the autogeneration feature.

For now, the generated cs file will stay in the same directory as the UXML file. This solution is the easiest to maintain and for now, I don't see any problems with that. If the user wants generated cs file to belong to a certain assembly he can use assembly definition and assembly definition reference assets.

ErnSur commented 1 year ago

Option to Toggle automatic generation for a UXML file save toggle value to AssetImporter.userdata?

To use this feature user needs to manually trigger cs generation from the context menu button of VisualTreeAsset. Then each time this UXML changes the cs file will be regenerated automatically.

ErnSur commented 1 year ago

All that is left to do: