Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing distribution of otioClip attribute to plates #31

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions client/ayon_hiero/plugins/create/create_shot_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def get_attr_defs_for_instance(self, instance):
disabled=True,
)
]
if self.product_type == "plate":
if self.product_type in ("plate", "audio"):
# Review track visibility
current_review = instance.creator_attributes.get("review", False)

Expand Down Expand Up @@ -523,11 +523,15 @@ def create(self, subset_name, instance_data, pre_create_data):

sorted_selected_track_items.extend(unsorted_selected_track_items)

shot_creator_id = "io.ayon.creators.hiero.shot"
audio_creator_id = "io.ayon.creators.hiero.audio"
plate_creator_id = "io.ayon.creators.hiero.plate"

# detect enabled creators for review, plate and audio
all_creators = {
"io.ayon.creators.hiero.shot": True,
"io.ayon.creators.hiero.plate": True,
"io.ayon.creators.hiero.audio": pre_create_data.get("export_audio", False),
shot_creator_id: True,
plate_creator_id: True,
audio_creator_id: True,
}

instances = []
Expand Down Expand Up @@ -572,9 +576,16 @@ def create(self, subset_name, instance_data, pre_create_data):
shot_folder_path = _instance_data["folderPath"]
shot_instances = self.shot_instances.setdefault(
shot_folder_path, {})
shot_creator_id = "io.ayon.creators.hiero.shot"
all_creators["io.ayon.creators.hiero.shot"] = _instance_data.get(

# desable shot creator if heroTrack is not enabled
all_creators[shot_creator_id] = _instance_data.get(
"heroTrack", False)
# desable audio creator if audio is not enabled
all_creators[audio_creator_id] = (
_instance_data.get("heroTrack", False) and
pre_create_data.get("export_audio", False)
)

enabled_creators = tuple(
cre for cre, enabled in all_creators.items() if enabled
)
Expand Down
19 changes: 17 additions & 2 deletions client/ayon_hiero/plugins/publish/collect_audio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pyblish

from ayon_core.pipeline import PublishError
from ayon_hiero.api.otio import utils


class CollectAudio(pyblish.api.InstancePlugin):
"""Collect new audio."""
Expand All @@ -17,9 +20,21 @@ def process(self, instance):
# Retrieve instance data from parent instance shot instance.
parent_instance_id = instance.data["parent_instance_id"]
edit_shared_data = instance.context.data["editorialSharedData"]
instance.data.update(
edit_shared_data[parent_instance_id]
shot_instance_data = edit_shared_data[parent_instance_id]
instance.data.update(shot_instance_data)

# Adjust instance data from parent otio timeline.
otio_timeline = instance.context.data["otioTimeline"]
# Clip index has to be taken form hero shot data
# audio could be shorter but we need to get full length
otio_clip, _ = utils.get_marker_from_clip_index(
otio_timeline, shot_instance_data["clip_index"]
)
if not otio_clip:
raise PublishError(
f"Could not retrieve otioClip for shot {instance}")

instance.data["otioClip"] = otio_clip

if instance.data.get("reviewTrack") is not None:
instance.data["reviewAudio"] = True
Expand Down
14 changes: 14 additions & 0 deletions client/ayon_hiero/plugins/publish/collect_plates.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pyblish

from ayon_core.pipeline import PublishError
from ayon_hiero.api.otio import utils


class CollectPlate(pyblish.api.InstancePlugin):
"""Collect new plates."""
Expand All @@ -16,6 +19,17 @@ def process(self, instance):
"""
instance.data["families"].append("clip")

# Adjust instance data from parent otio timeline.
otio_timeline = instance.context.data["otioTimeline"]
otio_clip, _ = utils.get_marker_from_clip_index(
otio_timeline, instance.data["clip_index"]
)
if not otio_clip:
raise PublishError(
f"Could not retrieve otioClip for shot {instance}")

instance.data["otioClip"] = otio_clip

# solve reviewable options
review_switch = instance.data["creator_attributes"].get(
"review")
Expand Down
5 changes: 3 additions & 2 deletions client/ayon_hiero/plugins/publish/collect_shots.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import pyblish

from ayon_core.pipeline import PublishError
from ayon_hiero.api import lib
from ayon_hiero.api.otio import utils

Expand All @@ -22,7 +23,6 @@ class CollectShot(pyblish.api.InstancePlugin):
"handleStart",
"handleEnd",
"item",
"otioClip",
jakubjezek001 marked this conversation as resolved.
Show resolved Hide resolved
"resolutionWidth",
"resolutionHeight",
"pixelAspect",
Expand Down Expand Up @@ -78,7 +78,8 @@ def process(self, instance):
otio_timeline, instance.data["clip_index"]
)
if not otio_clip:
raise RuntimeError("Could not retrieve otioClip for shot %r", instance)
raise PublishError(
f"Could not retrieve otioClip for shot {instance}")

# Compute fps from creator attribute.
if instance.data['creator_attributes']["fps"] == "from_selection":
Expand Down