-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usdGeom: add validation for gprim parenting #3212
base: dev
Are you sure you want to change the base?
usdGeom: add validation for gprim parenting #3212
Conversation
pxr/usd/usdGeom/validators.cpp
Outdated
UsdValidationErrorSite(usdPrim.GetStage(), | ||
usdPrim.GetPath()) | ||
}, | ||
TfStringPrintf("Gprim <%s> has an ancestor prim that is also a Gprim," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Boundable <%s> has an ancestor prim that is a Gprim
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, updated
Spiff's comment here suggests that |
I wonder if it would make more sense (and be simpler and faster to run) if we flip this check around and make it so that gprims look at their children/descendants, and raise an error if there is anything under them besides a UsdGeomSubset? Are there other valid descendants for gprims in standard USD? Or would this implementation be too limiting in terms of custom prim types that someone might want to place under gprims? Having written this all down I'm leaning towards leaving the test as-is, but it seems to me like it's worth at least considering. |
I had the same thought @marktucker 👍 I could see an argument in wanting something like
|
I've included Xformable in the check for now, however following your discussion with @marktucker I also thought to check the Gprims themselves. I'm not sure what the technical impact or implications of wrapping the Geomsubsets in Scope prims are, but it seems like a reasonable thing to want to do from an organizational standpoint. Would it make sense in that case that a Scope with a Gprim ancestor is valid if and only if it has a Geomsubset descendant? |
Putting GeomSubsets inside scopes is a nice idea. I hope Hydra accepts it... If that organization is acceptable, now we've gone from one "acceptable" descendant type to two, and I think the rule should be left as is. However if GeomSubsets in scopes doesn't work in Hydra, then that would be an argument for checking descendants instead of ancestors. So I just tried this, and if the GeomSubsets are under a scope, the materials bound to them no longer show up. So I think this is unsupported, at least by Hydra currently, so maybe checking descendants is a good idea after all... |
@marktucker I think even if the acceptable type list increases, your suggestion of checking descendants will always be more efficient than checking ancestors. |
Efficient, yes. But is it correct? My one remaining fear about it is that someone may add a "MyCustomGprimFeature" prim type which is intended to go under a gprim and a descendants check will flag it as an error because the validator doesn't know it's allowed to be there. But maybe this is an edge case not worth worrying about? Or maybe we'd hit this kind of "exception" problem with the ancestor check (for example, the Scope prim under the gprim would not be flagged as problematic by the current ancestor check unless we start adding special cases as @beersandrew suggested above). Okay, I'm now firmly on the side of "check descendants, not ancestors". |
Filed as internal issue #USD-9952 |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Updated this PR to go in that direction, let me know what you think |
pxr/usd/usdGeom/validators.cpp
Outdated
currentPrim.GetTypeName().GetText(), | ||
validGprimDescendantTypeNames.c_str()) | ||
); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_SubsetFamilies doesn't "break" when it finds an error - it keeps iterating and returns all errors. Maybe the same approach should be used here, pointing out all invalid descendant prims in one run, rather than just returning the first bad prim?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to stay consistent however in the case of having multiple skel properties on a prim that does not have the SkelBindingAPI applied, it was suggested to stop after the first one.
Is there a determining factor for when to get all errors vs the first error? (multiple prim errors -> get all, multiple property errors -> get first?) or is it case by case and trying to stay consistent isn't necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the context is different. In case of skel binding, the issue is with the non-application of SkelBindingAPI and presence of even a single property which belongs to SkelBindingAPI.
However, here we must report each descendant prim which is illegal within its scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beersandrew looks like you forgot to take the break out here? Was there a reason for this? If not, lmk and I will update it internally, already synced the PR in. Thanks
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Hey all! Sorry for chiming in late here, but I was recently rooting around in this code and added a bunch of the As @marktucker found, I don't expect any hierarchical structuring of OpenUSD/pxr/usd/usdGeom/validators.cpp Line 112 in 30392d9
The subset fetching functions all currently look only at immediate children when looking for subsets, so anything deeper in namespace would not be found, e.g.: OpenUSD/pxr/usd/usdGeom/subset.cpp Line 300 in 30392d9
Given that current restriction, it feels like the Supporting hierarchies of subsets under |
The If it's assumed that by default users would run all of the validation rules, then I think it does make sense to specify which of the |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Hey @beersandrew, there are some updated to the dev branch, which will require rebasing / updated here. Can you please do that, once done, I will sync this PR in. Thanks |
- added a validation rule that reports an error on a boundable prim that has a gprim ancestor
- added more test criteria to make sure GeomSubsets are tested to be valid
3b6aaaa
to
30ce460
Compare
- fixed an extra declaration of errors - added ErrorNameToken for InvalidGPrimDescendent
@tallytalwar This is updated on top of dev now. let me know if you see anything else that needs to be updated |
- removing break allows for all errors to be collected
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description of Change(s)
Fixes Issue(s)