MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nexus::StateEncoder Class Reference

Serializes Fabric state to an EXR texture and JSON schema. More...

#include <Encoder.hpp>

+ Collaboration diagram for MayaFlux::Nexus::StateEncoder:

Public Member Functions

bool encode (const Fabric &fabric, const std::string &base_path)
 Encode the given Fabric to {base_path}.exr and {base_path}.json.
 
bool encode (const Tapestry &tapestry, const std::string &base_dir, nlohmann::json user_state={})
 Encode all Fabrics in tapestry to base_dir.
 
const std::string & last_error () const
 Last error message, empty if no error.
 
StateEncoder & operator= (const StateEncoder &)=delete
 
StateEncoder & operator= (StateEncoder &&)=default
 
 StateEncoder ()=default
 
 StateEncoder (const StateEncoder &)=delete
 
 StateEncoder (StateEncoder &&)=default
 
 ~StateEncoder ()=default
 

Private Member Functions

bool encode_fabric (const Fabric &fabric, const std::string &base_path, const std::unordered_set< const Expanse * > &tapestry_owned)
 

Static Private Member Functions

static State::WiringRecord build_wiring (const Fabric &fabric, uint32_t id)
 
template<typename Record >
static void fill_expanse (Record &record, const Expanse &expanse)
 

Private Attributes

std::string m_last_error
 

Detailed Description

Serializes Fabric state to an EXR texture and JSON schema.

Writes what the classes hold, in the order they are registered by id: Emitters, Sensors, Agents (including Locus and Presence), their wiring and sinks, and the Expanses of each Fabric (including Hull and Mantle). Output: {base}.exr RGBA32F, one column per entity, rows described in Schema.hpp. {base}.json Per-entity records and per-channel ranges for denormalization.

An entity without a position is written with its position absent. Optional fields (position, orientation, color, size) are omitted from the schema when unset. A callable that exists but has no name emits a warning. Live objects (buffers, windows, typed influences and perceptions, attachments, callables themselves) are never encoded, only their names and plain configuration.

Definition at line 25 of file Encoder.hpp.


The documentation for this class was generated from the following files: