Fix: USD: Correctly process point instancers using overs for the prototypes
The canonical way to define Point Instancers in USD is to use "overs" for the prototype instances[1]. However, our current support was coded and tested against setups using Scope prims to contain the prototypes instead. Both approaches are valid USD, but we need to support the canonical way which we so far did not; the overs were incorrectly excluded from processing. Original patch from Michael Kowalski [1] https://openusd.org/release/api/class_usd_geom_point_instancer.html#UsdGeomPointInstancer_protoProcessing Pull Request: https://projects.blender.org/blender/blender/pulls/140232
This commit is contained in:
committed by
Jesse Yurkovich
parent
633ca37641
commit
fe0aa375ac
@@ -907,19 +907,25 @@ void USDStageReader::collect_point_instancer_proto_paths(const pxr::UsdPrim &pri
|
||||
pxr::UsdPrimSiblingRange children = prim.GetFilteredChildren(filter_flags);
|
||||
|
||||
for (const auto &child_prim : children) {
|
||||
const pxr::UsdGeomImageable imageable = pxr::UsdGeomImageable(child_prim);
|
||||
if (!imageable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We should only traverse through a hierarchy, and any potential instancers, if they would be
|
||||
* included by our purpose and visibility checks, matching what is inside #collect_readers. */
|
||||
if (!include_by_purpose(imageable)) {
|
||||
continue;
|
||||
}
|
||||
/* Note we allow undefined prims in case prototypes are defined as overs.
|
||||
* If the prim is defined, we apply additional checks for inclusion. */
|
||||
if (child_prim.IsDefined()) {
|
||||
const pxr::UsdGeomImageable imageable = pxr::UsdGeomImageable(child_prim);
|
||||
if (!imageable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!include_by_visibility(imageable)) {
|
||||
continue;
|
||||
/* We should only traverse through a hierarchy, and any potential instancers, if they would
|
||||
* be included by our purpose and visibility checks, matching what is inside
|
||||
* #collect_readers. */
|
||||
if (!include_by_purpose(imageable)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!include_by_visibility(imageable)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (pxr::UsdGeomPointInstancer instancer = pxr::UsdGeomPointInstancer(child_prim)) {
|
||||
|
||||
Reference in New Issue
Block a user