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

◆ grid_metadata()

std::string MayaFlux::IO::Detail::VDBArchive::grid_metadata ( size_t index,
std::string_view key ) const
nodiscard

Look up a string-typed metadata entry on a grid.

Parameters
indexGrid index, less than read_grid_count().
keyMetadata key, such as "class" or "vector_type".
Returns
The value, or empty if absent, not a string, or index is out of range.

Definition at line 679 of file VDBArchive.cpp.

680{
681 if (!m_state->read_file_open || index >= m_state->read_file.num_grids) {
682 return {};
683 }
684
685 const tvdb_grid_t& grid = m_state->read_file.grids[index];
686
687 for (size_t i = 0; i < grid.metadata.count; ++i) {
688 const tvdb_meta_entry_t& entry = grid.metadata.entries[i];
689 if (!entry.name || key != entry.name) {
690 continue;
691 }
692 if (entry.value.type != TVDB_VALUE_STRING || !entry.value.u.s.str) {
693 return {};
694 }
695 return { entry.value.u.s.str, entry.value.u.s.len };
696 }
697 return {};
698}
std::unique_ptr< State > m_state

References m_state.