PixarAnimationStudios / OpenUSD

Universal Scene Description

Home Page:http://www.openusd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot `Sdf.CopySpec` relationship without targets to relationship with targets in crate layers

nvmkuruc opened this issue · comments

Description of Issue

When Sdf.CopySpec is run with the following conditions
a) on a crate layer
b) with a relationship without a target as a source
c) and a relationship with a target as the destination,

TF_VERIFY fails with the following error.

pxr.Tf.ErrorException:
        Error in 'pxrInternal_v0_24__pxrReserved__::_ProcessChildren' at line 153 in file copyUtils.cpp : 'Failed verification: ' oldDstChildrenValue.IsHolding<ChildrenVector>() ''

Change any of the above conditions (ie. use usda instead of usdc), and the Sdf.CopySpec will succeed.

@roggiezhang-nv traced this back to divergent behaviors for how targetChildren is handled in the crate vs. text file formats. The text file format returns a VtValue with a valid type that is non-empty. The crate file format returns an empty VtValue.

We'd recommend making the text file format and crate behave the same way, and we're happy to contribute a fix if that's the agreed upon best approach. An alternative fix we considered is whether or not Sdf.CopySpec should be more permissive and filter out empty VtValues, but that might be riskier.

Steps to Reproduce

  1. Create a file copyrel.usda with the following contents
def "target" {}

def "source" {
   rel myrel
}

def "dest" {
   rel myrel = </target>
}
  1. Run usdcat copyrel.usda -o copyrel.usdc
  2. Run the following python snippet
from pxr import Sdf

text = Sdf.Layer.FindOrOpen("./copyrel.usda")
Sdf.CopySpec(text, '/source', text, '/dest')

crate = Sdf.Layer.FindOrOpen("./copyrel.usdc")
Sdf.CopySpec(crate, '/source', crate, '/dest')

Note Sdf.CopySpec works for usda but not for usdc for the same content.

System Information (OS, Hardware)

Linux

Package Versions

24.05

Build Flags

Filed as internal issue #USD-9703