@@ -193,23 +193,29 @@ namespace Zibra::ZibraVDBDecompressor
193193
194194 void SOP_ZibraVDBDecompressor::ApplyGridAttributeMetadata (GU_PrimVDB* vdbPrim, FrameHandle* const frameContainer)
195195 {
196- const std::string attributeMetadataName = " houdiniPrimitiveAttributes_" s + vdbPrim->getGridName ();
196+ {
197+ const std::string attributeMetadataNameV2 = " houdiniPrimitiveAttributesV2_" s + vdbPrim->getGridName ();
198+
199+ const char * metadataEntryV2 = frameContainer->GetMetadataByKey (attributeMetadataNameV2.c_str ());
197200
198- const char * metadataEntry = frameContainer->GetMetadataByKey (attributeMetadataName.c_str ());
201+ if (metadataEntryV2)
202+ {
203+ auto primAttribMeta = nlohmann::json::parse (metadataEntryV2);
204+ Utils::LoadAttributesV2 (gdp, GA_ATTRIB_PRIMITIVE, vdbPrim->getMapOffset (), primAttribMeta);
205+ return ;
206+ }
207+ }
199208
200- if (metadataEntry)
201209 {
202- auto primAttribMeta = nlohmann::json::parse (metadataEntry);
203- switch (Utils::LoadEntityAttributesFromMeta (gdp, GA_ATTRIB_PRIMITIVE, vdbPrim->getMapOffset (), primAttribMeta))
210+ const std::string attributeMetadataNameV1 = " houdiniPrimitiveAttributes_" s + vdbPrim->getGridName ();
211+
212+ const char * metadataEntryV1 = frameContainer->GetMetadataByKey (attributeMetadataNameV1.c_str ());
213+
214+ if (metadataEntryV1)
204215 {
205- case Utils::MetaAttributesLoadStatus::SUCCESS:
206- break ;
207- case Utils::MetaAttributesLoadStatus::FATAL_ERROR_INVALID_METADATA:
208- addWarning (SOP_MESSAGE, " Corrupted metadata for channel. Canceling attributes transfer." );
209- break ;
210- case Utils::MetaAttributesLoadStatus::ERROR_PARTIALLY_INVALID_METADATA:
211- addWarning (SOP_MESSAGE, " Partially corrupted metadata for channel. Skipping invalid attributes." );
212- break ;
216+ auto primAttribMeta = nlohmann::json::parse (metadataEntryV1);
217+ Utils::LoadAttributesV1 (gdp, GA_ATTRIB_PRIMITIVE, vdbPrim->getMapOffset (), primAttribMeta);
218+ return ;
213219 }
214220 }
215221 }
@@ -243,24 +249,26 @@ namespace Zibra::ZibraVDBDecompressor
243249
244250 void SOP_ZibraVDBDecompressor::ApplyDetailMetadata (GU_Detail* gdp, FrameHandle* const frameContainer)
245251 {
246- const char * detailMetadata = frameContainer->GetMetadataByKey (" houdiniDetailAttributes" );
247-
248- if (!detailMetadata)
249252 {
250- return ;
253+ const char * detailMetadataV2 = frameContainer->GetMetadataByKey (" houdiniDetailAttributesV2" );
254+
255+ if (detailMetadataV2)
256+ {
257+ auto detailAttribMeta = nlohmann::json::parse (detailMetadataV2);
258+ Utils::LoadAttributesV2 (gdp, GA_ATTRIB_DETAIL, 0 , detailAttribMeta);
259+ return ;
260+ }
251261 }
252262
253- auto detailAttribMeta = nlohmann::json::parse (detailMetadata);
254- switch (Utils::LoadEntityAttributesFromMeta (gdp, GA_ATTRIB_DETAIL, 0 , detailAttribMeta))
255263 {
256- case Utils::MetaAttributesLoadStatus::SUCCESS:
257- break ;
258- case Utils::MetaAttributesLoadStatus::FATAL_ERROR_INVALID_METADATA:
259- addWarning (SOP_MESSAGE, " Corrupted metadata for channel. Canceling attributes transfer. " );
260- break ;
261- case Utils::MetaAttributesLoadStatus::ERROR_PARTIALLY_INVALID_METADATA:
262- addWarning (SOP_MESSAGE, " Partially corrupted metadata for channel. Skipping invalid attributes. " ) ;
263- break ;
264+ const char * detailMetadataV1 = frameContainer-> GetMetadataByKey ( " houdiniDetailAttributes " );
265+
266+ if (detailMetadataV1)
267+ {
268+ auto detailAttribMeta = nlohmann::json::parse (detailMetadataV1) ;
269+ Utils::LoadAttributesV1 (gdp, GA_ATTRIB_DETAIL, 0 , detailAttribMeta);
270+ return ;
271+ }
264272 }
265273 }
266274
0 commit comments