Converts reflected script fields between their in-memory representation and a string form. More...
#include <ScriptFieldSerializer.h>
Static Public Member Functions | |
| static std::string | Read (void *instance, const VariableData &member) |
| Reads a reflected field from a live script instance into a string. | |
| static void | Write (void *instance, const VariableData &member, const std::string &value) |
| Writes a string value into a reflected field of a live script instance. | |
Converts reflected script fields between their in-memory representation and a string form.
Used by ScriptRuntime to persist inspector-edited field values across hot-reloads and scene serialisation. The string encoding is intentionally simple: scalars use std::to_string / std::stof, vectors are comma-separated component lists (e.g. "1.0,2.0,3.0").
|
static |
Reads a reflected field from a live script instance into a string.
The field is located by applying member.Offset to the instance pointer. Unrecognised TypeCategory values produce an empty string.
| instance | Raw pointer to the script object (ScriptBase derived). |
| member | Reflection metadata describing the field's type and offset. |
|
static |
Writes a string value into a reflected field of a live script instance.
Parsing errors from std::stof / std::stoi are silently swallowed; the field is left unchanged if the conversion throws. Vec2 / Vec3 / Vec4 writes are skipped if the parsed component count is insufficient.
| instance | Raw pointer to the script object (ScriptBase derived). |
| member | Reflection metadata describing the field's type and offset. |
| value | String to parse and write into the field. |