Skip to content

Commit

Permalink
Fix issues when active layer change is emitted before the layer is pa…
Browse files Browse the repository at this point in the history
…rt of the node tree #1475
  • Loading branch information
Acly committed Dec 13, 2024
1 parent 5680232 commit f218925
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ai_diffusion/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,6 @@ def update(self):
return

with self._update_guard():
if active.uniqueId() != self._active_id:
self._active_id = active.uniqueId()
self.active_changed.emit()

removals = set(self._layers.keys())
changes = False
for n in traverse_layers(root_node):
Expand All @@ -408,6 +404,11 @@ def update(self):
self.removed.emit(self._layers[id])
del self._layers[id]

active_id = active.uniqueId()
if active_id != self._active_id and active_id in self._layers:
self._active_id = active_id
self.active_changed.emit()

if removals or changes:
self.changed.emit()

Expand Down

0 comments on commit f218925

Please sign in to comment.