Grafting Branches With Python?

   2411   2   2
User Avatar
Member
250 posts
Joined: Oct. 2014
Offline
If I wanted to perform a 'graft branches' operation, but using Python, would I need to do that from scratch using the pxr api? I don't suppose I could get some insight on how the GraftBranches LOP is operating under the hood?
Edited by Tim Crowson - March 18, 2021 13:45:10
- Tim Crowson
Technical/CG Supervisor
User Avatar
Staff
4560 posts
Joined: July 2005
Offline
The approximate description is that it takes the secondary input's stage, flattens the layer stack (not flattening the whole stage, just the layer stack). This gives you one SdfLayer that is equivalent to the source stage, but with references and payloads preserved as composition arcs. Then SdfCopySpec is used to copy the SdfLayer data from the branch source into the destination stage.

There are lots of details about handling requests to graft in prims that don't exist in the source layer (because the requested prim only exists inside a reference/payload), or when the material is outside the source prim, or there is a transform on an ancestor of the source prim... Most of the details of this stuff can be seen here: https://github.com/sideeffects/HoudiniUsdBridge/blob/master/src/houdini/lib/H_USD/HUSD/HUSD_MergeInto.C [github.com]
User Avatar
Member
250 posts
Joined: Oct. 2014
Offline
Thanks, Mark! That helps.
- Tim Crowson
Technical/CG Supervisor
  • Quick Links