-
Notifications
You must be signed in to change notification settings - Fork 203
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
USDGeomScope support in Proxy Shape #185
Conversation
* create Scope MPxNode, MTransformationMatrix, add/update some tests etc * filled in a few missing methods and conditionals - tests are passing now * fleshing out scope behaviour * scope tests now working as expected * selection store support for scope * add todos * basic bounding box working - spliced in Dan Englessons improvements to boundingBox() and a mixed hierarchy of scope/xforms/geom seems to frame in maya-2019 * support time * rename transform() method to getTransformNode() to make it easier to find * Transform now subclasses from Scope * refactored Scope/Transform nodes and their TransformationMatrix classes to an inheritance relationship to support nicer handling of new/multiple types * addressed code review comments * replace transform2() method with more sensible getTransMatrix() * show node type when print refcounts * addressed hopefully final review comnents * refactor proxy select node creation logic, prioritise custom node types over AL_USDMaya scope/transform * extract mayaNodeCreation from makeUsdTransformChain for eventual reuse * update makeUsdTransformsInternal to use new createMayaNode method * dynamic cast when requesting transform type to avoid problems with custom types * remove todos, update unit test * A slight change so that Transform now inherits the attributes from Scope, rather than making new copies of them. * Check for both Scope::kTypeId and Transform::kTypeId * reordered the node registration
@pilarmolinalopez can you help review this change? |
Hey Eoin. I started writing up some comments/questions as part of a review and I think the direction most of my thoughts were going were towards things like how general the transform classes are and if some of this might belong in a common area instead of just being in the AL plugin (similar to the discussion in PR #158). I’ve been slowed down by a bunch of other stuff, but maybe you can answer that question before I spend too much time on it. Do we think that there is functionality here that would be nice to have down in the core lib next to or as part of the proxy base class that is shared with the other plugins? I think the answer is “Yes, eventually”, but right now it’s only the AL plugin that would use it. |
Hi Tim, in this case the functionality is very AL Proxy Shape live interaction workflow specific - there's not even a general maya->USD Scope importer/exporter.. |
Totally makes sense, Eoin. |
@@ -1637,7 +1637,9 @@ bool ProxyShape::lockTransformAttribute(const SdfPath& path, const bool lock) | |||
r.setLocked(lock); | |||
s.setLocked(lock); | |||
|
|||
if (lock && MFnDependencyNode(lockObject).typeId() == AL_USDMAYA_TRANSFORM) | |||
MFnDependencyNode fn(lockObject); | |||
Scope* transformNode = static_cast<Scope*>(fn.userNode()); |
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 one and the one on line 2144 be dynamic_cast?
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 you're right -It would be OK to use static_cast if the data had been pre-filtered to only allow Scopes or classes derived from it, or we were doing some kind of checking earlier on in the method, but as "lockObject" can be any maya object we should either be doing those checks or using a dynamic_cast to check that it's a valid Scope at run -time... (add some minor performance cost). Will update. Thanks!
// that has ANY attribute that connected to rotateAxis, it will cause the rotateAxis to evaluate INCORRECTLY, | ||
// even on the BASE transform class! | ||
// See this gist for full reproduction details: | ||
// https://gist.github.com/elrond79/f9ddb277da3eab2948d27ddb1f84aba0 |
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.
Do you happen to know if we have an internal bug for this? If not we should get one logged. It does sound familiar.
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.
Not sure...(If that was addressed to me)
Appreciate the added tests for the new class, have you only been able to run them on Linux? If not, I'll build it and run them locally tomorrow morning. |
Hi Tim, yes have only been able to run on Linux. This code has been in production for a while though, so I think it's mostly error free |
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 have the same question as Tim has regarding static_cast vs dynamic_cast in those lines. Everything else looks good, I'll mark it as approved on my part waiting on that.
I was also able to build it and run the unit tests in Linux.
m_primPath = addStringAttr("primPath", "pp", kReadable | kWritable | kStorable | kConnectable | kAffectsWorldSpace, true); | ||
m_inStageData = addDataAttr("inStageData", "isd", MayaUsdStageData::mayaTypeId, kWritable | kStorable | kConnectable | kHidden | kAffectsWorldSpace); | ||
addInheritedAttr("primPath"); | ||
addInheritedAttr("inStageData"); |
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.
FYI I am spending some time today trying to get it built and see if the tests pass. This is a line you'll have problems with. Paul removed this function and replaced it with something slightly different. See commit 476826f
I managed to pull your changes into the branch where Hamed and I were working on getting the tests to run/pass on Windows and I think I got a successful run (after changing a couple lines where the functions you were using had been removed). You'll have to update those but then I'd be ready to close this one. |
@fowlertADSK @kxl-adsk addressed comments, merged latest dev |
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.
Please fix compilation errors in strict mode
|
||
/// \brief return the prim this transform matrix is attached to | ||
/// \return the prim this transform matrix is controlling | ||
inline const UsdPrim& prim() const |
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.
/git/usd/maya-usd/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/TransformationMatrix.h:310:25: error: 'prim' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
inline const UsdPrim& prim() const
^
/git/usd/maya-usd/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/BasicTransformationMatrix.h:73:26: note: overridden virtual function is here
virtual const UsdPrim& prim() const
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.
In addition, there is no value in making the virtual method inlined.
//-------------------------------------------------------------------------------------------------------------------- | ||
/// Data members | ||
//-------------------------------------------------------------------------------------------------------------------- | ||
bool updateTransformInProgress = false; |
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.
/git/usd/maya-usd/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.h:110:8: error: private field 'updateTransformInProgress' is not used [-Werror,-Wunused-private-field]
bool updateTransformInProgress = false;
if (ptr->typeId()==AL::usdmaya::nodes::Transform::kTypeId) | ||
{ | ||
//It's a transform | ||
AL::usdmaya::nodes::BasicTransformationMatrix* matrix = ptr->transform(); |
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.
/git/usd/maya-usd/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ScopeMatrix.cpp:130:56: error: unused variable 'matrix' [-Werror,-Wunused-variable]
AL::usdmaya::nodes::BasicTransformationMatrix* matrix = ptr->transform();
@murphyeoin attaching patch I used to fix compilation errors. |
Thanks @kxl-adsk can you confirm that running the compiler in strict mode is part of your standard testing process? If so should we just make it part of the build? (perhaps as an additional target? ) |
Yes, we run the compiler in strict mode on all platforms. You can pass it to |
Hi @kxl-adsk I fixed them in our fork and have updated. I will add the strict mode compile to our build script as the aim is that we're all testing the same thing. Any other flags in your build-args that we should know about? Thanks |
At the moment, no, there is nothing else. |
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.
Looks good. Thank you!
Description
Currently any Prim of type USDGeomScope will get translated to an AL_USDMaya_Transform on any relevant Proxy Shape related operation e.g;
etc.
We want to avail of 2 characteristics of Scopes when translating to maya:
We now translate those to a new MPxTransform derived node called "Scope"
What was done?
Doing this work made me remember we have a weird hack in AL_USDMaya which allows creation of arbitrary transform nodes. This works by tagging an Xform in USD with the
"al_usdmaya_transformType" metadatum... It allows you to create custom transform types without needing to add a proper factory/plugin system or create an explicit dependency on the type - basically a poor man's factory. How this stuff interacts with AL_usdmaya transforms and scopes is anyone's guess really. At least the code is mostly in one place now
Future work