Project Raygine #4
Reworking the serialization system is making progress. Still not sure if this'll stay this way, but I like the direction it's going.
One fundamental design change is, that an asset object is now a collection of types. A type is a declaration of attributes that can be serialized and an asset contains any number of instances - which I call objects (yeah, not very creative). When deserializing the asset, the attributes in the type restore the values of the objects and additionally, a metatable can be assigned to the object. No more constructors or factories or so - just a metatable that is assigned to the table of the data.
Having a list of objects in an asset implicates a few things:
- Every object in an asset is like a subasset in Unity
- The asset itself deviates from scriptable objects in Unity in that it doesn't have a type. It's just a collection of types and objects.
- I haven't started on this task yet, but for reworking the scene, every entity in the scene will be an object in the scene asset. And also every component. This makes serialization of the scene a lot easier, because it's just a collection of objects.
- Another implication here is, that every object in the scene can be referred to from other assets. This will also work out of the box, since every object is an element of an asset and can be referenced by the asset's UID.
- I guess this will make reference searches quite convoluted, because of the amount of shown options. To sort this out, I would allow objects to be marked as "exposed". This allows to specifically mark objects that are to be referenced from other assets.
I still have a lot of work left to do on the subject - especially removing all the old stuff that is now obsolete. But I'm confident that this will be a good foundation for the future.
The way things get rendered in the inspector is also changing; There's now a type_gui registry where GUI logic can be registered for types. I want something similarly flexible as the property drawers in Unity, where the GUI can be customized for specific types inside specific types. With this, I am changing away from ImGui's default "label to the right" approach and am displaying the labels to the left, which I think is more readable and more "standard".
Here's how the project_settings are looking like now: