-
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] avoid crash from UsdGeomCamera::SetFromCamera #1661
[usdGeom] avoid crash from UsdGeomCamera::SetFromCamera #1661
Conversation
Filed as internal issue #USD-6975 |
Hi @ablev-nv ! In fact, it doesn't really matter whether a stronger opinion has a transform op in it already or not - we're going to get an unexpected result if a stronger opinion has any set of ops in it, because the AddTransformOp() in the weaker layer will be eclipsed. You could actually take two different approaches, here, depending on how "smart" we want MakeMatrixXform() to be. The first approach is to say (and document) "all we guarantee is that our authoring will be correct for evaluation at the current EditTarget" This is the more powerful approach, and would not result in any errors in your test case, but:
The other way, which continues to assume we are trying to affect the composed stage, just inserts a check after the ClearXformOpOrder() in MakeMatrixXform() to fetch the opOrder and ensure that it's empty. If it's not, we can reasonably assume that there is a stronger opinion eclipsing the clear we just did, and issue that information as a TF_WARN (since there's no bad code, just a unreconcilable condition from the user). In either case, SetCamera then need not issue any diagnostic, since any unexpected condition has already been reported, and just return if there's no XformOp for it. Does that make sense? |
Thanks @spiffmon ! That all makes sense. I was hesitant to change the behavior of MakeMatrixXform like your first proposal, because then MakeMatrixXform would diverge from the other Xformable APIs. But I guess its behavior is already slightly different from the others since it also nukes the xformOpOrder list, so maybe it's not a big deal to diverge further. That said, I'm inclined to implement your second proposal unless you feel strongly that the first is the best / most correct, in which case I'll give it a shot. |
I agree, @ablev-nv ; while I believe most USD mutators do possess "the number 1 property" of succeeding regardless of EditTarget even if it means the value you are authoring won't be "seen" on the resolved stage, it would be more confusing to allow one Xformable method to behave that way without bringing them all along. So #2 sound good to me, too! |
…et specifying a weaker layer and a stronger layer defining xformOpList
15a4aee
to
53130fc
Compare
Hi @spiffmon , I took a pass at modifying the PR per your second proposal while Alan is out. Thanks! |
Thanks, @asluk - looks good to me! We'll get it queued up. |
Description of Change(s)
Small change to avoid a crash from UsdGeomCamera::SetFromCamera where EditTarget is set to a weaker layer and a stronger layer on the stage defines the xformOpList on the camera (which results in an invalid UsdGeomXformOp returned from MakeMatrixXform())
New behavior issues a TF_CODING_ERROR instead of a crash.
Also updates the docstring for SetFromCamera.