-
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
MAYA-105175: Rewrote the rename restriction algorithm from scratch to cover more edge cases. #786
Changes from 1 commit
6c2a798
e50457c
a9226cd
52d7585
92f1c04
8038469
5adec49
eac389a
2472eec
b10a2b4
9985175
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 |
---|---|---|
|
@@ -134,9 +134,12 @@ void applyCommandRestriction(const UsdPrim& prim, const std::string& commandName | |
std::string layerDisplayName; | ||
|
||
// check to see if there is a spec at the edit target layer. | ||
if (primSpec) | ||
for (const auto& spec : primStack) | ||
{ | ||
for (const auto& spec : primStack) | ||
if (primSpec != spec) { | ||
layerDisplayName.append("[" + spec->GetLayer()->GetDisplayName() + "]" + ","); | ||
} | ||
else | ||
{ | ||
// skip if the spec already exist | ||
if (primSpec == spec && spec->GetSpecifier() == SdfSpecifierDef && primSpec->GetLayer() == spec->GetLayer()) { | ||
|
@@ -159,22 +162,10 @@ void applyCommandRestriction(const UsdPrim& prim, const std::string& commandName | |
break; | ||
} | ||
} | ||
|
||
if(!layerDisplayName.empty()) | ||
{ | ||
layerDisplayName.pop_back(); | ||
std::string err = TfStringPrintf("Cannot %s [%s]. It is defined on another layer. Please set %s as the target layer to proceed.", | ||
commandName.c_str(), | ||
prim.GetName().GetString().c_str(), | ||
layerDisplayName.c_str()); | ||
throw std::runtime_error(err.c_str()); | ||
} | ||
} | ||
else | ||
|
||
if(!layerDisplayName.empty()) | ||
{ | ||
for (const auto& spec : primStack) { | ||
layerDisplayName.append("[" + spec->GetLayer()->GetDisplayName() + "]" + ","); | ||
} | ||
layerDisplayName.pop_back(); | ||
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. Why the pop_back()? 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. the pop_back is just for make up purposes in the error message. It just removes the last "," in the case where there are multiple layers:
I pop back the last "," so it looks
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. Right, you've explained this to me once before... A shortened version of your explanation would make a great code comment. |
||
std::string err = TfStringPrintf("Cannot %s [%s]. It is defined on another layer. Please set %s as the target layer to proceed.", | ||
commandName.c_str(), | ||
|
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.
Simplified the logic by removing the redundant primSpec check and loop in primStack.