Copy a prim to a new stage problem.

   227   0   1
User Avatar
Member
3 posts
Joined: May 2020
Offline
Hi,
I have a problem with a python script and a stage. I have a valid stage loaded which contains a prim /geo/somegeo/mesh and a material scope at /mtl. Now I want to copy the /mtl prim to another stage. Usually this works like this:

mtlPath ="/mtl"
overStage = Usd.Stage.CreateInMemory()    
Sdf.CopySpec(stage.GetRootLayer(), mtlPath, overStage.GetRootLayer(), mtlPath)

This works fine if I read my stage from disk.
If I read the stage through a sublayer node in Houdini solaris and read the stage via a hou.node(...).stage(), the stage.GetRootLayer() method returns not an invalid layer. However, traversing the stage is not a problem and I see the material scope. But the GetRootLayer() does not contain the '/mtl' scope any more. The copySpec() says it cannot copy an invalid prim. I'd appreciate any hints. It seems I'm still missing a lot of the layer basics in USD and I'd appreciate any hints.

Thanks.
Edited by houdiniUsers - Aug. 6, 2025 10:56:01
  • Quick Links