mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added task tags data to product
This commit is contained in:
parent
84bc798458
commit
da6bc0b728
1 changed files with 19 additions and 1 deletions
|
|
@ -41,7 +41,8 @@ SYNC_ACTIVE_SITE_AVAILABILITY = QtCore.Qt.UserRole + 30
|
|||
SYNC_REMOTE_SITE_AVAILABILITY = QtCore.Qt.UserRole + 31
|
||||
|
||||
STATUS_NAME_FILTER_ROLE = QtCore.Qt.UserRole + 32
|
||||
VERSION_TAGS_FILTER_ROLE = QtCore.Qt.UserRole + 33
|
||||
TASK_TAGS_FILTER_ROLE = QtCore.Qt.UserRole + 33
|
||||
VERSION_TAGS_FILTER_ROLE = QtCore.Qt.UserRole + 34
|
||||
|
||||
|
||||
class ProductsModel(QtGui.QStandardItemModel):
|
||||
|
|
@ -131,6 +132,7 @@ class ProductsModel(QtGui.QStandardItemModel):
|
|||
self._last_folder_ids = []
|
||||
self._last_project_statuses = {}
|
||||
self._last_status_icons_by_name = {}
|
||||
self._last_task_tags_by_task_id = {}
|
||||
|
||||
def get_product_item_indexes(self):
|
||||
return [
|
||||
|
|
@ -424,8 +426,14 @@ class ProductsModel(QtGui.QStandardItemModel):
|
|||
for version_item in product_item.version_items.values()
|
||||
}
|
||||
version_tags = set()
|
||||
task_tags = set()
|
||||
for version_item in product_item.version_items.values():
|
||||
version_tags |= set(version_item.tags)
|
||||
_task_tags = self._last_task_tags_by_task_id.get(
|
||||
version_item.task_id
|
||||
)
|
||||
if _task_tags:
|
||||
task_tags |= set(_task_tags)
|
||||
|
||||
if model_item is None:
|
||||
product_id = product_item.product_id
|
||||
|
|
@ -446,6 +454,7 @@ class ProductsModel(QtGui.QStandardItemModel):
|
|||
|
||||
model_item.setData("|".join(statuses), STATUS_NAME_FILTER_ROLE)
|
||||
model_item.setData("|".join(version_tags), VERSION_TAGS_FILTER_ROLE)
|
||||
model_item.setData("|".join(task_tags), TASK_TAGS_FILTER_ROLE)
|
||||
model_item.setData(product_item.folder_label, FOLDER_LABEL_ROLE)
|
||||
in_scene = 1 if product_item.product_in_scene else 0
|
||||
model_item.setData(in_scene, PRODUCT_IN_SCENE_ROLE)
|
||||
|
|
@ -476,6 +485,14 @@ class ProductsModel(QtGui.QStandardItemModel):
|
|||
}
|
||||
self._last_status_icons_by_name = {}
|
||||
|
||||
task_items = self._controller.get_task_items(
|
||||
project_name, folder_ids, sender=PRODUCTS_MODEL_SENDER_NAME
|
||||
)
|
||||
self._last_task_tags_by_task_id = {
|
||||
task_item.task_id: task_item.tags
|
||||
for task_item in task_items
|
||||
}
|
||||
|
||||
active_site_icon_def = self._controller.get_active_site_icon_def(
|
||||
project_name
|
||||
)
|
||||
|
|
@ -490,6 +507,7 @@ class ProductsModel(QtGui.QStandardItemModel):
|
|||
folder_ids,
|
||||
sender=PRODUCTS_MODEL_SENDER_NAME
|
||||
)
|
||||
|
||||
product_items_by_id = {
|
||||
product_item.product_id: product_item
|
||||
for product_item in product_items
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue