Skip to content

Commit 10f7cf1

Browse files
seando-adskclaude
andauthored
Merge pull request #4655 from Autodesk/bailp/EMSUSD-3823/layer-display-refresh
EMSUSD-3823 fix layer content refresh`ImportChaser` pluginsis no…both unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> tree has not changed. Before this optimization , any change to data in the layer, for example moving a prim, would trigger a full tree model rebuild, which indirectly emitted a selection change signal. Fix: - Add a specific signal when data change. - Now, when the model receives a layer data change signal, it tells the model-rebuild function that it is being called due to internal layer data change. - The model rebuilding emit the new signal. - This reuse the on-idle behavior to limit signal traffic, avoiding emitting the signal constantly. - Make the layer editor widget listen to this signal and update the contents. E----- Merge pull request #4654 from Autodesk/derlerk/EMSUSD-3762 EMSUSD-3762 - RenderSetup undo/redof `ExportChaser` and `ImportChaser` pluginsis no…both unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> <noreply@anthropic.com> opic.com>
2 parents e65f86f + a65e756 commit 10f7cf1

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

lib/usd/ui/layerEditor/layerEditorWidget.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ QLayout* LayerEditorWidget::setupLayout_toolbar()
145145
this,
146146
&LayerEditorWidget::onLazyUpdateLayerContents);
147147

148+
// update layer contents widget on selected layer data change
149+
connect(
150+
_treeView->layerTreeModel(),
151+
&LayerTreeModel::selectedLayerDataChangedSignal,
152+
this,
153+
&LayerEditorWidget::onLazyUpdateLayerContents);
154+
148155
_buttons._loadLayer = addHIGButton(
149156
":/UsdLayerEditor/import_layer",
150157
StringResources::getAsQString(StringResources::kLoadExistingLayer),

lib/usd/ui/layerEditor/layerTreeModel.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,12 @@ void LayerTreeModel::setSessionState(SessionState* in_sessionState)
294294
this,
295295
&LayerTreeModel::autoHideSessionLayerChanged);
296296

297-
rebuildModelOnIdle();
297+
rebuildModelOnIdle(true);
298298
}
299299

300-
void LayerTreeModel::rebuildModelOnIdle()
300+
void LayerTreeModel::rebuildModelOnIdle(bool dataChanged)
301301
{
302+
_selectedLayerDataChanged |= dataChanged;
302303
if (!_rebuildOnIdlePending) {
303304
_rebuildOnIdlePending = true;
304305
QTimer::singleShot(0, this, [this]() {
@@ -313,6 +314,11 @@ void LayerTreeModel::rebuildModel(bool refreshLockState /*= false*/)
313314
_rebuildOnIdlePending = false;
314315
_lastAskedAnonLayerNameSinceRebuild = 0;
315316

317+
if (_selectedLayerDataChanged) {
318+
Q_EMIT selectedLayerDataChangedSignal();
319+
_selectedLayerDataChanged = false;
320+
}
321+
316322
if (!_sessionState->isValid()) {
317323
if (rowCount() > 0) {
318324
// Note: clear() calls beginResetModel and endResetModel for us.
@@ -472,7 +478,7 @@ void LayerTreeModel::usd_layerChanged(SdfNotice::LayersDidChangeSentPerLayer con
472478
{
473479
// experienced crashes in python prototype For now, rebuild everything
474480
if (!_blockUsdNotices)
475-
rebuildModelOnIdle();
481+
rebuildModelOnIdle(true);
476482
}
477483

478484
// notification from USD

lib/usd/ui/layerEditor/layerTreeModel.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class LayerTreeModel
124124

125125
Q_SIGNALS:
126126
void selectLayerSignal(const QModelIndex&);
127+
void selectedLayerDataChangedSignal();
127128

128129
protected:
129130
// slots
@@ -149,8 +150,9 @@ class LayerTreeModel
149150

150151
mutable int _lastAskedAnonLayerNameSinceRebuild = 0;
151152

152-
void rebuildModelOnIdle();
153+
void rebuildModelOnIdle(bool dataChanged = false);
153154
bool _rebuildOnIdlePending = false;
155+
bool _selectedLayerDataChanged = false;
154156
void rebuildModel(bool refreshLockState = false);
155157

156158
void updateTargetLayer(InRebuildModel inRebuild);

0 commit comments

Comments
 (0)