mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
fix label calculation
This commit is contained in:
parent
d060244d49
commit
722b3a5d63
1 changed files with 14 additions and 11 deletions
|
|
@ -64,8 +64,7 @@ class IntegrateAYONReview(pyblish.api.InstancePlugin):
|
|||
self.log.warning("Could not determine Content-Type")
|
||||
continue
|
||||
|
||||
# Use output name as label if available
|
||||
label = repre.get("outputName")
|
||||
label = self._get_review_label(repre, uploaded_labels)
|
||||
query = ""
|
||||
if label:
|
||||
query = f"?label={label}"
|
||||
|
|
@ -74,14 +73,6 @@ class IntegrateAYONReview(pyblish.api.InstancePlugin):
|
|||
f"/projects/{project_name}"
|
||||
f"/versions/{version_id}/reviewables{query}"
|
||||
)
|
||||
# Make sure label is unique
|
||||
orig_label = label
|
||||
idx = 0
|
||||
while label in uploaded_labels:
|
||||
idx += 1
|
||||
label = f"{orig_label}_{idx}"
|
||||
|
||||
uploaded_labels.add(label)
|
||||
|
||||
# Upload the reviewable
|
||||
self.log.info(f"Uploading reviewable '{label}' ...")
|
||||
|
|
@ -94,4 +85,16 @@ class IntegrateAYONReview(pyblish.api.InstancePlugin):
|
|||
repre_path,
|
||||
headers=headers,
|
||||
request_type=RequestTypes.post,
|
||||
)
|
||||
)
|
||||
|
||||
def _get_review_label(self, repre, uploaded_labels):
|
||||
# Use output name as label if available
|
||||
label = repre.get("outputName")
|
||||
if not label:
|
||||
return None
|
||||
orig_label = label
|
||||
idx = 0
|
||||
while label in uploaded_labels:
|
||||
idx += 1
|
||||
label = f"{orig_label}_{idx}"
|
||||
return label
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue