PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.15k stars 1.22k forks source link

Instanceable class prims throw an exception using a BBoxCache to get their bbox #1564

Open marktucker opened 3 years ago

marktucker commented 3 years ago

Description of Issue

The bounding box cache behaves badly when asked to evaluate the bounding box of an instanceable class prim. this was originally reported on usd-interest here: https://groups.google.com/g/usd-interest/c/XoFy46r9XcU

Steps to Reproduce

  1. Extract the files from this archive: classprim.zip

  2. open classprim.usda in usdview, and turn on display of abstract prims, you can see it just contains a class prim with an xform and a mesh (/__class_torus/geom/mesh_0 is the full hierarchy). In the interpreter, running:

    usdviewApi.stage.GetPrimAtPath('/__class_torus').IsAbstract()
    >>> True
    usdviewApi.stage.GetPrimAtPath('/__class_torus/geom').IsAbstract()
    >>> True

    And if you click on the prims, the World Bounding box of the mesh is shown properly, but the bounding boxes of the ancestor prims are both invalid (because the bboxcache skips over abstract prims). This all makes sense.

  3. Now open classprim_instanceable.usda, which is exactly the same as classprim.usda, but /__class_torus is marked as instanceable. Now when you run those same python commands:

    usdviewApi.stage.GetPrimAtPath('/__class_torus').IsAbstract()
    >>> True
    usdviewApi.stage.GetPrimAtPath('/__class_torus/geom').IsAbstract()
    >>> False

    And if you inspect the bboxes, the geom and mesh_0 prims both give valid values, and /__class_torus throws a python exception: ErrorException: Error in 'pxrInternal_v0_20pxrReserved::UsdGeomBBoxCache::_ResolvePrim' at line 1359 in file F:\dev_tools\src\usd\usd-20.08\USD-py2.7\pxr\usd\usdGeom\bboxCache.cpp : 'Failed verification: ' childEntry ' -- Could not find prim </__Master_1/geom>in the bboxCache.'

Package Versions

USD 21.08

jilliene commented 3 years ago

Filed as internal issue #USD-6799