Skip to content
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-247 - Added an option box for outliner on edit as Maya Data #3269

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/mayaUsd/ufe/MayaUsdContextOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ static constexpr char kDuplicateAsMayaLabel[] = "Duplicate As Maya Data";
static constexpr char kAddMayaReferenceItem[] = "Add Maya Reference";
static constexpr char kAddMayaReferenceLabel[] = "Add Maya Reference...";
#endif
#if (UFE_PREVIEW_VERSION_NUM >= 5007)
static constexpr char kEditAsMayaOptionsItem[] = "Edit As Maya Data Options";
static constexpr char kEditAsMayaOptionsLabel[] = "Edit As Maya Data Options";
#endif
static constexpr char kBindMaterialToSelectionItem[] = "Assign Material to Selection";
static constexpr char kBindMaterialToSelectionLabel[] = "Assign Material to Selection";
#ifdef UFE_V4_FEATURES_AVAILABLE
Expand Down Expand Up @@ -254,6 +258,18 @@ void executeEditAsMaya(const Ufe::Path& path)

#endif

#if (UFE_PREVIEW_VERSION_NUM >= 5007)

void executeEditAsMayaOptions(const Ufe::Path& path)
{
// The edit as maya command name.
const char editAsMayaOptionsCommand[] = "mayaUsdMenu_EditAsMayaDataOptions";
MString script;
script.format("^1s \"^2s\"", editAsMayaOptionsCommand, Ufe::PathString::string(path).c_str());
WaitCursor wait;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a wait cursor here. You are just opening an option box.

MGlobal::executeCommand(script, /* display = */ true, /* undoable = */ true);
}
#endif
} // namespace

namespace MAYAUSD_NS_DEF {
Expand Down Expand Up @@ -297,6 +313,11 @@ Ufe::ContextOps::Items MayaUsdContextOps::getItems(const Ufe::ContextOps::ItemPa
const bool isMayaRef = (prim().GetTypeName() == TfToken("MayaReference"));
if (!fIsAGatewayType && PrimUpdaterManager::getInstance().canEditAsMaya(path())) {
items.emplace_back(kEditAsMayaItem, kEditAsMayaLabel, kEditAsMayaImage);
#if (UFE_PREVIEW_VERSION_NUM >= 5007)
Ufe::ContextItem item(kEditAsMayaOptionsItem, kEditAsMayaOptionsLabel);
item.setMetaData(Ufe::ContextItem::kIsOptionBox, true);
items.emplace_back(item);
#endif
if (!isMayaRef) {
items.emplace_back(kDuplicateAsMayaItem, kDuplicateAsMayaLabel);
}
Expand Down Expand Up @@ -591,6 +612,10 @@ Ufe::UndoableCommand::Ptr MayaUsdContextOps::doOpCmd(const ItemPath& itemPath)
#ifdef UFE_V3_FEATURES_AVAILABLE
else if (itemPath[0] == kEditAsMayaItem) {
executeEditAsMaya(path());
#if (UFE_PREVIEW_VERSION_NUM >= 5007)
} else if (itemPath[0] == kEditAsMayaOptionsItem) {
executeEditAsMayaOptions(path());
#endif
} else if (itemPath[0] == kDuplicateAsMayaItem) {
MString script;
script.format(
Expand Down