UsdRelationship with time samples causes Parsing Error

Hi,
Using OpenUSD 24.11, I found that the following usda cannot be parsed. I understand that UsdRelationships are always uniform, as such I suppose, having a single timestamp should be a correct input, however the following:

#usda 1.0

def "prim" (
)
{
    rel singleTimesampleWithDefault = </prim/child>
    rel singleTimesampleWithDefault.timeSamples = {
        1.0: </prim/child>
    }

    def "child" {
    }
}

with any number of timestamps (none, 1 or more than 1), leads to:

pxr.Tf.ErrorException: 
	Error in 'pxrInternal_v0_24_11__pxrReserved__::Sdf_TextFileFormatParser::_RaiseErrorPEGTL' at line 48 in file D:/a/OpenUSD/OpenUSD/pxr/usd/sdf/textParserHelpers.h : 'C:\sources\test-core\test.usda:7:37: parse error matching struct PXR_INTERNAL_NS_pegtl::sor<struct PXR_INTERNAL_NS_pegtl::if_must<struct pxrInternal_v0_24_11__pxrReserved__::Sdf_TextFileFormatParser::KeywordDefault,struct PXR_INTERNAL_NS_pegtl::seq<struct pxrInternal_v0_24_11__pxrReserved__::Sdf_TextFileFormatParser::Assignment,struct pxrInternal_v0_24_11__pxrReserved__::Sdf_TextFileFormatParser::PathRef> > > at 'timeSamples = {' in </prim.singleTimesampleWithDefault>
'
	Error in 'pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open' at line 1052 in file D:\a\OpenUSD\OpenUSD\pxr\usd\usd\stage.cpp : 'Failed to open layer @C:\sources\test-parsing\test-relationship.usda@'

This was working in previous versions. Is this expected?

Just to make sure what the concern is here:

  • This likely being caused by the 24.11 PEGTL parser rewrite
  • It’s not something we rely on, but something we were checking for to ensure that it did not happen.

Hi @miguelh ,

That should indeed be a parse error… the old parser, and some factoring of the Sdf API’s (like SetDefault and other attribute-related functionality) appearing on SdfPropertySpec, shared by both relationships and attributes. The reason for this is that these low-level libraries originated in Presto, where we decided to imbue relationships with an “alter ego” that completely changed their meaning and functionality when we declared them to be “varying”.

We do not ever intend to support varying relationships in USD, and we now have alternative tools to address the problems we faced in Presto twenty years ago - which will be of concern for OpenUSD also (i.e. constraints) in the coming years.

Hope it doesn’t cause too many problems for you, because it is a desired behavior change.

1 Like