MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::IO::SpatialCache Class Reference

Alembic-backed writer for time-sampled spatial entity state: particle systems, point clouds, inferred topology, and any other positions-plus-named-attributes-over-time source. More...

#include <SpatialCache.hpp>

+ Collaboration diagram for MayaFlux::IO::SpatialCache:

Classes

struct  Impl
 

Public Member Functions

void close ()
 Finalize and close the archive.
 
std::string get_last_error () const
 
bool open (const std::string &filepath)
 Open an Alembic archive for writing, Ogawa backend.
 
SpatialCacheoperator= (const SpatialCache &)=delete
 
SpatialCacheoperator= (SpatialCache &&) noexcept
 
 SpatialCache ()
 
 SpatialCache (const SpatialCache &)=delete
 
 SpatialCache (SpatialCache &&) noexcept
 
bool write (const std::string &stream_name, const SpatialSample &sample)
 Append one sample to a named stream.
 
bool write_metadata (const std::string &stream_name, const std::unordered_map< std::string, std::string > &tags)
 Queue object-level metadata tags for a named stream.
 
 ~SpatialCache ()
 

Private Member Functions

void set_error (std::string msg) const
 
bool write_curves_sample (const std::string &stream_name, const SpatialSample &sample)
 
bool write_vertex_sample (const std::string &stream_name, const SpatialSample &sample)
 

Private Attributes

std::unique_ptr< Implm_impl
 
std::string m_last_error
 

Detailed Description

Alembic-backed writer for time-sampled spatial entity state: particle systems, point clouds, inferred topology, and any other positions-plus-named-attributes-over-time source.

Named after what it does, not the backend library or one data shape: this is a cache of spatial state over time, not "the Alembic class." Alembic is an implementation detail hidden behind Impl, the same convention ModelReader uses to keep Assimp headers out of its own public interface.

Deliberately not registry-dispatched like ModelWriter/VolumeWriter: those registries exist because several backend libraries could plausibly implement the same format-agnostic contract. No second library writes .abc files, so a registry here would be indirection with nothing to dispatch between.

Each named stream keeps its own Alembic sample count: calling write() for a given stream_name appends one sample to that stream's own timeline. There is no separate "advance time" step; Alembic's own OTypedSchema::set() is what appends, and calling it once per capture tick per stream already produces the sequence. Streams written at different cadences (e.g. particles every frame, bonds only when they change) simply end up with different sample counts on their own timelines, which Alembic permits.

Object-level metadata (write_metadata) is Alembic MetaData, fixed at the point a stream's underlying object is first created and not retroactively settable by Alembic's own API. Call write_metadata for a stream_name before its first write() call for the tags to take effect; calling it after is logged and ignored.

Usage:

cache.open("swarm.abc");
cache.write_metadata("particles", { { "operator", "PhysicsOperator" } });
cache.write("particles", {
.positions = positions,
.ids = ids,
.attributes = attributes,
});
// ... one write() call per capture tick ...
cache.close();
bool write_metadata(const std::string &stream_name, const std::unordered_map< std::string, std::string > &tags)
Queue object-level metadata tags for a named stream.
bool open(const std::string &filepath)
Open an Alembic archive for writing, Ogawa backend.
bool write(const std::string &stream_name, const SpatialSample &sample)
Append one sample to a named stream.
void close()
Finalize and close the archive.
Alembic-backed writer for time-sampled spatial entity state: particle systems, point clouds,...

Definition at line 126 of file SpatialCache.hpp.


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