mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #3677 from pypeclub/feature/OP-3733_Ftrack-set-version-status-on-integration
Ftrack: Store ftrack entities on hierarchy integration to instances
This commit is contained in:
commit
7a1d161ab4
5 changed files with 27 additions and 33 deletions
|
|
@ -13,6 +13,7 @@ Provides:
|
|||
import os
|
||||
import sys
|
||||
import collections
|
||||
|
||||
import six
|
||||
import pyblish.api
|
||||
import clique
|
||||
|
|
@ -21,7 +22,7 @@ import clique
|
|||
class IntegrateFtrackApi(pyblish.api.InstancePlugin):
|
||||
""" Commit components to server. """
|
||||
|
||||
order = pyblish.api.IntegratorOrder+0.499
|
||||
order = pyblish.api.IntegratorOrder + 0.499
|
||||
label = "Integrate Ftrack Api"
|
||||
families = ["ftrack"]
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
|
|||
"reference": "reference"
|
||||
}
|
||||
keep_first_subset_name_for_review = True
|
||||
asset_versions_status_profiles = {}
|
||||
asset_versions_status_profiles = []
|
||||
additional_metadata_keys = []
|
||||
|
||||
def process(self, instance):
|
||||
|
|
|
|||
|
|
@ -156,8 +156,14 @@ class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin):
|
|||
# CUSTOM ATTRIBUTES
|
||||
custom_attributes = entity_data.get('custom_attributes', [])
|
||||
instances = [
|
||||
i for i in self.context if i.data['asset'] in entity['name']
|
||||
instance
|
||||
for instance in self.context
|
||||
if instance.data.get("asset") == entity["name"]
|
||||
]
|
||||
|
||||
for instance in instances:
|
||||
instance.data["ftrackEntity"] = entity
|
||||
|
||||
for key in custom_attributes:
|
||||
hier_attr = hier_attr_by_key.get(key)
|
||||
# Use simple method if key is not hierarchical
|
||||
|
|
@ -187,9 +193,6 @@ class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin):
|
|||
)
|
||||
)
|
||||
|
||||
for instance in instances:
|
||||
instance.data['ftrackEntity'] = entity
|
||||
|
||||
try:
|
||||
self.session.commit()
|
||||
except Exception:
|
||||
|
|
@ -199,13 +202,22 @@ class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin):
|
|||
six.reraise(tp, value, tb)
|
||||
|
||||
# TASKS
|
||||
instances_by_task_name = collections.defaultdict(list)
|
||||
for instance in instances:
|
||||
task_name = instance.data.get("task")
|
||||
if task_name:
|
||||
instances_by_task_name[task_name].append(instance)
|
||||
|
||||
tasks = entity_data.get('tasks', [])
|
||||
existing_tasks = []
|
||||
tasks_to_create = []
|
||||
for child in entity['children']:
|
||||
if child.entity_type.lower() == 'task':
|
||||
existing_tasks.append(child['name'].lower())
|
||||
# existing_tasks.append(child['type']['name'])
|
||||
if child.entity_type.lower() == "task":
|
||||
task_name_low = child["name"].lower()
|
||||
existing_tasks.append(task_name_low)
|
||||
|
||||
for instance in instances_by_task_name[task_name_low]:
|
||||
instance["ftrackTask"] = child
|
||||
|
||||
for task_name in tasks:
|
||||
task_type = tasks[task_name]["type"]
|
||||
|
|
@ -215,12 +227,15 @@ class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin):
|
|||
tasks_to_create.append((task_name, task_type))
|
||||
|
||||
for task_name, task_type in tasks_to_create:
|
||||
self.create_task(
|
||||
task_entity = self.create_task(
|
||||
name=task_name,
|
||||
task_type=task_type,
|
||||
parent=entity
|
||||
)
|
||||
|
||||
for instance in instances_by_task_name[task_name.lower()]:
|
||||
instance.data["ftrackTask"] = task_entity
|
||||
|
||||
# Incoming links.
|
||||
self.create_links(project_name, entity_data, entity)
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -96,10 +96,6 @@
|
|||
"mapping": {},
|
||||
"asset_types_to_skip": []
|
||||
},
|
||||
"first_version_status": {
|
||||
"enabled": true,
|
||||
"status": ""
|
||||
},
|
||||
"next_task_update": {
|
||||
"enabled": true,
|
||||
"mapping": {
|
||||
|
|
|
|||
|
|
@ -299,24 +299,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"key": "first_version_status",
|
||||
"label": "Set status on first created version",
|
||||
"checkbox_key": "enabled",
|
||||
"children": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "enabled",
|
||||
"label": "Enabled"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "status",
|
||||
"label": "Status"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"key": "next_task_update",
|
||||
|
|
@ -986,7 +968,7 @@
|
|||
{
|
||||
"type": "dict",
|
||||
"key": "IntegrateFtrackInstance",
|
||||
"label": "IntegrateFtrackInstance",
|
||||
"label": "Integrate Ftrack Instance",
|
||||
"is_group": true,
|
||||
"children": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue