Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1374 from tokejepsen/2.x/feature/ftrack_multiple_…
Browse files Browse the repository at this point in the history
…reviews
  • Loading branch information
mkolar authored Nov 30, 2021
2 parents 79049ac + 7a0255c commit 08e0ae5
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion pype/plugins/ftrack/publish/integrate_ftrack_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def process(self, instance):
componentList = []
ft_session = instance.context.data["ftrackSession"]

review_representations = []
for comp in instance.data['representations']:
self.log.debug('component {}'.format(comp))

Expand Down Expand Up @@ -119,6 +120,8 @@ def process(self, instance):
'frameRate': float(comp['fps'])})}
}
comp['thumbnail'] = False

review_representations.append(comp)
else:
component_data = {
"name": comp['name']
Expand Down Expand Up @@ -162,6 +165,7 @@ def process(self, instance):
)

componentList.append(component_item)

# Create copy with ftrack.unmanaged location if thumb or prev
if comp.get('thumbnail') or comp.get('preview') \
or ("preview" in comp.get('tags', [])) \
Expand Down Expand Up @@ -194,7 +198,41 @@ def process(self, instance):

componentList.append(component_item_src)

self.log.debug('componentsList: {}'.format(str(componentList)))
if len(review_representations) > 1:
review_components = []
for representation in review_representations:
for component in componentList:
# Filter out unwanted ftrack review components, else each
# asset version will have all the review components.
component_name = component["component_data"]["name"]
component_path = component["component_path"]
if component_name.startswith("ftrackreview"):
if component_path != representation["published_path"]:
continue

data = component.copy()
data["asset_data"] = {
"name": (
instance.data["subset"] +
representation["name"].title()
)
}

review_components.append(data)

componentList = review_components

serializable_data = []
for component in componentList:
data = dict(component)
data.pop("component_location")
serializable_data.append(data)
self.log.debug(
"componentsList: {}".format(
json.dumps(serializable_data, sort_keys=True, indent=4)
)
)

instance.data["ftrackComponentsList"] = componentList

def get_ftrack_location(self, name, session):
Expand Down

0 comments on commit 08e0ae5

Please sign in to comment.