Relationship validation

Is there any form of validation for relationship attributes? And on that same note, even if USD itself doesn’t validate, is there a way to express the restrictions?
II think the answer is no to both, but I just wanted to check in case I missed something.

The kinds of restrictions I was thinking of are:

  1. Type validation e.g I material binding should only point to Material prims etc…
  2. Cycle checking to prevent cyclical relationships

It would also be good to know what we do when a cycle is encountered. Is that purely up to the consuming app/render delegate?

Don’t have a clear answer, but…

Isn’t it technically possible in USD to set up a binding to a material path that doesn’t actually exist? If so, at what level would you expect this type checking to occur? On the stage composing?

I had seen e.g. Render Settings with Render Product relationships being able to map a relationship target even to a Render Product does not exist anymore.

Also, I haven’t seen any typing around any UsdRelationship myself so I’m not sure if there’s even a registry that says they can only bind to material prims. (Aside of that, couldn’t they also bind to Collections?)

Yeah I was thinking it wouldn’t necessarily be at author/write time but could be some kind of utility function or option on an attribute writer. So you could still author dangling ones, but check resolution at different times

Keep an eye out for our proposal on a general validation framework. We don’t want to generally do alot of validation within the core authoring code… and cycles aren’t always a proscribed thing :slight_smile: though that one might make sense as a “general warning”…

1 Like

Oh nice. Something to look forward to

For cyclic checking of attribute connection, TinyUSDZ Tydra records visited property paths to detect it:

Same can be applied to Relationship resolution. As @spiff pointed out, validation should be done in surrounding framework, not in core part.