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

◆ save_mesh() [2/5]

MAYAFLUX_API 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 157 of file ModelExport.cpp.

161{
162 if (!buffer) {
163 MF_ERROR(Journal::Component::IO, Journal::Context::FileIO, "save_mesh: null buffer");
164 return false;
165 }
166
167 auto mesh_data = buffer->get_mesh_data();
168 if (buffer->has_diffuse_texture()) {
169 const auto image_path = pack_diffuse_texture(buffer->get_diffuse_texture(), filepath, "");
170 if (!image_path.empty()) {
171 ensure_submesh_region(mesh_data, "mesh");
172 mesh_data.submeshes->regions.front().set_attribute("diffuse_path", image_path);
173 }
174 }
175
176 return write_via_registry(filepath, { mesh_data }, options);
177}
#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: