Hi,
In our render delegate we have custom prim types with custom adapters that we want to port to hydra 2/scene index. I am not sure I understand correctly how the invalidation mechanism should work in that case.
Here is what I understand so far:
- When a usd parameter is modified, there is a call to the function InvalidateImagingSubprim of its prim’s adapter. This function returns the hydra prim locator to invalidate knowing the modified usd parameter.
USD parameter change → Hydra locator to invalidate
- Then the locators to invalidate are broadcasted via the SendPrimsDirtied callbacks and end up in the function which converts back the locators to a “dirtyBits” representation ,HdSceneIndexAdapterSceneDelegate::PrimsDirtied()
USD parameter change → Hydra locator to invalidate → Compute dirtyBits representation
- Once and if a dirtyBit is found, the Rprim is marked dirty using the _MarkRprimDirty(dirtyBits) function.
USD parameter change → Hydra locator to invalidate → Compute dirtyBit representation → _MarkRprimDirty(dirtybit)
- The dirtied Rprims are finally Synced with the found dirtyBits
USD parameter change → Hydra locator to invalidate → Compute dirtyBit representation → _MarkRprimDirty(dirtybit) → Sync dirty Rprims
Unfortunately the translation from the locators to the dirtyBit representation is harcoded: the function HdDirtyBitsTranslator::RprimLocatorSetToDirtyBits translates for only some known types and known locators, and it seems impossible to add a new custom prim type or custom locators.
What would be correct solution to convert custom prim types locators to dirtybits ?
I am thinking that may be adding an observer could work, would that be a solution that follows the design ? Or should we add a special case for the custom prims in HdDirtyBitsTranslator::RprimLocatorSetToDirtyBits ? like in SprimLocatorSetToDirtyBits which allows adding dynamic conversion function.
Thanks for any help,