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

◆ save()

bool MayaFlux::IO::Detail::VDBArchive::save ( const std::string &  path,
uint32_t  compression,
int  level 
)

Write every added grid to one file.

Parameters
pathDestination, already resolved by the caller.
compressionCombination of VDBCompression flags.
levelDeflate level for the ZIP path, ignored otherwise.
Returns
False on failure; call last_error() for detail.

Definition at line 616 of file VDBArchive.cpp.

617{
618 if (m_state->grids.empty()) {
619 m_last_error = "no grids to save";
620 return false;
621 }
622
623 tvdb_file_t out;
624 std::memset(&out, 0, sizeof(out));
625 out.alloc = make_allocator();
626 out.num_grids = m_state->grids.size();
627 out.grids = m_state->grids.data();
628
629 tvdb_error_t err;
630 std::memset(&err, 0, sizeof(err));
631
632 const tvdb_status_t st = tvdb_file_save(
633 &out, path.c_str(), compression, level, /*use_mmap=*/0, &err);
634
635 if (st != TVDB_OK) {
636 m_last_error = std::string("save failed: ")
637 + (err.message[0] != '\0' ? err.message : "unknown");
638 return false;
639 }
640
641 return true;
642}
std::vector< float > * out
std::string m_last_error
Set from the const read-path accessors too.
std::unique_ptr< State > m_state

References m_last_error, m_state, and out.

Referenced by MayaFlux::IO::VDBWriter::write().

+ Here is the caller graph for this function: