mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
added safe importing of otio
This commit is contained in:
parent
745a394cdd
commit
9f456f7cb8
3 changed files with 14 additions and 9 deletions
|
|
@ -8,13 +8,7 @@ This module contains a unified plugin that handles:
|
||||||
|
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
import opentimelineio as otio
|
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
from ayon_core.pipeline.editorial import (
|
|
||||||
get_media_range_with_retimes,
|
|
||||||
otio_range_to_frame_range,
|
|
||||||
otio_range_with_handles,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_otio_clip(instance, logger):
|
def validate_otio_clip(instance, logger):
|
||||||
|
|
@ -74,6 +68,8 @@ class CollectOtioRanges(pyblish.api.InstancePlugin):
|
||||||
if not validate_otio_clip(instance, self.log):
|
if not validate_otio_clip(instance, self.log):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
import opentimelineio as otio
|
||||||
|
|
||||||
otio_clip = instance.data["otioClip"]
|
otio_clip = instance.data["otioClip"]
|
||||||
|
|
||||||
# Collect timeline ranges if workfile start frame is available
|
# Collect timeline ranges if workfile start frame is available
|
||||||
|
|
@ -100,6 +96,11 @@ class CollectOtioRanges(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
def _collect_timeline_ranges(self, instance, otio_clip):
|
def _collect_timeline_ranges(self, instance, otio_clip):
|
||||||
"""Collect basic timeline frame ranges."""
|
"""Collect basic timeline frame ranges."""
|
||||||
|
from ayon_core.pipeline.editorial import (
|
||||||
|
otio_range_to_frame_range,
|
||||||
|
otio_range_with_handles,
|
||||||
|
)
|
||||||
|
|
||||||
workfile_start = instance.data["workfileFrameStart"]
|
workfile_start = instance.data["workfileFrameStart"]
|
||||||
|
|
||||||
# Get timeline ranges
|
# Get timeline ranges
|
||||||
|
|
@ -129,6 +130,8 @@ class CollectOtioRanges(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
def _collect_source_ranges(self, instance, otio_clip):
|
def _collect_source_ranges(self, instance, otio_clip):
|
||||||
"""Collect source media frame ranges."""
|
"""Collect source media frame ranges."""
|
||||||
|
import opentimelineio as otio
|
||||||
|
|
||||||
# Get source ranges
|
# Get source ranges
|
||||||
otio_src_range = otio_clip.source_range
|
otio_src_range = otio_clip.source_range
|
||||||
otio_available_range = otio_clip.available_range()
|
otio_available_range = otio_clip.available_range()
|
||||||
|
|
@ -178,6 +181,8 @@ class CollectOtioRanges(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
def _collect_retimed_ranges(self, instance, otio_clip):
|
def _collect_retimed_ranges(self, instance, otio_clip):
|
||||||
"""Handle retimed clip frame ranges."""
|
"""Handle retimed clip frame ranges."""
|
||||||
|
from ayon_core.pipeline.editorial import get_media_range_with_retimes
|
||||||
|
|
||||||
retimed_attributes = get_media_range_with_retimes(otio_clip, 0, 0)
|
retimed_attributes = get_media_range_with_retimes(otio_clip, 0, 0)
|
||||||
self.log.debug(f"Retimed attributes: {retimed_attributes}")
|
self.log.debug(f"Retimed attributes: {retimed_attributes}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ from ayon_core.lib import (
|
||||||
get_ffmpeg_tool_args,
|
get_ffmpeg_tool_args,
|
||||||
run_subprocess
|
run_subprocess
|
||||||
)
|
)
|
||||||
from ayon_core.pipeline import editorial
|
|
||||||
|
|
||||||
|
|
||||||
class ExtractOtioAudioTracks(pyblish.api.ContextPlugin):
|
class ExtractOtioAudioTracks(pyblish.api.ContextPlugin):
|
||||||
|
|
@ -159,6 +158,7 @@ class ExtractOtioAudioTracks(pyblish.api.ContextPlugin):
|
||||||
"""
|
"""
|
||||||
# Not all hosts can import this module.
|
# Not all hosts can import this module.
|
||||||
import opentimelineio as otio
|
import opentimelineio as otio
|
||||||
|
from ayon_core.pipeline.editorial import OTIO_EPSILON
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
# go trough all audio tracks
|
# go trough all audio tracks
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ from ayon_core.lib import (
|
||||||
)
|
)
|
||||||
from ayon_core.pipeline import (
|
from ayon_core.pipeline import (
|
||||||
KnownPublishError,
|
KnownPublishError,
|
||||||
editorial,
|
|
||||||
publish,
|
publish,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -359,6 +358,7 @@ class ExtractOTIOReview(
|
||||||
import opentimelineio as otio
|
import opentimelineio as otio
|
||||||
from ayon_core.pipeline.editorial import (
|
from ayon_core.pipeline.editorial import (
|
||||||
trim_media_range,
|
trim_media_range,
|
||||||
|
OTIO_EPSILON,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _round_to_frame(rational_time):
|
def _round_to_frame(rational_time):
|
||||||
|
|
@ -380,7 +380,7 @@ class ExtractOTIOReview(
|
||||||
# Avoid rounding issue on media available range.
|
# Avoid rounding issue on media available range.
|
||||||
if start.almost_equal(
|
if start.almost_equal(
|
||||||
avl_start,
|
avl_start,
|
||||||
editorial.OTIO_EPSILON
|
OTIO_EPSILON
|
||||||
):
|
):
|
||||||
avl_start = start
|
avl_start = start
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue