-
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
EMSUSD-626: As a layout artist, I'd like to toggle visibility of multiple prims #3417
EMSUSD-626: As a layout artist, I'd like to toggle visibility of multiple prims #3417
Conversation
…iple prims * Added bulk edit menu support to base UsdContextOps class. * Override in MayaUsdContextOps to add Maya specific menu items. * Assign New Material / Assign Existing Material - both of these now only work on single prim if context item is not in selection. * Fix contextOps unit test because of spec change with material context menu items and selection. * Added unit test for bulk edit contextOps.
@@ -422,7 +432,7 @@ void UsdUndoAssignNewMaterialCommand::execute() | |||
} | |||
// There might be some unassignable items in the selection list. Skip and warn. | |||
// We know there is at least one assignable item found in the ContextOps resolver. | |||
if (!BindMaterialUndoableCommand::CompatiblePrim(parentItem)) { | |||
if (!BindMaterialUndoableCommand::CompatiblePrim(parentItem) || isDefPrim(parentItem)) { |
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.
Nat wanted "Def" prims to have the same error (since they are incompatible).
# Select all three objects. | ||
ufe.GlobalSelection.get().append(capsuleItem) | ||
ufe.GlobalSelection.get().append(cubeItem) | ||
ufe.GlobalSelection.get().append(sphereItem) | ||
|
||
# Apply the new material on the unselected object. This object should also receive the new material binding, | ||
# in addition to the two selected objects. | ||
# Apply the new material one of the selected objects, so we are operating in | ||
# bulk mode. All the selected objects should receive the new material binding. |
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.
As per design from Nat, I changed the behavior of "Assign New Material" to only work on selection (and not selection + context item).
void UsdContextOps::setItem(const UsdSceneItem::Ptr& item) { fItem = item; } | ||
void UsdContextOps::setItem(const UsdSceneItem::Ptr& item) | ||
{ | ||
_item = item; |
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.
When setting the item, check for (and setup) the bulk edit.
static constexpr char kUSDDeactivatePrimLabel[] = "Deactivate Prim"; | ||
static constexpr char kUSDToggleInstanceableStateItem[] = "Toggle Instanceable State"; | ||
static constexpr char kUSDMarkAsInstancebaleLabel[] = "Mark as Instanceable"; |
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.
Fixed typo in kXXXLabel variable name.
@@ -417,6 +465,61 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& | |||
return items; | |||
} | |||
|
|||
// Adds the special Bulk Edit header as the first item. | |||
void UsdContextOps::addBulkEditHeader(Ufe::ContextOps::Items& items) 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.
Helper function so that it can be called from LookdevX plugin which also overrides contextOps and sometimes uses only their context menu (not calling ours).
} | ||
#endif | ||
|
||
inline bool sceneItemSupportsShading(const Ufe::SceneItem::Ptr& sceneItem) |
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 one was already here, I just made it inline and removed if (now just single return line).
UsdSceneItem::Ptr _item; | ||
bool _isAGatewayType { 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.
Fixed member var names according to coding standard.
// In single context item mode, only assign material to the context item. | ||
return std::make_shared<InsertChildAndSelectCommand>( | ||
UsdUndoAssignNewMaterialCommand::create(_item, itemPath[2])); |
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.
According to new spec from Nat, only apply this command to single context item (not plus selection). New bulk menu is for selection.
// In single context item mode, only assign material to the context item. | ||
return std::make_shared<BindMaterialUndoableCommand>(_item->path(), SdfPath(itemPath[2])); |
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.
According to new spec from Nat, only apply this command to single context item (not plus selection). New bulk menu is for selection.
#ifdef DEBUG | ||
auto DEBUG_OUTPUT = [&compositeCmd](const Ufe::Selection& bulkItems) { | ||
TF_STATUS( | ||
"Performing bulk edit on %d prims (%d selected)", | ||
compositeCmd->cmdsList().size(), | ||
bulkItems.size()); | ||
}; | ||
#else | ||
#define DEBUG_OUTPUT(x) (void)0 | ||
#endif |
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.
Helpful debugging output to show how many bulk items there were and how many the menu action was applied to. Only outputs in debug builds.
…iple prims * clang-format
…iple prims * Fix compiler errors for prior Maya builds.
…iple prims * Fix compiler error and unit test.
…iple prims * Fix compiler error (linux/osx) - related to unused ufe v4 function.
b3d83b2
to
90ab805
Compare
EMSUSD-626: As a layout artist, I'd like to toggle visibility of multiple prims