Hello all,
I am loading a full scene, and then would like to deactivate all the prims not touching some region of interest. The PointInstancers dont immediately play nice with this, but there is a workaround for this. However, I now find that the scope holding the pointinstancer does not include the bounding box of the point instancer, so it gets deactivated, taking the instancer down with it.
I have extends hints on both the scope and the pointinstancer ( and the use extends hint set on the bbox cache), but still the scope fails the test. Does anyone have any advice on how to do this properly?
Thanks,
Koen
for prim in stage.TraverseAll():
if UsdGeom.PointInstancer(prim):
time = Usd.TimeCode.Default()
xformable = UsdGeom.Xformable(prim)
xform = xformable.ComputeLocalToWorldTransform(time)
bounds = UsdGeom.PointInstancer(prim).ComputeExtentAtTime(time, time)
bounds = Gf.Range3d(Gf.Vec3d(xform.Transform(bounds[0])),
Gf.Vec3d(xform.Transform(bounds[1])))
if bounds.IntersectWith(roi).IsEmpty():
prim.SetActive(False)
else:
bounds = cache.ComputeWorldBound(prim)
bounds = bounds.ComputeAlignedRange()
if bounds.IntersectWith(roi).IsEmpty():
prim.SetActive(False)