mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Merge branch 'develop' into enhancement/AY-6945_fix_single_frame_render_job_publish
This commit is contained in:
commit
e23ca3f0d1
6 changed files with 111 additions and 23 deletions
|
|
@ -3,11 +3,20 @@ import os
|
||||||
import copy
|
import copy
|
||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import clique
|
|
||||||
import collections
|
import collections
|
||||||
|
from typing import Dict, Any, Iterable
|
||||||
|
|
||||||
|
import clique
|
||||||
|
import ayon_api
|
||||||
|
|
||||||
from ayon_core.lib import create_hard_link
|
from ayon_core.lib import create_hard_link
|
||||||
|
|
||||||
|
from .template_data import (
|
||||||
|
get_general_template_data,
|
||||||
|
get_folder_template_data,
|
||||||
|
get_task_template_data,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _copy_file(src_path, dst_path):
|
def _copy_file(src_path, dst_path):
|
||||||
"""Hardlink file if possible(to save space), copy if not.
|
"""Hardlink file if possible(to save space), copy if not.
|
||||||
|
|
@ -327,3 +336,71 @@ def deliver_sequence(
|
||||||
uploaded += 1
|
uploaded += 1
|
||||||
|
|
||||||
return report_items, uploaded
|
return report_items, uploaded
|
||||||
|
|
||||||
|
|
||||||
|
def _merge_data(data, new_data):
|
||||||
|
queue = collections.deque()
|
||||||
|
queue.append((data, new_data))
|
||||||
|
while queue:
|
||||||
|
q_data, q_new_data = queue.popleft()
|
||||||
|
for key, value in q_new_data.items():
|
||||||
|
if key in q_data and isinstance(value, dict):
|
||||||
|
queue.append((q_data[key], value))
|
||||||
|
continue
|
||||||
|
q_data[key] = value
|
||||||
|
|
||||||
|
|
||||||
|
def get_representations_delivery_template_data(
|
||||||
|
project_name: str,
|
||||||
|
representation_ids: Iterable[str],
|
||||||
|
) -> Dict[str, Dict[str, Any]]:
|
||||||
|
representation_ids = set(representation_ids)
|
||||||
|
|
||||||
|
output = {
|
||||||
|
repre_id: {}
|
||||||
|
for repre_id in representation_ids
|
||||||
|
}
|
||||||
|
if not representation_ids:
|
||||||
|
return output
|
||||||
|
|
||||||
|
project_entity = ayon_api.get_project(project_name)
|
||||||
|
|
||||||
|
general_template_data = get_general_template_data()
|
||||||
|
|
||||||
|
repres_hierarchy = ayon_api.get_representations_hierarchy(
|
||||||
|
project_name,
|
||||||
|
representation_ids,
|
||||||
|
project_fields=set(),
|
||||||
|
folder_fields={"path", "folderType"},
|
||||||
|
task_fields={"name", "taskType"},
|
||||||
|
product_fields={"name", "productType"},
|
||||||
|
version_fields={"version", "productId"},
|
||||||
|
representation_fields=None,
|
||||||
|
)
|
||||||
|
for repre_id, repre_hierarchy in repres_hierarchy.items():
|
||||||
|
repre_entity = repre_hierarchy.representation
|
||||||
|
if repre_entity is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
template_data = repre_entity["context"]
|
||||||
|
template_data.update(copy.deepcopy(general_template_data))
|
||||||
|
template_data.update(get_folder_template_data(
|
||||||
|
repre_hierarchy.folder, project_name
|
||||||
|
))
|
||||||
|
if repre_hierarchy.task:
|
||||||
|
template_data.update(get_task_template_data(
|
||||||
|
project_entity, repre_hierarchy.task
|
||||||
|
))
|
||||||
|
|
||||||
|
product_entity = repre_hierarchy.product
|
||||||
|
version_entity = repre_hierarchy.version
|
||||||
|
template_data.update({
|
||||||
|
"product": {
|
||||||
|
"name": product_entity["name"],
|
||||||
|
"type": product_entity["productType"],
|
||||||
|
},
|
||||||
|
"version": version_entity["version"],
|
||||||
|
})
|
||||||
|
_merge_data(template_data, repre_entity["context"])
|
||||||
|
output[repre_id] = template_data
|
||||||
|
return output
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
import copy
|
|
||||||
import platform
|
import platform
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import ayon_api
|
import ayon_api
|
||||||
from qtpy import QtWidgets, QtCore, QtGui
|
from qtpy import QtWidgets, QtCore, QtGui
|
||||||
|
|
||||||
from ayon_core.pipeline import load, Anatomy
|
|
||||||
from ayon_core import resources, style
|
from ayon_core import resources, style
|
||||||
|
|
||||||
from ayon_core.lib import (
|
from ayon_core.lib import (
|
||||||
format_file_size,
|
format_file_size,
|
||||||
collect_frames,
|
collect_frames,
|
||||||
get_datetime_data,
|
get_datetime_data,
|
||||||
)
|
)
|
||||||
|
from ayon_core.pipeline import load, Anatomy
|
||||||
from ayon_core.pipeline.load import get_representation_path_with_anatomy
|
from ayon_core.pipeline.load import get_representation_path_with_anatomy
|
||||||
from ayon_core.pipeline.delivery import (
|
from ayon_core.pipeline.delivery import (
|
||||||
get_format_dict,
|
get_format_dict,
|
||||||
check_destination_path,
|
check_destination_path,
|
||||||
deliver_single_file
|
deliver_single_file,
|
||||||
|
get_representations_delivery_template_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -200,20 +199,31 @@ class DeliveryOptionsDialog(QtWidgets.QDialog):
|
||||||
format_dict = get_format_dict(self.anatomy, self.root_line_edit.text())
|
format_dict = get_format_dict(self.anatomy, self.root_line_edit.text())
|
||||||
renumber_frame = self.renumber_frame.isChecked()
|
renumber_frame = self.renumber_frame.isChecked()
|
||||||
frame_offset = self.first_frame_start.value()
|
frame_offset = self.first_frame_start.value()
|
||||||
|
filtered_repres = []
|
||||||
|
repre_ids = set()
|
||||||
for repre in self._representations:
|
for repre in self._representations:
|
||||||
if repre["name"] not in selected_repres:
|
if repre["name"] in selected_repres:
|
||||||
continue
|
filtered_repres.append(repre)
|
||||||
|
repre_ids.add(repre["id"])
|
||||||
|
|
||||||
|
template_data_by_repre_id = (
|
||||||
|
get_representations_delivery_template_data(
|
||||||
|
self.anatomy.project_name, repre_ids
|
||||||
|
)
|
||||||
|
)
|
||||||
|
for repre in filtered_repres:
|
||||||
repre_path = get_representation_path_with_anatomy(
|
repre_path = get_representation_path_with_anatomy(
|
||||||
repre, self.anatomy
|
repre, self.anatomy
|
||||||
)
|
)
|
||||||
|
|
||||||
anatomy_data = copy.deepcopy(repre["context"])
|
template_data = template_data_by_repre_id[repre["id"]]
|
||||||
new_report_items = check_destination_path(repre["id"],
|
new_report_items = check_destination_path(
|
||||||
self.anatomy,
|
repre["id"],
|
||||||
anatomy_data,
|
self.anatomy,
|
||||||
datetime_data,
|
template_data,
|
||||||
template_name)
|
datetime_data,
|
||||||
|
template_name
|
||||||
|
)
|
||||||
|
|
||||||
report_items.update(new_report_items)
|
report_items.update(new_report_items)
|
||||||
if new_report_items:
|
if new_report_items:
|
||||||
|
|
@ -224,7 +234,7 @@ class DeliveryOptionsDialog(QtWidgets.QDialog):
|
||||||
repre,
|
repre,
|
||||||
self.anatomy,
|
self.anatomy,
|
||||||
template_name,
|
template_name,
|
||||||
anatomy_data,
|
template_data,
|
||||||
format_dict,
|
format_dict,
|
||||||
report_items,
|
report_items,
|
||||||
self.log
|
self.log
|
||||||
|
|
@ -267,9 +277,9 @@ class DeliveryOptionsDialog(QtWidgets.QDialog):
|
||||||
|
|
||||||
if frame is not None:
|
if frame is not None:
|
||||||
if repre["context"].get("frame"):
|
if repre["context"].get("frame"):
|
||||||
anatomy_data["frame"] = frame
|
template_data["frame"] = frame
|
||||||
elif repre["context"].get("udim"):
|
elif repre["context"].get("udim"):
|
||||||
anatomy_data["udim"] = frame
|
template_data["udim"] = frame
|
||||||
else:
|
else:
|
||||||
# Fallback
|
# Fallback
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
|
|
@ -277,7 +287,7 @@ class DeliveryOptionsDialog(QtWidgets.QDialog):
|
||||||
" data. Supplying sequence frame to '{frame}'"
|
" data. Supplying sequence frame to '{frame}'"
|
||||||
" formatting data."
|
" formatting data."
|
||||||
)
|
)
|
||||||
anatomy_data["frame"] = frame
|
template_data["frame"] = frame
|
||||||
new_report_items, uploaded = deliver_single_file(*args)
|
new_report_items, uploaded = deliver_single_file(*args)
|
||||||
report_items.update(new_report_items)
|
report_items.update(new_report_items)
|
||||||
self._update_progress(uploaded)
|
self._update_progress(uploaded)
|
||||||
|
|
@ -342,8 +352,8 @@ class DeliveryOptionsDialog(QtWidgets.QDialog):
|
||||||
def _get_selected_repres(self):
|
def _get_selected_repres(self):
|
||||||
"""Returns list of representation names filtered from checkboxes."""
|
"""Returns list of representation names filtered from checkboxes."""
|
||||||
selected_repres = []
|
selected_repres = []
|
||||||
for repre_name, chckbox in self._representation_checkboxes.items():
|
for repre_name, checkbox in self._representation_checkboxes.items():
|
||||||
if chckbox.isChecked():
|
if checkbox.isChecked():
|
||||||
selected_repres.append(repre_name)
|
selected_repres.append(repre_name)
|
||||||
|
|
||||||
return selected_repres
|
return selected_repres
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
||||||
"traypublisher",
|
"traypublisher",
|
||||||
"substancepainter",
|
"substancepainter",
|
||||||
"nuke",
|
"nuke",
|
||||||
"aftereffects"
|
"aftereffects",
|
||||||
|
"unreal"
|
||||||
]
|
]
|
||||||
enabled = False
|
enabled = False
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Package declaring AYON addon 'core' version."""
|
"""Package declaring AYON addon 'core' version."""
|
||||||
__version__ = "1.0.1+dev"
|
__version__ = "1.0.2+dev"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
name = "core"
|
name = "core"
|
||||||
title = "Core"
|
title = "Core"
|
||||||
version = "1.0.1+dev"
|
version = "1.0.2+dev"
|
||||||
|
|
||||||
client_dir = "ayon_core"
|
client_dir = "ayon_core"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ayon-core"
|
name = "ayon-core"
|
||||||
version = "1.0.1+dev"
|
version = "1.0.2+dev"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Ynput Team <team@ynput.io>"]
|
authors = ["Ynput Team <team@ynput.io>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue