void UsdImagingGprimAdapter::UpdateForTimePrep(UsdPrim const& prim, SdfPath const& cachePath, UsdTimeCode time, int requestedBits, UsdImagingInstancerContext const* instancerContext) { UsdImagingValueCache* valueCache = _GetValueCache(); // Prepopulate cache entries to avoid mutation during multi-threaded data // fetch. if (requestedBits & HdChangeTracker::DirtyPrimVar) valueCache->GetColor(cachePath); if (requestedBits & HdChangeTracker::DirtyDoubleSided) valueCache->GetDoubleSided(cachePath); if (requestedBits & HdChangeTracker::DirtyTransform) valueCache->GetTransform(cachePath); if (requestedBits & HdChangeTracker::DirtyExtent) valueCache->GetExtent(cachePath); if (requestedBits & HdChangeTracker::DirtyVisibility) valueCache->GetVisible(cachePath); if (requestedBits & HdChangeTracker::DirtySurfaceShader) valueCache->GetSurfaceShader(cachePath); valueCache->GetPrimvars(cachePath); }
void UsdImagingGprimAdapter::TrackVariabilityPrep(UsdPrim const& prim, SdfPath const& cachePath, int requestedBits, UsdImagingInstancerContext const* instancerContext) { // Prepopulate cache entries to avoid mutation during multi-threaded data // fetch. UsdImagingValueCache* valueCache = _GetValueCache(); if (requestedBits & HdChangeTracker::DirtyVisibility) { valueCache->GetVisible(cachePath); valueCache->GetPurpose(cachePath); } if (requestedBits & HdChangeTracker::DirtyPrimVar) { valueCache->GetPrimvars(cachePath); } }
void UsdImagingGprimAdapter::TrackVariability(UsdPrim const& prim, SdfPath const& cachePath, int requestedBits, int* dirtyBits, UsdImagingInstancerContext const* instancerContext) { // WARNING: This method is executed from multiple threads, the value cache // has been carefully pre-populated to avoid mutating the underlying // container during update. // Why is this OK? // Either the value is unvarying, in which case the time ordinate doesn't // matter; or the value is varying, in which case we will update it upon // first call to Delegate::SetTime(). UsdTimeCode time(1.0); UsdImagingValueCache* valueCache = _GetValueCache(); if (requestedBits & HdChangeTracker::DirtyPrimVar) { if (not _IsVarying(prim, UsdGeomTokens->primvarsDisplayColor, HdChangeTracker::DirtyPrimVar, UsdImagingTokens->usdVaryingPrimVar, dirtyBits, false)) { // Only do this second check if the displayColor isn't already known // to be varying. _IsVarying(prim, UsdGeomTokens->primvarsDisplayOpacity, HdChangeTracker::DirtyPrimVar, UsdImagingTokens->usdVaryingPrimVar, dirtyBits, false); } } if (requestedBits & HdChangeTracker::DirtyExtent) { // Discover time-varying extent. _IsVarying(prim, UsdGeomTokens->extent, HdChangeTracker::DirtyExtent, UsdImagingTokens->usdVaryingExtent, dirtyBits, false); } if (requestedBits & HdChangeTracker::DirtyTransform) { // Discover time-varying transforms. _IsTransformVarying(prim, HdChangeTracker::DirtyTransform, UsdImagingTokens->usdVaryingXform, dirtyBits); } if (requestedBits & HdChangeTracker::DirtyVisibility) { valueCache->GetVisible(cachePath) = GetVisible(prim, time); // Discover time-varying visibility. _IsVarying(prim, UsdGeomTokens->visibility, HdChangeTracker::DirtyVisibility, UsdImagingTokens->usdVaryingVisibility, dirtyBits, true); TfToken purpose = _GetPurpose(prim, time); // Empty purpose means there is no opinion, fall back to geom. if (purpose.IsEmpty()) purpose = UsdGeomTokens->default_; valueCache->GetPurpose(cachePath) = purpose; } }