Hey,
I’m currently looking to reparent prims on a specific SdfLayer and I understand the limitations of the SdfNamespaceEditing which does not correct the connections which may be on children of the reparented prims.
I wondered if there was any advice on fixing up the connections in an efficient manner. The naïve approach being to check all fields (for any local composition arc adjustments), attribute connections and relationships and retarget them individually. I’m somewhat hoping that I’m missing some API to assist in this.
The limitations being:
Note that Sdf does not track backpointers so it’s unable to fix up targets/connections to namespace edited objects. Clients must fix those to prevent them from falling off. In addition, this method will report failure if any relational attribute with a target to a namespace edited object is subsequently edited (in the same batch). Clients should perform edits on relational attributes first.
A quick simple example would be to reparent:
the following in an SdfLayer from “materials” to “other”, but retain the connections such that binding /root/other/metal
would continue to function.
Currently (as described) using the batch namespace editing via SdfLayer.Apply, the prims are reparented correctly, but the connections/composition arcs match the old paths.
def "root"
{
def Scope "materials"
{
def Material "metal"
{
token outputs:surface.connect = </root/materials/metal/UsdPreviewSurface.outputs:surface>
def Shader "UsdPreviewSurface"
{
uniform token info:id = "UsdPreviewSurface"
token outputs:surface
}
}
def "metal_rust" (
prepend specializes = </root/materials/metal>
)
{ ... }
}
}
Thanks!
James