mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
added ability to unset delete flags by item ids
This commit is contained in:
parent
c1a8d59ad1
commit
15a15336b6
1 changed files with 27 additions and 0 deletions
|
|
@ -430,6 +430,33 @@ class HierarchyModel(QtCore.QAbstractItemModel):
|
|||
return result[0]
|
||||
return None
|
||||
|
||||
def remove_delete_flag(self, item_ids):
|
||||
remove_tag_items_by_id = {}
|
||||
for item_id in item_ids:
|
||||
item = self.items_by_id[item_id]
|
||||
if not isinstance(item, (AssetItem, TaskItem)):
|
||||
continue
|
||||
|
||||
if item.data(None, REMOVED_ROLE):
|
||||
remove_tag_items_by_id[item_id] = item
|
||||
|
||||
for item in remove_tag_items_by_id.values():
|
||||
parent = item.parent()
|
||||
while True:
|
||||
if not isinstance(parent, (AssetItem, TaskItem)):
|
||||
break
|
||||
|
||||
if parent.id in remove_tag_items_by_id:
|
||||
continue
|
||||
|
||||
if parent.data(None, REMOVED_ROLE):
|
||||
remove_tag_items_by_id[parent.id] = parent
|
||||
|
||||
parent = parent.parent()
|
||||
|
||||
for item in remove_tag_items_by_id.values():
|
||||
item.setData(None, False, REMOVED_ROLE)
|
||||
|
||||
def remove_index(self, index):
|
||||
return self.remove_indexes([index])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue