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

Enable creating Maya Reference prim as child of proxy shape node. #1978

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/mayaUsd/resources/scripts/mayaUsdAddMayaReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def createMayaReferencePrim(ufePathStr, mayaReferencePath, mayaNamespace):
# Extract the USD path segment from the UFE path and append the Maya
# reference prim to it.
ufePath = ufe.PathString.path(ufePathStr)
parentPath = ufePath.segments[1]
primPath = Sdf.AssetPath(str(parentPath)+'/MayaReference')
parentPath = str(ufePath.segments[1]) if ufePath.nbSegments() > 1 else ''
primPath = Sdf.AssetPath(parentPath+'/MayaReference')

stage = mayaUsd.ufe.getStage(ufePathStr)
prim = stage.DefinePrim(primPath.path, 'MayaReference')
Expand Down
17 changes: 8 additions & 9 deletions lib/mayaUsd/ufe/UsdContextOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,17 +619,16 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath&
items.emplace_back(kUSDLayerEditorItem, kUSDLayerEditorLabel, kUSDLayerEditorImage);
#endif

// Top-level items (do not add for gateway type node):
if (!fIsAGatewayType) {
#ifdef UFE_V3_FEATURES_AVAILABLE
if (PrimUpdaterManager::getInstance().canEditAsMaya(path())) {
items.emplace_back(kEditAsMayaItem, kEditAsMayaLabel, kEditAsMayaImage);
items.emplace_back(kDuplicateAsMayaItem, kDuplicateAsMayaLabel);
items.emplace_back(kAddMayaReferenceItem, kAddMayaReferenceLabel);
items.emplace_back(Ufe::ContextItem::kSeparator);
}
if (!fIsAGatewayType && PrimUpdaterManager::getInstance().canEditAsMaya(path())) {
items.emplace_back(kEditAsMayaItem, kEditAsMayaLabel, kEditAsMayaImage);
items.emplace_back(kDuplicateAsMayaItem, kDuplicateAsMayaLabel);
}
items.emplace_back(kAddMayaReferenceItem, kAddMayaReferenceLabel);
pierrebai-adsk marked this conversation as resolved.
Show resolved Hide resolved
items.emplace_back(Ufe::ContextItem::kSeparator);
#endif

if (!fIsAGatewayType) {
// Working set management (load and unload):
const auto itemLabelPairs = _computeLoadAndUnloadItems(prim());
for (const auto& itemLabelPair : itemLabelPairs) {
Expand Down Expand Up @@ -666,7 +665,7 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath&
kUSDToggleInstanceableStateItem,
prim().IsInstanceable() ? kUSDUnmarkAsInstanceableLabel
: kUSDMarkAsInstancebaleLabel);
}
} // !fIsAGatewayType

// Top level item - Add New Prim (for all context op types).
items.emplace_back(kUSDAddNewPrimItem, kUSDAddNewPrimLabel, Ufe::ContextItem::kHasChildren);
Expand Down