You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm constructing scripts that creates different kinds of stages. But what I can get my head around is when saving out a stage vs saving layer.
Below is a script which is run twice. First iteration you only save the layer, the second time you export the layer. These yield two different results
import mayaUsd
import mayaUsd_createStageWithNewLayer
from pxr import Usd, Sdf, UsdGeom
#global values
for i in range(2):
index = i
name = f"test_asset_{i}"
savePath = f"/tmp/{name}.usda"
#step one, create the stage
stage_shape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()
stage = mayaUsd.ufe.getStage(stage_shape)
root_prim = Usd.ModelAPI(UsdGeom.Xform.Define(stage, f"/{name}"))
root_prim.SetKind(Kind.Tokens.component)
#step two, save the stage
rootLayer = stage.GetRootLayer()
rootLayer.identifier = savePath
rootLayer.Save()
if index:
rootLayer.Export(savePath)
I find it a bit odd that rootLayer.Export(savePath) would be the same as stage.Export(savePath). And also that rootLayer.Save() actually creates a SDF layer file and not a USD file. It's a bit confusing and I would appreciate if you guys could give me any pointers on which behaviour you recommend for saving out layers. Doing it manually in the layer editor always creates sdf files.
If I skip the rootLayer.Save() step it looks in the layer editor that the layer is not saved.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm constructing scripts that creates different kinds of stages. But what I can get my head around is when saving out a stage vs saving layer.
Below is a script which is run twice. First iteration you only save the layer, the second time you export the layer. These yield two different results
first usd
second usd
I find it a bit odd that
rootLayer.Export(savePath)
would be the same asstage.Export(savePath)
. And also thatrootLayer.Save()
actually creates a SDF layer file and not a USD file. It's a bit confusing and I would appreciate if you guys could give me any pointers on which behaviour you recommend for saving out layers. Doing it manually in the layer editor always creates sdf files.If I skip the
rootLayer.Save()
step it looks in the layer editor that the layer is not saved.I hope it make sense.
best regards
stefan
Beta Was this translation helpful? Give feedback.
All reactions