ftrack: simplification of logic

This commit is contained in:
Jakub Jezek 2022-04-04 12:21:17 +02:00
parent c9edd81e17
commit c32b0ec770
No known key found for this signature in database
GPG key ID: D8548FBF690B100A

View file

@ -169,7 +169,8 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
# Change asset name of each new component for review
is_first_review_repre = True
not_first_components = []
extended_asset_name = False
extended_asset_name = ""
multiple_reviewable = len(review_representations) > 1
for repre in review_representations:
# Create copy of base comp item and append it
review_item = copy.deepcopy(base_component_item)
@ -178,8 +179,7 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
# expand name to better label componenst
if (
not self.keep_first_subset_name_for_review
and is_first_review_repre
and len(review_representations) > 1
and multiple_reviewable
):
asset_name = review_item["asset_data"]["name"]
# define new extended name
@ -187,18 +187,21 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
(asset_name, repre["name"])
)
review_item["asset_data"]["name"] = extended_asset_name
# and rename all already created components
for _ci in component_list:
_ci["asset_data"]["name"] = extended_asset_name
# and rename all already created src components
for _sci in src_components_to_add:
_sci["asset_data"]["name"] = extended_asset_name
# rename asset name only if multiple reviewable repre
if is_first_review_repre:
# and rename all already created components
for _ci in component_list:
_ci["asset_data"]["name"] = extended_asset_name
# rename also first thumbnail component if any
if first_thumbnail_component is not None:
first_thumbnail_component[
"asset_data"]["name"] = extended_asset_name
# and rename all already created src components
for _sci in src_components_to_add:
_sci["asset_data"]["name"] = extended_asset_name
# rename also first thumbnail component if any
if first_thumbnail_component is not None:
first_thumbnail_component[
"asset_data"]["name"] = extended_asset_name
frame_start = repre.get("frameStartFtrack")
frame_end = repre.get("frameEndFtrack")
@ -230,15 +233,9 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
}
}
# rename asset name only if multiple reviewable repre
if is_first_review_repre:
is_first_review_repre = False
else:
# Add representation name to asset name of "not first" review
asset_name = review_item["asset_data"]["name"]
review_item["asset_data"]["name"] = "_".join(
(asset_name, repre["name"])
)
not_first_components.append(review_item)
# Create copy of item before setting location
@ -283,10 +280,7 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
other_item = copy.deepcopy(base_component_item)
# add extended name if any
if (
not self.keep_first_subset_name_for_review
and extended_asset_name is not False
):
if extended_asset_name:
other_item["asset_data"]["name"] = extended_asset_name
other_item["component_data"] = {