MayaFlux 0.5.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

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 713 of file VDBArchive.cpp.

714{
715 if (!m_state->read_file_open || index >= m_state->read_file.num_grids) {
716 return {};
717 }
718
719 const tvdb_grid_t& grid = m_state->read_file.grids[index];
720
721 for (size_t i = 0; i < grid.metadata.count; ++i) {
722 const tvdb_meta_entry_t& entry = grid.metadata.entries[i];
723 if (!entry.name || key != entry.name) {
724 continue;
725 }
726 if (entry.value.type != TVDB_VALUE_STRING || !entry.value.u.s.str) {
727 return {};
728 }
729 return { entry.value.u.s.str, entry.value.u.s.len };
730 }
731 return {};
732}
uint32_t index
Definition VKDevice.cpp:142
std::unique_ptr< State > m_state

References index, and m_state.