Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
otio.schema.Clip(
name="clip3",
source_range=otio.opentime.TimeRange(
start_time=otio.opentime.RationalTime(
value=102,
rate=24
),
duration=otio.opentime.RationalTime(
value=50,
rate=24
)
)
)
]
)
fl = otio.schema.Gap(
name="GAP",
source_range=otio.opentime.TimeRange(
start_time=otio.opentime.RationalTime(
value=0,
rate=24
),
duration=otio.opentime.RationalTime(
value=50,
rate=24
)
)
)
self.assertFalse(fl.visible())
clip1 = sq[0]
clip2 = sq[1]
clip3 = sq[2]
def test_prune_correct_duplicate(self):
"""test a reduce that removes the correct duplicate clip"""
md = {'test': 'bar'}
tr = otio.schema.Track()
tr.append(otio.schema.Clip(metadata=md))
tr.append(otio.schema.Gap())
tr.append(otio.schema.Clip(metadata=md))
tr.append(otio.schema.Gap())
tr.append(otio.schema.Clip(metadata=md))
clips = []
def no_clip_2(_, thing, __):
if isinstance(thing, otio.schema.Clip):
clips.append(thing)
if len(clips) == 2:
return None
return thing
result = otio.algorithms.filtered_with_sequence_context(tr, no_clip_2)
self.assertEqual(4, len(result))
self.assertTrue(isinstance(result[0], otio.schema.Clip))
self.assertTrue(isinstance(result[1], otio.schema.Gap))
self.assertTrue(isinstance(result[2], otio.schema.Gap))
children=[
self.trackABC,
self.trackDgE,
]
)
top_child = otio.algorithms.top_clip_at_time(
stack,
otio.opentime.RationalTime(0, 24)
)
self.assertEqual(top_child, self.trackDgE[0])
stack.append(
otio.schema.Track(
children=[
otio.schema.Gap(
source_range=otio.opentime.TimeRange(
otio.opentime.RationalTime(0, 24),
otio.opentime.RationalTime(10, 24)
)
)
]
)
)
top_child = otio.algorithms.top_clip_at_time(
stack,
otio.opentime.RationalTime(0, 24)
)
self.assertEqual(top_child, self.trackDgE[0])
)
seq.append(trans)
# neighbors of first transition
neighbors = seq.neighbors_of(
seq[0],
otio.schema.NeighborGapPolicy.never
)
self.assertEqual(neighbors, (None, None))
# test with the neighbor filling policy on
neighbors = seq.neighbors_of(
seq[0],
otio.schema.NeighborGapPolicy.around_transitions
)
fill = otio.schema.Gap(
source_range=otio.opentime.TimeRange(
start_time=otio.opentime.RationalTime(0, trans.in_offset.rate),
duration=trans.in_offset
)
)
self.assertJsonEqual(neighbors, (fill, fill.clone()))
def test_str_gap(self):
gp = otio.schema.Gap()
self.assertMultiLineEqual(
str(gp),
"Gap(" +
str(gp.name) + ", " +
str(gp.source_range) + ", " +
str(gp.effects) + ", " +
str(gp.markers) + ", " +
str(gp.metadata) +
")"
)
self.assertMultiLineEqual(
repr(gp),
"otio.schema.Gap("
"name={}, "
"source_range={}, "
"effects={}, "
def _get_gap(duration):
rate = FPS.get(cmds.currentUnit(q=True, time=True), 25)
gap_range = otio.opentime.TimeRange(
duration=otio.opentime.RationalTime(duration, rate)
)
return otio.schema.Gap(source_range=gap_range)
def _create_otio_gap(self, gst_duration):
source_range = otio.opentime.TimeRange(
self.to_rational_time(0),
self.to_rational_time(gst_duration))
return otio.schema.Gap(source_range=source_range)
def _serialize_composable_to_clip(
self, otio_composable, prev_composable, next_composable,
layer, layer_priority, track_types, ressources, clip_id,
prev_otio_end):
"""
Return the next clip_id and the time at which the next clip
should start.
"""
start, duration, inpoint, otio_end = self._get_clip_times(
otio_composable, prev_composable, next_composable,
prev_otio_end)
asset_id = None
asset_type = None
if isinstance(otio_composable, otio.schema.Gap):
pass
elif isinstance(otio_composable, otio.schema.Transition):
asset_type = "GESTransitionClip"
# FIXME: get transition type from metadata if transition is
# not supported by otio
# currently, any Custom_Transition is being turned into a
# crossfade
asset_id = TRANSITION_MAP.get(
otio_composable.transition_type, "crossfade")
elif isinstance(otio_composable, otio.schema.Clip):
ref = otio_composable.media_reference
if ref is None or ref.is_missing_reference:
pass # treat as a gap
# FIXME: properly handle missing reference
elif isinstance(ref, otio.schema.ExternalReference):
asset_id = ref.target_url
def create_rv_node_from_otio(otio_obj, track_kind=None):
WRITE_TYPE_MAP = {
otio.schema.Timeline: _create_timeline,
otio.schema.Stack: _create_stack,
otio.schema.Track: _create_track,
otio.schema.Clip: _create_item,
otio.schema.Gap: _create_item,
otio.schema.Transition: _create_transition,
otio.schema.SerializableCollection: _create_collection,
}
if type(otio_obj) in WRITE_TYPE_MAP:
return WRITE_TYPE_MAP[type(otio_obj)](otio_obj, track_kind)
raise NoMappingForOtioTypeError(
str(type(otio_obj)) + " on object: {}".format(otio_obj)
)