From 7c19f1aa4545bcf16dbdcfa27a1061405e95a3ac Mon Sep 17 00:00:00 2001 From: Aleks Berland Date: Thu, 30 Oct 2025 16:37:18 -0400 Subject: [PATCH] Refactored outdated item collection in InventoryModel - Removed unnecessary loops for checking group items and hero items. - Simplified the collection of outdated container IDs from the full hierarchy. - Added filtering to exclude None values from the returned list of outdated item IDs. --- client/ayon_core/tools/sceneinventory/model.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/client/ayon_core/tools/sceneinventory/model.py b/client/ayon_core/tools/sceneinventory/model.py index cfc652f776..6d7556fe9c 100644 --- a/client/ayon_core/tools/sceneinventory/model.py +++ b/client/ayon_core/tools/sceneinventory/model.py @@ -453,21 +453,10 @@ class InventoryModel(QtGui.QStandardItemModel): collect_outdated_from_item(item) root_item = self.invisibleRootItem() - for row in range(root_item.rowCount()): - group_item = root_item.child(row) - if group_item.data(VERSION_IS_LATEST_ROLE): - continue - - if ignore_hero and group_item.data(VERSION_IS_HERO_ROLE): - continue - - for idx in range(group_item.rowCount()): - item = group_item.child(idx) - outdated_item_ids.append(item.data(ITEM_ID_ROLE)) - - # Now collect outdated from the flat structure + # Collect outdated container ids from the full hierarchy collect_outdated_from_item(root_item) - return outdated_item_ids + # Filter out any None values (e.g. from non-container rows) + return [item_id for item_id in outdated_item_ids if item_id] def _clear_items(self): root_item = self.invisibleRootItem()