Search - User list
Full Version: Grafting Branches With Python?
Root » Solaris and Karma » Grafting Branches With Python?
Tim Crowson
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?
mtucker
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]
Tim Crowson
Thanks, Mark! That helps.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB