MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ save_mesh() [2/5]

bool MayaFlux::IO::save_mesh ( const std::shared_ptr< Buffers::MeshBuffer > &  buffer,
const std::string &  filepath,
const ModelWriteOptions options = {} 
)

Save a MeshBuffer's current mesh data to disk via ModelWriterRegistry.

Synchronous: MeshData is always CPU-authoritative for MeshBuffer (every mutation path writes the CPU copy first, GPU is upload-only), so there is no GPU download step here, unlike save_image/save_volume.

Parameters
bufferSource mesh.
filepathDestination path with extension; selects the writer via ModelWriterRegistry.
optionsFormat-specific writer options.
Returns
True on success. Failure is logged.

Definition at line 168 of file ModelExport.cpp.

172{
173 if (!buffer) {
174 MF_ERROR(Journal::Component::IO, Journal::Context::FileIO, "save_mesh: null buffer");
175 return false;
176 }
177
178 auto mesh_data = buffer->get_mesh_data();
179 if (buffer->has_diffuse_texture()) {
180 const auto image_path = pack_diffuse_texture(buffer->get_diffuse_texture(), filepath, "");
181 if (!image_path.empty()) {
182 ensure_submesh_region(mesh_data, "mesh");
183 mesh_data.submeshes->regions.front().set_attribute("diffuse_path", image_path);
184 }
185 }
186
187 return write_via_registry(filepath, { mesh_data }, options);
188}
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer

References buffer, MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, and MF_ERROR.

Referenced by MayaFlux::IO::IOManager::save_mesh(), MayaFlux::IO::IOManager::save_mesh(), MayaFlux::IO::IOManager::save_mesh(), save_mesh_snapshot(), save_mesh_snapshot(), save_mesh_snapshot(), save_mesh_snapshot(), and save_mesh_snapshot().

+ Here is the caller graph for this function: