-
Notifications
You must be signed in to change notification settings - Fork 202
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
Making visibility Undo/Redo correct. #1056
Changes from 1 commit
b24e690
7004631
865d479
88a3a5f
1a2008a
43bf1b1
8bac473
585cca0
16457bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,9 @@ | |
|
||
#include "private/UfeNotifGuard.h" | ||
|
||
#if UFE_PREVIEW_VERSION_NUM >= 2034 | ||
#include <mayaUsd/ufe/UsdObject3d.h> | ||
#endif | ||
#include <mayaUsd/ufe/UsdSceneItem.h> | ||
#include <mayaUsd/ufe/UsdUndoAddNewPrimCommand.h> | ||
#include <mayaUsd/ufe/Utils.h> | ||
|
@@ -36,7 +38,9 @@ | |
#include <maya/MGlobal.h> | ||
#include <ufe/attribute.h> | ||
#include <ufe/attributes.h> | ||
#if UFE_PREVIEW_VERSION_NUM >= 2034 | ||
#include <ufe/object3d.h> | ||
#endif | ||
#include <ufe/path.h> | ||
|
||
#include <algorithm> | ||
|
@@ -569,10 +573,23 @@ Ufe::UndoableCommand::Ptr UsdContextOps::doOpCmd(const ItemPath& itemPath) | |
return std::make_shared<SetVariantSelectionUndoableCommand>(prim(), itemPath); | ||
} // Variant sets | ||
else if (itemPath[0] == kUSDToggleVisibilityItem) { | ||
#if UFE_PREVIEW_VERSION_NUM < 2034 | ||
auto attributes = Ufe::Attributes::attributes(sceneItem()); | ||
assert(attributes); | ||
auto visibility = std::dynamic_pointer_cast<Ufe::AttributeEnumString>( | ||
attributes->attribute(UsdGeomTokens->visibility)); | ||
assert(visibility); | ||
auto current = visibility->get(); | ||
return visibility->setCmd( | ||
current == UsdGeomTokens->invisible ? UsdGeomTokens->inherited | ||
: UsdGeomTokens->invisible); | ||
#else | ||
auto object3d = UsdObject3d::create(fItem); | ||
assert(object3d); | ||
auto current = object3d->visibility(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we check that the scene item supports the Object3d interface? At this point it should, because we put up the menu entry for it, so perhaps we can just assert. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Great point. I am working on it as we speak. Addressed in 7004631 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a test for backing the new UsdUndoVisibleCommand : Added a new test for backing up the UFE command integration on Maya side for both "hide" and "showHidden" commands : |
||
auto cmd = object3d->setVisibleCmd(!current); | ||
cmd->execute(); | ||
return object3d->setVisibleCmd(!current); | ||
#endif | ||
|
||
} // Visibility | ||
else if (itemPath[0] == kUSDToggleActiveStateItem) { | ||
return std::make_shared<ToggleActiveStateCommand>(prim()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,10 @@ | |
// | ||
#include "UsdUndoVisibleCommand.h" | ||
|
||
#include "private/Utils.h" | ||
|
||
#include <mayaUsd/undo/UsdUndoBlock.h> | ||
#include <mayaUsdUtils/util.h> | ||
|
||
#include <pxr/usd/usdGeom/tokens.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused. |
||
|
||
#include <ufe/log.h> | ||
#include <pxr/usd/usdGeom/xformCommonAPI.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You sure we need this? The common API doesn't feel like it has much to do with visibility... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
namespace MAYAUSD_NS_DEF { | ||
namespace ufe { | ||
|
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.
Elsewhere we've been using TF_AXIOM, might want to consider that.
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.
Addressed in 8bac473