-
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
MAYA-122528 - MayaUSD should support UFE lights #2266
Conversation
- Small fixes in the code
# Conflicts: # lib/mayaUsd/ufe/CMakeLists.txt # lib/mayaUsd/ufe/Global.cpp # test/lib/ufe/CMakeLists.txt
@ppt-adsk I wrapped the new code using UFE Light into UFE_V4_FEATURES_AVAILABLE macro, but the perflight still fails. I can also add a check against UFE_PREVIEW_VERSION_NUM, but this looks like a temporary solution that would require an additional PR in the future. How should I proceed to fix the preflights? |
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.
Undo / redo implementation needs to use UsdUndoableItem / UsdUndoBlock, but you're really close.
self.inchesToCm = 2.54 | ||
self.mmToCm = 0.1 | ||
|
||
def _StartTest(self, testName): |
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.
Could be called in setupClass() or setUp().
test/lib/ufe/testLight.py
Outdated
|
||
def _StartTest(self, testName): | ||
cmds.file(force=True, new=True) | ||
mayaUtils.loadPlugin("mayaUsdPlugin") |
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.
Unnecessary, done by the (poorly-named) isMayaUsdPluginLoaded().
@@ -0,0 +1,257 @@ | |||
#!/usr/bin/env python |
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.
Would have been good to get some undo / redo testing done as well. Perhaps next pull request.
namespace ufe { | ||
|
||
template <typename ValueTypeIn> | ||
class SetValueUndoableCommandImpl : public Ufe::SetValueUndoableCommand<ValueTypeIn> |
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.
Unfortunately we can't implement undo / redo in USD by setting the previous value on undo, because this is incomplete. If you imagine a situation where the edit target is set to a higher-priority layer which has no current opinion, undo should completely remove the opinion, NOT set the new opinion to the previous value.
Fortunately we have helper classes for this which make it easy to do the right thing. See the existing
template <typename Cmd> class UsdUndoableCommand : public Cmd |
and
maya-usd/lib/mayaUsd/ufe/UsdAttribute.cpp
Line 199 in 6e1c88a
class UsdUndoableCommand : public Ufe::UndoableCommand |
and their uses in the code base, and pick the one that's right for you.
return Ufe::Light::Invalid; | ||
} | ||
|
||
float getLightIntensity(const UsdPrim& 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.
Is it useful for these free functions to be visible in the MayaUsd::ufe namespace? Or should they be private in the unnamed namespace for this translation unit? No preference either way, just wondering.
Create new class ufe::UsdLight inheriting from Ufe::Light to represent usd lights in UFE