Skip to content

Commit 13f8029

Browse files
committed
Optimization for UsdMayaReferenceAssembly
Only activate a representation if it is not already the currently activated representation. This fixes unnecessary reloading of models that have their variant changed, especially noticeable in larger scenes with many variants being applied.
1 parent b4f1197 commit 13f8029

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

plugin/pxr/maya/lib/usdMaya/referenceAssembly.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,16 @@ bool UsdMayaReferenceAssembly::activateRep(const MString& repMStr)
375375
return true;
376376
}
377377

378+
bool UsdMayaReferenceAssembly::activate(const MString& repMStr)
379+
{
380+
// Early out if repMStr is already the active representation.
381+
if (getActive() == repMStr) {
382+
return true;
383+
}
384+
385+
return MPxAssembly::activate(repMStr);
386+
}
387+
378388
//
379389
// == Optional Function Overrides
380390
//

plugin/pxr/maya/lib/usdMaya/referenceAssembly.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ class UsdMayaReferenceAssembly
151151
MStatus setRepLabel(const MString& representation, const MString& label) override;
152152
PXRUSDMAYA_API
153153
bool activateRep(const MString& representation) override;
154-
154+
PXRUSDMAYA_API
155+
bool activate(const MString& representation) override;
156+
155157
// Optional overrides
156158
PXRUSDMAYA_API
157159
bool supportsEdits() const override { return true; };

0 commit comments

Comments
 (0)