Skip to content

Commit

Permalink
test for spawn_many failing where parent can't be set to assembly kind
Browse files Browse the repository at this point in the history
Signed-off-by: Christian López Barrón <chris.gfz@gmail.com>
  • Loading branch information
chrizzFTD committed Dec 29, 2024
1 parent 1be7836 commit 5f0862b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_cook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pxr import Usd, UsdGeom, Sdf, Ar, Tf

from grill import cook, names, tokens
from grill import cook, names, tokens, usd

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -173,10 +173,21 @@ def test_spawn_many(self):

id_fields = {tokens.ids.CGAsset.kingdom.name: "K"}
taxon = cook.define_taxon(stage, "Another", id_fields=id_fields)
parent, child = cook.create_many(taxon, ['A', 'B'])
cook.spawn_many(parent, child, ["b", "nested/c"], labels=["1", "2", "3"])
parent, child, third = cook.create_many(taxon, ['A', 'B', 'C'])
cook.spawn_many(parent, child, ["b01", "nested/b02"], labels=["1", "2", "3"])
self.assertEqual(len(parent.GetChildren()), 2)

geom = cook.fetch_stage(cook.UsdAsset.get_anonymous(part="Geom"))
geom.SetDefaultPrim(geom.DefinePrim(cook._UNIT_ORIGIN_PATH))
payload = Sdf.Payload(cook.asset_identifier(geom.GetRootLayer().identifier))

with cook.unit_context(child):
geom_root = stage.DefinePrim(child.GetPath().AppendChild("Geom"))
geom_root.GetPayloads().AddPayload(payload)
with usd.edit_context(payload, geom_root):
with self.assertRaisesRegex(RuntimeError, 'Could not set kind to "assembly"'):
cook.spawn_many(child, third, paths=[geom_root.GetPath().AppendChild(side) for side in ("L", "R")])

def test_inherited_and_specialized_contexts(self):
stage = cook.fetch_stage(self.root_asset)
id_fields = {tokens.ids.CGAsset.kingdom.name: "K"}
Expand Down

0 comments on commit 5f0862b

Please sign in to comment.