Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add_pyblish_debug_stepper_to_expr…
Browse files Browse the repository at this point in the history
…imental_tools
  • Loading branch information
MustafaJafar authored Oct 2, 2024
2 parents cb98ef2 + 5142a07 commit 4d6f7d4
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 102 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release_trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 🚀 Release Trigger

on:
workflow_dispatch:

jobs:
call-release-trigger:
uses: ynput/ops-repo-automation/.github/workflows/release_trigger.yml@main
secrets:
token: ${{ secrets.YNPUT_BOT_TOKEN }}
email: ${{ secrets.CI_EMAIL }}
user: ${{ secrets.CI_USER }}
3 changes: 2 additions & 1 deletion client/ayon_core/hooks/pre_ocio_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class OCIOEnvHook(PreLaunchHook):
"nuke",
"hiero",
"resolve",
"openrv"
"openrv",
"cinema4d"
}
launch_types = set()

Expand Down
5 changes: 4 additions & 1 deletion client/ayon_core/lib/path_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def collect_frames(files):
dict: {'/folder/product_v001.0001.png': '0001', ....}
"""

patterns = [clique.PATTERNS["frames"]]
# clique.PATTERNS["frames"] supports only `.1001.exr` not `_1001.exr` so
# we use a customized pattern.
pattern = "[_.](?P<index>(?P<padding>0*)\\d+)\\.\\D+\\d?$"
patterns = [pattern]
collections, remainder = clique.assemble(
files, minimum_items=1, patterns=patterns)

Expand Down
2 changes: 0 additions & 2 deletions client/ayon_core/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
AVALON_INSTANCE_ID,
AYON_CONTAINER_ID,
AYON_INSTANCE_ID,
HOST_WORKFILE_EXTENSIONS,
)

from .anatomy import Anatomy
Expand Down Expand Up @@ -114,7 +113,6 @@
"AVALON_INSTANCE_ID",
"AYON_CONTAINER_ID",
"AYON_INSTANCE_ID",
"HOST_WORKFILE_EXTENSIONS",

# --- Anatomy ---
"Anatomy",
Expand Down
17 changes: 0 additions & 17 deletions client/ayon_core/pipeline/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,3 @@
# Backwards compatibility
AVALON_CONTAINER_ID = "pyblish.avalon.container"
AVALON_INSTANCE_ID = "pyblish.avalon.instance"

# TODO get extensions from host implementations
HOST_WORKFILE_EXTENSIONS = {
"blender": [".blend"],
"celaction": [".scn"],
"tvpaint": [".tvpp"],
"fusion": [".comp"],
"harmony": [".zip"],
"houdini": [".hip", ".hiplc", ".hipnc"],
"maya": [".ma", ".mb"],
"nuke": [".nk"],
"hiero": [".hrox"],
"photoshop": [".psd", ".psb"],
"premiere": [".prproj"],
"resolve": [".drp"],
"aftereffects": [".aep"]
}
5 changes: 5 additions & 0 deletions client/ayon_core/pipeline/farm/pyblish_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,11 @@ def _create_instances_for_aov(instance, skeleton, aov_filter, additional_data,
colorspace = product.colorspace
break

if isinstance(files, (list, tuple)):
files = [os.path.basename(f) for f in files]
else:
files = os.path.basename(files)

rep = {
"name": ext,
"ext": ext,
Expand Down
95 changes: 49 additions & 46 deletions client/ayon_core/plugins/load/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from ayon_core.pipeline.delivery import (
get_format_dict,
check_destination_path,
deliver_single_file,
deliver_sequence,
deliver_single_file
)


Expand Down Expand Up @@ -231,51 +230,55 @@ def deliver(self):
self.log
]

if repre.get("files"):
src_paths = []
for repre_file in repre["files"]:
src_path = self.anatomy.fill_root(repre_file["path"])
src_paths.append(src_path)
sources_and_frames = collect_frames(src_paths)

frames = set(sources_and_frames.values())
frames.discard(None)
first_frame = None
if frames:
first_frame = min(frames)

for src_path, frame in sources_and_frames.items():
args[0] = src_path
# Renumber frames
if renumber_frame and frame is not None:
# Calculate offset between
# first frame and current frame
# - '0' for first frame
offset = frame_offset - int(first_frame)
# Add offset to new frame start
dst_frame = int(frame) + offset
if dst_frame < 0:
msg = "Renumber frame has a smaller number than original frame" # noqa
report_items[msg].append(src_path)
self.log.warning("{} <{}>".format(
msg, dst_frame))
continue
frame = dst_frame

if frame is not None:
# TODO: This will currently incorrectly detect 'resources'
# that are published along with the publish, because those should
# not adhere to the template directly but are ingested in a
# customized way. For example, maya look textures or any publish
# that directly adds files into `instance.data["transfers"]`
src_paths = []
for repre_file in repre["files"]:
src_path = self.anatomy.fill_root(repre_file["path"])
src_paths.append(src_path)
sources_and_frames = collect_frames(src_paths)

frames = set(sources_and_frames.values())
frames.discard(None)
first_frame = None
if frames:
first_frame = min(frames)

for src_path, frame in sources_and_frames.items():
args[0] = src_path
# Renumber frames
if renumber_frame and frame is not None:
# Calculate offset between
# first frame and current frame
# - '0' for first frame
offset = frame_offset - int(first_frame)
# Add offset to new frame start
dst_frame = int(frame) + offset
if dst_frame < 0:
msg = "Renumber frame has a smaller number than original frame" # noqa
report_items[msg].append(src_path)
self.log.warning("{} <{}>".format(
msg, dst_frame))
continue
frame = dst_frame

if frame is not None:
if repre["context"].get("frame"):
anatomy_data["frame"] = frame
new_report_items, uploaded = deliver_single_file(*args)
report_items.update(new_report_items)
self._update_progress(uploaded)
else: # fallback for Pype2 and representations without files
frame = repre["context"].get("frame")
if frame:
repre["context"]["frame"] = len(str(frame)) * "#"

if not frame:
new_report_items, uploaded = deliver_single_file(*args)
else:
new_report_items, uploaded = deliver_sequence(*args)
elif repre["context"].get("udim"):
anatomy_data["udim"] = frame
else:
# Fallback
self.log.warning(
"Representation context has no frame or udim"
" data. Supplying sequence frame to '{frame}'"
" formatting data."
)
anatomy_data["frame"] = frame
new_report_items, uploaded = deliver_single_file(*args)
report_items.update(new_report_items)
self._update_progress(uploaded)

Expand Down
19 changes: 14 additions & 5 deletions client/ayon_core/plugins/publish/extract_color_transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,22 @@ def process(self, instance):
transcoding_type = output_def["transcoding_type"]

target_colorspace = view = display = None
# NOTE: we use colorspace_data as the fallback values for
# the target colorspace.
if transcoding_type == "colorspace":
# TODO: Should we fallback to the colorspace
# (which used as source above) ?
# or should we compute the target colorspace from
# current view and display ?
target_colorspace = (output_def["colorspace"] or
colorspace_data.get("colorspace"))
else:
view = output_def["view"] or colorspace_data.get("view")
display = (output_def["display"] or
colorspace_data.get("display"))
elif transcoding_type == "display_view":
display_view = output_def["display_view"]
view = display_view["view"] or colorspace_data.get("view")
display = (
display_view["display"]
or colorspace_data.get("display")
)

# both could be already collected by DCC,
# but could be overwritten when transcoding
Expand Down Expand Up @@ -192,7 +201,7 @@ def process(self, instance):
new_repre["files"] = new_repre["files"][0]

# If the source representation has "review" tag, but its not
# part of the output defintion tags, then both the
# part of the output definition tags, then both the
# representations will be transcoded in ExtractReview and
# their outputs will clash in integration.
if "review" in repre.get("tags", []):
Expand Down
7 changes: 5 additions & 2 deletions client/ayon_core/plugins/publish/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,11 @@ def _validate_repre_files(self, files, is_sequence_representation):
if not is_sequence_representation:
files = [files]

if any(os.path.isabs(fname) for fname in files):
raise KnownPublishError("Given file names contain full paths")
for fname in files:
if os.path.isabs(fname):
raise KnownPublishError(
f"Representation file names contains full paths: {fname}"
)

if not is_sequence_representation:
return
Expand Down
25 changes: 23 additions & 2 deletions client/ayon_core/plugins/publish/integrate_inputlinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@


class IntegrateInputLinksAYON(pyblish.api.ContextPlugin):
"""Connecting version level dependency links"""
"""Connecting version level dependency links
Handles links:
- generative - what gets produced from workfile
- reference - what was loaded into workfile
It expects workfile instance is being published.
"""

order = pyblish.api.IntegratorOrder + 0.2
label = "Connect Dependency InputLinks AYON"
Expand Down Expand Up @@ -47,6 +54,11 @@ def process(self, context):
self.create_links_on_server(context, new_links_by_type)

def split_instances(self, context):
"""Separates published instances into workfile and other
Returns:
(tuple(pyblish.plugin.Instance), list(pyblish.plugin.Instance))
"""
workfile_instance = None
other_instances = []

Expand Down Expand Up @@ -83,6 +95,15 @@ def add_link(self, new_links_by_type, link_type, input_id, output_id):
def create_workfile_links(
self, workfile_instance, other_instances, new_links_by_type
):
"""Adds links (generative and reference) for workfile.
Args:
workfile_instance (pyblish.plugin.Instance): published workfile
other_instances (list[pyblish.plugin.Instance]): other published
instances
new_links_by_type (dict[str, list[str]]): dictionary collecting new
created links by its type
"""
if workfile_instance is None:
self.log.warn("No workfile in this publish session.")
return
Expand All @@ -97,7 +118,7 @@ def create_workfile_links(
instance.data["versionEntity"]["id"],
)

loaded_versions = workfile_instance.context.get("loadedVersions")
loaded_versions = workfile_instance.context.data.get("loadedVersions")
if not loaded_versions:
return

Expand Down
3 changes: 2 additions & 1 deletion client/ayon_core/plugins/publish/validate_file_saved.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class ValidateCurrentSaveFile(pyblish.api.ContextPlugin):

label = "Validate File Saved"
order = pyblish.api.ValidatorOrder - 0.1
hosts = ["fusion", "houdini", "max", "maya", "nuke", "substancepainter"]
hosts = ["fusion", "houdini", "max", "maya", "nuke", "substancepainter",
"cinema4d"]
actions = [SaveByVersionUpAction, ShowWorkfilesAction]

def process(self, context):
Expand Down
21 changes: 11 additions & 10 deletions client/ayon_core/tools/loader/models/sitesync.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import collections

from ayon_api import get_representations, get_versions_links
from ayon_api import (
get_representations,
get_versions_links,
)

from ayon_core.lib import Logger, NestedCacheItem
from ayon_core.addon import AddonsManager
Expand Down Expand Up @@ -509,18 +512,19 @@ def _add_site(self, project_name, repre_entity, site_name, product_type):
"reference"
)
for link_repre_id in links:
try:
if not self._sitesync_addon.is_representation_on_site(
project_name,
link_repre_id,
site_name
):
print("Adding {} to linked representation: {}".format(
site_name, link_repre_id))
self._sitesync_addon.add_site(
project_name,
link_repre_id,
site_name,
force=False
force=True
)
except Exception:
# do not add/reset working site for references
log.debug("Site present", exc_info=True)

def _get_linked_representation_id(
self,
Expand Down Expand Up @@ -575,7 +579,7 @@ def _get_linked_representation_id(
project_name,
versions_to_check,
link_types=link_types,
link_direction="out")
link_direction="in") # looking for 'in'puts for version

versions_to_check = set()
for links in versions_links.values():
Expand All @@ -584,9 +588,6 @@ def _get_linked_representation_id(
if link["entityType"] != "version":
continue
entity_id = link["entityId"]
# Skip already found linked version ids
if entity_id in linked_version_ids:
continue
linked_version_ids.add(entity_id)
versions_to_check.add(entity_id)

Expand Down
5 changes: 4 additions & 1 deletion client/ayon_core/tools/publisher/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,13 @@ def set_comment(self, comment):
def make_sure_is_visible(self):
if self._window_is_visible:
self.setWindowState(QtCore.Qt.WindowActive)

else:
self.show()

self.raise_()
self.activateWindow()
self.showNormal()

def showEvent(self, event):
self._window_is_visible = True
super().showEvent(event)
Expand Down
Loading

0 comments on commit 4d6f7d4

Please sign in to comment.