Skip to content
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

[FEATURE] Support saving of lists and dicts in a formatted way, including other SavesProjectID or Asset instances #72

Open
rayzchen opened this issue Jun 3, 2023 · 1 comment
Assignees
Labels
OS: Any Occurs on any platform Topic: Module Bugs or enhancements to do with PyUnity code Type: Enhancement New feature or request
Projects
Milestone

Comments

@rayzchen
Copy link
Collaborator

rayzchen commented Jun 3, 2023

Is your feature request related to a problem? Please describe.
When saving a Scene, SavedAttributes can only be saved properly if they are one of the following types: str, int, float, SavesProjectID (including Asset), Vector, Quaternion, RGB, HSV. However, it is also useful to support saving lists or dicts of these types, which could even support nesting.

Describe the solution you'd like
Such a format would be similar to YAML, with a few differences: the list format would have a different prefix other than - , the dict keys would be any of the above types properly formatted (maybe apart from the floating-point classes since they would rarely match) and indents would be 4 spaces instead of 2.

Describe alternatives you've considered
Currently, the SavableStruct has a similar format but does not support nesting.

Additional context
This would make Button be able to save the kwargs argument in the Scene file.

@rayzchen rayzchen added Type: Enhancement New feature or request Topic: Module Bugs or enhancements to do with PyUnity code OS: Any Occurs on any platform labels Jun 3, 2023
@rayzchen rayzchen added this to the 0.9.0 milestone Jun 3, 2023
@rayzchen rayzchen self-assigned this Jun 3, 2023
@rayzchen
Copy link
Collaborator Author

Typechecking must be implemented somehow, which means the type given to SavedAttributes needs to be from typing.GenericAlias or something similar.

Undecided if recursive structures should be allowed.

The existing SavableStruct class decorator has promising code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: Any Occurs on any platform Topic: Module Bugs or enhancements to do with PyUnity code Type: Enhancement New feature or request
Projects
No open projects
PyUnity
Awaiting triage
Development

No branches or pull requests

1 participant