Skip to content

Commit 24ad15a

Browse files
deboisjclaude
andcommitted
Test review pass
sts om shared LE 876036 -0400 Merge remote-tracking branch 'upstream/dev' into deboisj/unify_layer_editor_review kQACksGu6ycD7dV7/lRp4Guvvj KVCsT9UwEthfdkPDMfa7G3i+9GSacK733THUcJppZK+4DM2m8PbSiP0pj/dSaElf iaICFZ7H2KJ6tTashv3bQPy6Z7mn4slht5L+66l+D4rWifT8QB1CXj2z2cgZ+2NX oc1LH6nKO6HKmq8crOB63Yb8O81jLOWCJoYt40nrlxy1SWqIJpMNnV2mj+1xAnUI 9n1h3qJb4+Jauu4zH+JPds/dewJ+3sLwKSF5q8BdLb8XmHckHG2ajvXmpZAJg6Rk vtkQDip8Viem0NpWOsVRVuQxOeqLs1UXhZt5e3bZ5txHR5L5PiHeb0rrphZ7b57w 50zBFPlKnP/+noIbMBtPBSUkw9B0lQFNVvxjamQic2Zga23J5+dcJ1Qf9J1tVbf+ hDOY1r3vxFU1PnDPvJjTgsA0ATH+P33Z1wQ4lYNaENo2iT+nbccq/fOusSNzsBdl iK2auWyxHX4P21ZpsZlICRgSkUn68Ncn0dJIUA6grewUAGxoBGkGHQ17FTTxWtXe XaZ3WpikFeNcRS89DayGpcjnj9UzSco2L0ZrudCLh/ltNDrxlk4tpQQrMep+0aI+ B/oIBncZS8y4IZAKdDm5pqJtGaYulqwYHAXL41QyAv/QEg+sA20KLSRKVIaQz7CK kq12Y3YgiDpN7fbCmJx/ =2NPd -----END PGP SIGNATURE----- Merge pull request #4651 from Autodesk/barbalt/dev/EMSUSD-3311-remove-opinion EMSUSD-3311 - Add remove opinion + undoENEITEM_HAS_METADATA is no…both unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> hropic.com>
1 parent c84b980 commit 24ad15a

10 files changed

Lines changed: 105 additions & 78 deletions

File tree

lib/mayaUsd/commands/mayaLayerEditorDCCFunctions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ void registerLayerEditorDCCFunctions()
134134
return MayaUsd::ComponentUtils::previewSaveAdskUsdComponent(
135135
saveLocation, componentName, dccObjectPath);
136136
};
137-
component.displayError = [](const std::string& error) {
138-
MGlobal::displayError(error.c_str());
139-
};
140137
component.getComponentLayersToSave = [](const std::string& dccObjectPath) {
141138
return MayaUsd::ComponentUtils::getAdskUsdComponentLayersToSave(dccObjectPath);
142139
};
@@ -254,6 +251,9 @@ void registerLayerEditorDCCFunctions()
254251
= PXR_NS::UsdMayaUtil::convert(MayaUsdOptionVars->LayerContentsTimeSamplesSizeLimit);
255252
return MGlobal::optionVarExists(k) ? MGlobal::optionVarIntValue(k) : 8;
256253
};
254+
environment.displayError = [](const std::string& error) {
255+
MGlobal::displayError(error.c_str());
256+
};
257257
setEnvironmentFns(environment);
258258

259259
#ifdef WANT_ADSK_USD_EDIT_FORWARD_BUILD

lib/usdLayerEditor/lib/layerEditorDCCFunctions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ std::vector<std::string> getComponentLayersToSave(const std::string& dccObjectPa
104104
}
105105
void displayError(const std::string& error)
106106
{
107-
if (registry().component.displayError)
108-
registry().component.displayError(error);
107+
if (registry().environment.displayError)
108+
registry().environment.displayError(error);
109109
}
110110
PXR_NS::SdfLayerRefPtr captureSessionLayer(const std::string& dccObjectPath)
111111
{

lib/usdLayerEditor/lib/layerEditorDCCFunctions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ struct ComponentFns
7676
MoveComponentFn moveComponent;
7777
PreviewComponentSaveFn previewComponentSave;
7878
GetComponentLayersToSaveFn getComponentLayersToSave;
79-
std::function<void(const std::string&)> displayError; // no-op when unset
8079
CaptureSessionLayerFn captureSessionLayer; // returns null when unset
8180
TransferSessionLayerFn transferSessionLayer; // no-op when unset
8281
SetProxyRootLayerPathFn setProxyRootLayerPath; // no-op when unset
@@ -125,6 +124,7 @@ struct EnvironmentFns
125124
std::function<QWidget*()> mainWindowParent; // default nullptr
126125
std::function<int64_t()> layerContentsArraySizeLimit; // default 8
127126
std::function<int64_t()> layerContentsTimeSamplesSizeLimit; // default 8
127+
std::function<void(const std::string&)> displayError; // no-op when unset
128128
};
129129

130130
struct FileSystemFns
@@ -183,7 +183,6 @@ moveComponent(const std::string&, const std::string&, const std::string&);
183183
LayerEditorAPI std::string
184184
previewComponentSave(const std::string&, const std::string&, const std::string&);
185185
LayerEditorAPI std::vector<std::string> getComponentLayersToSave(const std::string&);
186-
LayerEditorAPI void displayError(const std::string&);
187186
LayerEditorAPI PXR_NS::SdfLayerRefPtr captureSessionLayer(const std::string& dccObjectPath);
188187
LayerEditorAPI void transferSessionLayer(
189188
const PXR_NS::SdfLayerRefPtr& sourceSessionLayer,
@@ -226,6 +225,7 @@ LayerEditorAPI bool shouldExpandOrCollapseAll();
226225
LayerEditorAPI QWidget* mainWindowParent();
227226
LayerEditorAPI int64_t layerContentsArraySizeLimit();
228227
LayerEditorAPI int64_t layerContentsTimeSamplesSizeLimit();
228+
LayerEditorAPI void displayError(const std::string&);
229229

230230
// FileSystemFns
231231
LayerEditorAPI std::string getDCCSceneDir();

test/lib/oldUsdLayerEditor/cpp/stubCommandHook.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ class OldEditorStubCommandHook : public AbstractCommandHook
6363
bool hasCall(const std::string& method) const;
6464
int callCount(const std::string& method) const;
6565
const CommandCall& lastCall() const;
66+
// Returns a pointer to the last call with the given name, or nullptr if none.
67+
const CommandCall* lastCallOf(const std::string& method) const
68+
{
69+
for (auto it = _calls.rbegin(); it != _calls.rend(); ++it)
70+
if (it->name == method)
71+
return &*it;
72+
return nullptr;
73+
}
6674

6775
std::vector<CommandCall> _calls;
6876

test/lib/usdLayerEditor/cpp/stubCommandHook.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ class StubCommandHook : public AbstractCommandHook
5454
bool hasCall(const std::string& method) const;
5555
int callCount(const std::string& method) const;
5656
const CommandCall& lastCall() const;
57+
// Returns a pointer to the last call with the given name, or nullptr if none.
58+
const CommandCall* lastCallOf(const std::string& method) const
59+
{
60+
for (auto it = _calls.rbegin(); it != _calls.rend(); ++it)
61+
if (it->name == method)
62+
return &*it;
63+
return nullptr;
64+
}
5765

5866
std::vector<CommandCall> _calls;
5967

test/lib/usdLayerEditor/cpp/testButtonsLogic.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class ButtonsSharedStageFixture : public LayerEditorTestFixture
4545

4646
// Shared stage backed by a real file: root layer is non-anonymous and initially
4747
// clean, so the Save button starts disabled and only enables when dirty.
48+
// Not compiled for the old editor: switchToCustomStage is new-editor-only API.
49+
#ifndef MAYAUSD_OLD_LAYER_EDITOR
4850
class SaveStageCleanNonAnonFixture : public LayerEditorTestFixture
4951
{
5052
protected:
@@ -69,6 +71,7 @@ class SaveStageCleanNonAnonFixture : public LayerEditorTestFixture
6971
QFile::remove(_stagePath);
7072
}
7173
};
74+
#endif
7275

7376
// Clicking "Add a New Layer" with nothing selected inserts an anonymous sublayer at the root.
7477
TEST_F(LayerEditorTestFixture, NewLayerButton_Click_CallsAddAnonymousSubLayer)
@@ -81,10 +84,9 @@ TEST_F(LayerEditorTestFixture, NewLayerButton_Click_CallsAddAnonymousSubLayer)
8184
btn->click();
8285
QApplication::processEvents();
8386

84-
ASSERT_TRUE(_sessionState._commandHookImpl.hasCall("addAnonymousSubLayer"))
85-
<< "addAnonymousSubLayer should have been called";
86-
EXPECT_EQ(_sessionState._commandHookImpl.lastCall().args[0],
87-
_sessionState.stage()->GetRootLayer()->GetIdentifier())
87+
const auto* call = _sessionState._commandHookImpl.lastCallOf("addAnonymousSubLayer");
88+
ASSERT_NE(call, nullptr) << "addAnonymousSubLayer should have been called";
89+
EXPECT_EQ(call->args[0], _sessionState.stage()->GetRootLayer()->GetIdentifier())
8890
<< "addAnonymousSubLayer should target the root layer when nothing is selected";
8991
}
9092

@@ -173,10 +175,9 @@ TEST_F(LayerEditorTestFixture, NewLayerButton_Click_NoSelection_AddsToRoot)
173175
btn->click();
174176
QApplication::processEvents();
175177

176-
ASSERT_TRUE(_sessionState._commandHookImpl.hasCall("addAnonymousSubLayer"))
177-
<< "addAnonymousSubLayer should be called on root layer when nothing is selected";
178-
EXPECT_EQ(_sessionState._commandHookImpl.lastCall().args[0],
179-
_sessionState.stage()->GetRootLayer()->GetIdentifier())
178+
const auto* call = _sessionState._commandHookImpl.lastCallOf("addAnonymousSubLayer");
179+
ASSERT_NE(call, nullptr) << "addAnonymousSubLayer should be called on root layer when nothing is selected";
180+
EXPECT_EQ(call->args[0], _sessionState.stage()->GetRootLayer()->GetIdentifier())
180181
<< "parent should be the root layer when there is no selection";
181182
}
182183

@@ -264,11 +265,10 @@ TEST_F(LayerEditorTestFixture, NewLayerButton_Click_WithSublayerSelectionAddsSib
264265
btn->click();
265266
QApplication::processEvents();
266267

267-
ASSERT_TRUE(_sessionState._commandHookImpl.hasCall("addAnonymousSubLayer"))
268-
<< "addAnonymousSubLayer should be called on the parent when adding a sibling";
269268
// Adding a sibling means inserting into the selected layer's parent (root).
270-
EXPECT_EQ(_sessionState._commandHookImpl.lastCall().args[0],
271-
_sessionState.stage()->GetRootLayer()->GetIdentifier())
269+
const auto* call = _sessionState._commandHookImpl.lastCallOf("addAnonymousSubLayer");
270+
ASSERT_NE(call, nullptr) << "addAnonymousSubLayer should be called on the parent when adding a sibling";
271+
EXPECT_EQ(call->args[0], _sessionState.stage()->GetRootLayer()->GetIdentifier())
272272
<< "parent should be the root layer when a direct sublayer of root is selected";
273273
}
274274

@@ -284,6 +284,7 @@ TEST_F(LayerEditorTestFixture, ToolbarButtons_HaveObjectNames)
284284
// With a file-backed (non-anonymous), clean stage the Save button starts disabled.
285285
// Making the stage dirty must enable it — the transition proves the button actually
286286
// tracks needsSaving() rather than being permanently enabled by isAnonymous().
287+
#ifndef MAYAUSD_OLD_LAYER_EDITOR
287288
TEST_F(SaveStageCleanNonAnonFixture, SaveStageButton_DisabledInitially_EnabledWhenDirty)
288289
{
289290
QPushButton* btn = TestUtils::findButtonByTooltip(_widget, "Save all edits in the Layer Stack");
@@ -298,6 +299,7 @@ TEST_F(SaveStageCleanNonAnonFixture, SaveStageButton_DisabledInitially_EnabledWh
298299

299300
EXPECT_TRUE(btn->isEnabled()) << "Save Stage button should be enabled after stage becomes dirty";
300301
}
302+
#endif
301303

302304
// ── New Layer button: disabled → enabled transition ───────────────────────────
303305

test/lib/usdLayerEditor/cpp/testContextMenuLogic.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ TEST_F(LayerEditorTestFixture, ContextMenu_AddAnonymousSublayer_CallsHook)
4242
_sessionState._commandHookImpl.clearCalls();
4343
_window->addAnonymousSublayer();
4444
QApplication::processEvents();
45-
ASSERT_TRUE(_sessionState._commandHookImpl.hasCall("addAnonymousSubLayer"));
46-
EXPECT_EQ(_sessionState._commandHookImpl.lastCall().args[0], item->layer()->GetIdentifier())
45+
const auto* call = _sessionState._commandHookImpl.lastCallOf("addAnonymousSubLayer");
46+
ASSERT_NE(call, nullptr) << "addAnonymousSubLayer should have been called";
47+
EXPECT_EQ(call->args[0], item->layer()->GetIdentifier())
4748
<< "addAnonymousSubLayer should target the selected layer";
4849
}
4950

test/lib/usdLayerEditor/cpp/testEFModeLogic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ TEST_F(LayerEditorWithEFFixture, EFMode_Button_Tooltip)
107107

108108
// updateButtons() sets the button stylesheet to reflect EF active state.
109109
// The icon switches between ef_default (off) and ef_on (on) via background-image.
110-
// Runs for both editors when EF is compiled in (WANT_ADSK_USD_EDIT_FORWARD_BUILD).
111-
#ifdef WANT_ADSK_USD_EDIT_FORWARD_BUILD
110+
// New editor only: the old editor lacks the editForwardingChanged→updateButtons connection.
111+
#if defined(WANT_ADSK_USD_EDIT_FORWARD_BUILD) && !defined(MAYAUSD_OLD_LAYER_EDITOR)
112112
TEST_F(LayerEditorWithEFFixture, EFMode_Button_IconReflectsActiveState)
113113
{
114114
QPushButton* btn = TestUtils::findButtonByObjectName(_widget, "LayerEditorToggleEFButton");

0 commit comments

Comments
 (0)