|
4 | 4 | import math |
5 | 5 | import unittest |
6 | 6 |
|
7 | | -from pxr import Plug, Sdf, Usd |
| 7 | +from pxr import Plug, Sdf, Usd, UsdGeom |
8 | 8 |
|
9 | 9 | import newton_usd_schemas # noqa: F401 |
10 | 10 |
|
@@ -35,6 +35,27 @@ def test_targets_relationship(self): |
35 | 35 | self.assertEqual(len(targets), 1) |
36 | 36 | self.assertEqual(str(targets[0]), "/World/Joint") |
37 | 37 |
|
| 38 | + def test_not_imageable(self): |
| 39 | + # Actuators carry a control law bound to a joint; they have no extent and are |
| 40 | + # never rendered, so they derive from UsdTyped rather than UsdGeomImageable. |
| 41 | + self.assertFalse(self.prim.IsA(UsdGeom.Imageable)) |
| 42 | + |
| 43 | + # The prim definition must not advertise Imageable properties it does not have. |
| 44 | + definition = Usd.SchemaRegistry().FindConcretePrimDefinition("NewtonActuator") |
| 45 | + self.assertIsNotNone(definition) |
| 46 | + self.assertEqual(sorted(definition.GetPropertyNames()), ["newton:targets"]) |
| 47 | + |
| 48 | + def test_bbox_cache_skips_actuator(self): |
| 49 | + # Regression test: when NewtonActuator declared UsdGeomImageable as its base |
| 50 | + # without baking in the inherited visibility/purpose/proxyPrim properties, |
| 51 | + # UsdGeom.BBoxCache treated the prim as Imageable and then failed to read its |
| 52 | + # visibility attribute, raising from _GetOrCreateVisibilityQuery. |
| 53 | + root = self.stage.DefinePrim("/World", "Xform") |
| 54 | + self.stage.DefinePrim("/World/Actuator", "NewtonActuator") |
| 55 | + cache = UsdGeom.BBoxCache(Usd.TimeCode.Default(), [UsdGeom.Tokens.default_]) |
| 56 | + bound = cache.ComputeWorldBound(root) |
| 57 | + self.assertTrue(bound.GetRange().IsEmpty()) |
| 58 | + |
38 | 59 |
|
39 | 60 | class TestNewtonActuatorDelayAPI(unittest.TestCase): |
40 | 61 | def setUp(self): |
|
0 commit comments