|
Toast Engine
|


Classes | |
| struct | Field |
| One field value read from a prefab file. More... | |
| struct | Subgroup |
| A named sub-section of fields within a group. More... | |
| struct | Group |
| A named group of fields and optional subgroups. More... | |
| struct | LuaVarOverride |
| Inspector Lua script variable that differs from its declared default. More... | |
| struct | SignalConnection |
| struct | Signal |
| struct | BasicNode |
| One node entry in a prefab file. More... | |
Public Types | |
| enum class | Purpose : uint8_t { asset_definition , instance_copy , editor_snapshot } |
Public Member Functions | |
| Prefab (std::istream &file) | |
| Parses a prefab from a text (.tnode) stream. | |
| Prefab (std::span< const uint8_t > bytes) | |
| Parses a prefab from a binary (.tbnode) byte span. | |
| Prefab (const toast::Node &node, toast::UID self_uid=toast::UID(0), Purpose purpose=Purpose::asset_definition) | |
| Serializes a live node tree into a Prefab object. | |
| Prefab (const Prefab &other) | |
| Prefab (Prefab &&other) noexcept | |
| auto | operator= (const Prefab &other) -> Prefab & |
| auto | operator= (Prefab &&other) noexcept -> Prefab & |
| auto | type () const -> std::string_view override |
| auto | serialize (SaveMode mode) const -> std::vector< uint8_t > override |
| Convenience wrapper that delegates to toFile() or toBinary() based on mode. | |
| auto | toFile () const -> std::string |
| Serializes to the human-readable text format. | |
| auto | toBinary () const -> std::vector< uint8_t > |
| Serializes to the compact binary format. | |
| auto | validate () const -> bool |
| Checks structural invariants. | |
| Public Member Functions inherited from assets::Asset | |
| Asset (const Asset &)=delete | |
| auto | operator= (const Asset &) -> Asset &=delete |
| auto | refCount () const noexcept -> uint32_t |
Static Public Member Functions | |
| static auto | stringifyValue (toast::FieldType type, bool is_array, const std::any &value) -> std::string |
| Converts a reflected field value to its text representation. | |
| static auto | valueFromString (toast::FieldType type, bool is_array, std::string_view value) -> std::optional< std::any > |
| Parses a text value back into a typed std::any for a reflected field. | |
Public Attributes | |
| std::vector< Field > | global_fields |
| std::vector< BasicNode > | nodes |
Additional Inherited Members | |
| Protected Member Functions inherited from assets::Asset | |
| void | addRef () noexcept |
| void | release () noexcept |
| assets::Prefab::Prefab | ( | std::istream & | file | ) |
Parses a prefab from a text (.tnode) stream.
| file | Open input stream positioned at the start of the file |

| assets::Prefab::Prefab | ( | std::span< const uint8_t > | bytes | ) |
Parses a prefab from a binary (.tbnode) byte span.
| bytes | Raw file bytes; must start with the TNODE magic header |
|
explicit |
Serializes a live node tree into a Prefab object.
| node | The root node of the tree to serialize; all descendants are included |
| self_uid | UID of this prefab asset on disk; stored in m_self_uid to detect self-referencing loops during instantiation |
|
overridevirtual |
Convenience wrapper that delegates to toFile() or toBinary() based on mode.
| mode | SaveMode::editor produces text; SaveMode::game produces binary |
Implements assets::ISaveable.

|
static |
Converts a reflected field value to its text representation.
| type | Serialization kind of the value |
| is_array | True if value holds a std::vector of the field type |
| value | The value as returned by a FieldInfo getter |

| auto assets::Prefab::toBinary | ( | ) | const -> std::vector< uint8_t > |
Serializes to the compact binary format.

| auto assets::Prefab::toFile | ( | ) | const -> std::string |
Serializes to the human-readable text format.

|
inlinenodiscardoverridevirtual |
Implements assets::Asset.
| auto assets::Prefab::validate | ( | ) | const -> bool |
Checks structural invariants.

|
static |
Parses a text value back into a typed std::any for a reflected field.
| type | Serialization kind to parse as |
| is_array | True if value encodes a std::vector of the field type |
| value | The text encoding produced by stringifyValue() |
value could not be parsed 