mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
fix remove_delete_flag method
This commit is contained in:
parent
40ac5afb28
commit
85f0117bec
1 changed files with 14 additions and 2 deletions
|
|
@ -430,7 +430,7 @@ class HierarchyModel(QtCore.QAbstractItemModel):
|
|||
return result[0]
|
||||
return None
|
||||
|
||||
def remove_delete_flag(self, item_ids):
|
||||
def remove_delete_flag(self, item_ids, with_children=True):
|
||||
remove_tag_items_by_id = {}
|
||||
for item_id in item_ids:
|
||||
item = self.items_by_id[item_id]
|
||||
|
|
@ -440,7 +440,7 @@ class HierarchyModel(QtCore.QAbstractItemModel):
|
|||
if item.data(None, REMOVED_ROLE):
|
||||
remove_tag_items_by_id[item_id] = item
|
||||
|
||||
for item in remove_tag_items_by_id.values():
|
||||
for item in tuple(remove_tag_items_by_id.values()):
|
||||
parent = item.parent()
|
||||
while True:
|
||||
if not isinstance(parent, (AssetItem, TaskItem)):
|
||||
|
|
@ -454,6 +454,18 @@ class HierarchyModel(QtCore.QAbstractItemModel):
|
|||
|
||||
parent = parent.parent()
|
||||
|
||||
if not with_children:
|
||||
continue
|
||||
|
||||
def _children_recursion(_item, store_obj):
|
||||
if isinstance(_item, AssetItem):
|
||||
for row in range(_item.rowCount()):
|
||||
_child_item = _item.child(row)
|
||||
if _child_item.id not in store_obj:
|
||||
store_obj[_child_item.id] = _child_item
|
||||
_children_recursion(_child_item, store_obj)
|
||||
_children_recursion(item, remove_tag_items_by_id)
|
||||
|
||||
for item in remove_tag_items_by_id.values():
|
||||
item.setData(None, False, REMOVED_ROLE)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue