Repository navigation
Conversation
6ee2611 to
2c91cd7
Compare
7e3b5a9 to
ee8fdae
Compare
| return scenePaths; | ||
| } | ||
|
|
||
| /* Collects the rprims a point instancer draws, so a single point instance can |
There was a problem hiding this comment.
Is this strictly for point instancers or also scene graph instancing? I thought through hydra it was one and the same
|
|
||
| // A top-level UsdGeomPointInstancer keeps its scene path through the | ||
| // propagating scene indices, so the USD path doubles as its chain path and | ||
| // the chain draws it as an instancer. One the chain does not draw as an |
There was a problem hiding this comment.
YOu use ""chain path" in many comment, to be sure, that's essentially the usd path prefixed with the scene index root thing?
| // prototype, or above the proxy's primPath - is left to AddSelection. | ||
| const HdSceneIndexPrim prim = _selectionSceneIndex->GetPrim(instancer); | ||
| const HdPathArrayDataSourceHandle prototypes | ||
| = HdInstancerTopologySchema::GetFromParent(prim.dataSource).GetPrototypes(); |
There was a problem hiding this comment.
I wonder if GetPrototype is always fast? Sometimes some hydra getters ar not that fast if they resolve stuff, because you could skip it if rim.primType != HdPrimTypeTokens->instancer
|
|
||
| const auto first = [](const HdPathArrayDataSourceHandle& paths) -> SdfPath { | ||
| if (paths) { | ||
| const VtArray<SdfPath> values = paths->GetTypedValue(0.0f); |
| }; | ||
|
|
||
| _PointInstanceRprims& rprims = cached->second.emplace(); | ||
| const VtArray<SdfPath> instancerRoots = prototypes->GetTypedValue(0.0f); |
There was a problem hiding this comment.
Is it a timecode? If so maybe query at the detalut timecode to be explicit
UsdImagingSelectionSceneIndex::AddSelection takes only a path, so picking one point instance highlighted the whole instancer. For a point instancer the chain draws as an instancer, PopulateSelection now collects the rprims it draws, including those instanced again by native instances or nested point instancers in its prototypes, and maps the picked instance index to instance ids through HdInstancerTopologySchema::ComputeInstanceIndicesForProto. The results are cached per selection pass. Add HdVP2UsdProducer::ClearSelection, which ProxyRenderDelegate calls before rebuilding the selection (a no-op for the UsdImagingDelegate producer).
ee8fdae to
b3c8897
Compare
| auto [ids, inserted] = _instanceIds.try_emplace(prototypeRoot); | ||
| if (inserted) { | ||
| // Not const: ComputeInstanceIndicesForProto is non-const before USD | ||
| // 26.08. Make this const once the minimum reaches 26.08. |
There was a problem hiding this comment.
maybe add a TODO so it can be found easily
| = _InstanceIds(usdPath, rprim.prototypeRoot); | ||
| const auto id = ids.find(instanceIndex); | ||
| if (id == ids.end()) { | ||
| // This prototype does not instantiate the picked index. |
There was a problem hiding this comment.
This is an error scenario?
Description
Highlight single point instances with the VP2 scene index.
With the scene index flag on, picking one point instance highlighted the whole point instancer. Selection goes through
UsdImagingSelectionSceneIndex, and itsAddSelectiontakes only a path, so the picked instance index was lost. This PR fills that in inside the producer, so only the picked instance is highlighted, as on the legacy path.Highlights
PopulateSelectionnow:HdInstancerTopologySchema::ComputeInstanceIndicesForProto.HdVP2UsdProducer::ClearSelection, whichProxyRenderDelegatecalls before it rebuilds the selection. It does nothing for the Hydra 1.0 producer.Tests
Three new cases in
testVP2RenderDelegatePointInstanceSelection. Each picks instance 1 and compares the viewport snapshot against a simpler scene that draws the same thing. The cases cover: