You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a null prim object in Python, calling almost any method on it throws a python exception. A few methods (like IsValid()) return values. But IsDefined() crashes the applications
Steps to Reproduce
Open any USD file in usdview.
In the Interpreter window run:
p = usdviewApi.stage.GetPrimAtPath('/not_a_prim')
p.IsDefined()
usdview crashes
This is because in usd/wrapObject.cpp, in getattribute, there is a specific test done for a few method names. One of which is "IsDefined". This check allows the IsDefined method to be run even if the primitive is invalid (just as it allows IsValid() to return False instead of raising an exception). Every other Prim method (IsActive for example) raises an exception. The simple solution, I believe, is to just remove IsDefined from this list. But it's possible that this method really should be in this list, in which case I thinkit's implementation in wrapPrim.cpp needs to be changed to explicitly check for the null prim case?
The actual "crash" is caused in Usd_PrimDataHandle::operator->, where it calls UsdIssueFatalPrimAccessError().
The text was updated successfully, but these errors were encountered:
Thanks, @marktucker ! I'd vote for removing IsDefined from the whitelist, since its behavior relies on the presence of authored scene data, but would like for @gitamohr to weigh in.
Description of Issue
When you have a null prim object in Python, calling almost any method on it throws a python exception. A few methods (like IsValid()) return values. But IsDefined() crashes the applications
Steps to Reproduce
p = usdviewApi.stage.GetPrimAtPath('/not_a_prim')
p.IsDefined()
This is because in usd/wrapObject.cpp, in getattribute, there is a specific test done for a few method names. One of which is "IsDefined". This check allows the IsDefined method to be run even if the primitive is invalid (just as it allows IsValid() to return False instead of raising an exception). Every other Prim method (IsActive for example) raises an exception. The simple solution, I believe, is to just remove IsDefined from this list. But it's possible that this method really should be in this list, in which case I thinkit's implementation in wrapPrim.cpp needs to be changed to explicitly check for the null prim case?
The actual "crash" is caused in Usd_PrimDataHandle::operator->, where it calls UsdIssueFatalPrimAccessError().
The text was updated successfully, but these errors were encountered: