A reflected struct to JSON and back, field by field, by its VKM_REFLECT names.
More...
|
| std::string | childPath (const char *parent, const std::string &step) |
| | Where step stands below parent, the steps joined by dots: "levels.2.mesh".
|
|
template<typename V, typename Ctx> |
| nlohmann::json | valueToJson (const V &val, const Ctx &ctx) |
| | One value to JSON, whatever kind of value it is: a handle its name, a vector an array, a reflected struct an object, anything else a leaf.
|
| template<typename V, typename Ctx> |
| void | valueFromJson (const nlohmann::json &j, V &val, const Ctx &ctx, const char *field) |
| | The same in the other direction.
|
| template<typename T> |
| nlohmann::json | toJson (const T &obj) |
| | A reflected struct of plain data as a JSON object, a key a field.
|
| template<typename T> |
| void | fromJson (const nlohmann::json &j, T &obj) |
| | The fields j has written into obj; any it lacks, or holds wrongly, kept.
|
A reflected struct to JSON and back, field by field, by its VKM_REFLECT names.
What the scene file is written with, and what a project keeps its own files with - its settings, a save. Leaves, scoped enums by their VKM_ENUM_NAMES, nested reflected structs and vectors of any of them go through; a field missing from the JSON keeps its value, so a file written before a field was added still loads. The context decides the rest: a Handle needs one that turns it into its asset's name and back (ComponentSerializer's), and a field holding the wrong type of value is an error in a scene - the load reports it, naming where it stood - but in a project's own file keeps its value and warns (OwnFile, which toJson and fromJson use). A glm value of the wrong shape warns and keeps its own in either.