-
Notifications
You must be signed in to change notification settings - Fork 201
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
LOOKDEVX-670 Improved USD type support #2364
LOOKDEVX-670 Improved USD type support #2364
Conversation
We added new types in Ufe 0.4.15. This updates maps them to their corresponding USD types.
Chorus detected one or more security issues with this pull request. See the Checks tab for more details. As a reminder, please follow the secure code review process as part of the Secure Coding Non-Negotiable requirement. |
T gfVec = vt.UncheckedGet<T>(); | ||
U ret; | ||
constexpr size_t num = ret.vector.size(); | ||
std::copy(gfVec.data(), gfVec.data() + num, ret.vector.data()); |
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.
Support 2 and 4 component vectors. Still works pre-0.4.15.
|
||
template <typename T, typename U> | ||
U getUsdAttributeColorAsUfe(const PXR_NS::UsdAttribute& attr, const PXR_NS::UsdTimeCode& time) | ||
{ |
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.
But since we are accessing the inner class, we must create a specialization for colors because the name of the inner class is different.
test/lib/ufe/testAttribute.py
Outdated
@@ -160,8 +176,17 @@ def runUndoRedoUsingMayaSetAttr(self, attr, newVal, decimalPlaces=None): | |||
setAttrPath = self.getMayaAttrStr(attr) | |||
if isinstance(newVal, (ufe.Vector3i, ufe.Vector3f, ufe.Vector3d)): | |||
cmds.setAttr(setAttrPath, newVal.x(), newVal.y(), newVal.z()) | |||
elif isinstance(newVal, ufe.Vector2f): |
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.
We could support all vector types with a single:
cmds.setAttr(setAttrPath, *newVal.vector)
If we want to sinplify this a little.
test/lib/ufe/testAttribute.py
Outdated
# Pre Ufe 0.4.15: Maya might return the result as a string for colors. Fixed to always | ||
# return a vector post 0.4.15. | ||
if isinstance(getAttrValue, str): | ||
getAttrValue = eval(getAttrValue) |
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.
Will replace with ast.literal_eval as this will work fine and be safer.
Ready for merge. Preflight succeeded except for one machine experiencing technical difficulties. |
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.
Just two minor comment changes.
lib/mayaUsd/ufe/UsdAttribute.h
Outdated
|
||
using TypedUsdAttribute<Ufe::Matrix3d>::TypedUsdAttribute; | ||
|
||
//! Create a UsdAttributeDouble3. |
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.
Comment should be UsdAttributeMatrix3d
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.
This comment does not provide any extra information. Removed since reading the function signature is sufficient.
lib/mayaUsd/ufe/UsdAttribute.h
Outdated
|
||
using TypedUsdAttribute<Ufe::Matrix4d>::TypedUsdAttribute; | ||
|
||
//! Create a UsdAttributeDouble4. |
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.
Comment should be UsdAttributeMatrix4d
We added new types in Ufe 0.4.15. This updates maps them to their
corresponding USD types.