Skip to content

Commit

Permalink
Merge pull request #1010 from ynput/enhancements/allow_csv_ingest_to_…
Browse files Browse the repository at this point in the history
…create_shot

AY-6731_Allow CSV ingest to create new shots.
  • Loading branch information
robin-ynput authored Nov 20, 2024
2 parents a181fc8 + 26e5c2f commit 9293c28
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
56 changes: 34 additions & 22 deletions client/ayon_core/plugins/publish/collect_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class CollectHierarchy(pyblish.api.ContextPlugin):

label = "Collect Hierarchy"
order = pyblish.api.CollectorOrder - 0.076
families = ["shot"]
hosts = ["resolve", "hiero", "flame"]
hosts = ["resolve", "hiero", "flame", "traypublisher"]

def process(self, context):
project_name = context.data["projectName"]
Expand All @@ -32,36 +31,49 @@ def process(self, context):
product_type = instance.data["productType"]
families = instance.data["families"]

# exclude other families then self.families with intersection
if not set(self.families).intersection(
set(families + [product_type])
):
# exclude other families then "shot" with intersection
if "shot" not in (families + [product_type]):
self.log.debug("Skipping not a shot: {}".format(families))
continue

# exclude if not masterLayer True
# Skip if is not a hero track
if not instance.data.get("heroTrack"):
self.log.debug("Skipping not a shot from hero track")
continue

shot_data = {
"entity_type": "folder",
# WARNING Default folder type is hardcoded
# suppose that all instances are Shots
"folder_type": "Shot",
# WARNING unless overwritten, default folder type is hardcoded to shot
"folder_type": instance.data.get("folder_type") or "Shot",
"tasks": instance.data.get("tasks") or {},
"comments": instance.data.get("comments", []),
"attributes": {
"handleStart": instance.data["handleStart"],
"handleEnd": instance.data["handleEnd"],
"frameStart": instance.data["frameStart"],
"frameEnd": instance.data["frameEnd"],
"clipIn": instance.data["clipIn"],
"clipOut": instance.data["clipOut"],
"fps": instance.data["fps"],
"resolutionWidth": instance.data["resolutionWidth"],
"resolutionHeight": instance.data["resolutionHeight"],
"pixelAspect": instance.data["pixelAspect"],
},
}

shot_data["attributes"] = {}
SHOT_ATTRS = (
"handleStart",
"handleEnd",
"frameStart",
"frameEnd",
"clipIn",
"clipOut",
"fps",
"resolutionWidth",
"resolutionHeight",
"pixelAspect",
)
for shot_attr in SHOT_ATTRS:
attr_value = instance.data.get(shot_attr)
if attr_value is None:
# Shot attribute might not be defined (e.g. CSV ingest)
self.log.debug(
"%s shot attribute is not defined for instance.",
shot_attr
)
continue

shot_data["attributes"][shot_attr] = attr_value

# Split by '/' for AYON where asset is a path
name = instance.data["folderPath"].split("/")[-1]
actual = {name: shot_data}
Expand Down
4 changes: 4 additions & 0 deletions client/ayon_core/plugins/publish/collect_otio_frame_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def process(self, instance):
otio_range_with_handles
)

if not instance.data.get("otioClip"):
self.log.debug("Skipping collect OTIO frame range.")
return

# get basic variables
otio_clip = instance.data["otioClip"]
workfile_start = instance.data["workfileFrameStart"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin):

order = pyblish.api.ExtractorOrder - 0.01
label = "Extract Hierarchy To AYON"
families = ["clip", "shot"]

def process(self, context):
if not context.data.get("hierarchyContext"):
Expand Down

0 comments on commit 9293c28

Please sign in to comment.