Permalink
Browse files

Rename Sequence schema to Track. (#173)

* move sequence module to track.
* Rename "Sequence" to "Track".
- This is more inline with the way that NLEs name things.
* Checked bin/examples directories.
* Change tests in contrib to make track schema OTIOs.
  • Loading branch information...
ssteinbach committed Nov 15, 2017
1 parent 744b6ed commit 5f42fb0dc112185dfa7c1c769aaa8d3c5f1c6fd1
View
@@ -126,13 +126,13 @@ def _clips_with_cdl_data(input):
return len(list(c for c in input.each_clip() if 'cdl' in c.metadata))
@stat_check("Sequences with non standard types")
@stat_check("Tracks with non standard types")
def _sequences_with_non_standard_types(input):
return len(
list(
c
for c in input.each_child(descended_from_type=otio.schema.Sequence)
if c.kind not in (otio.schema.SequenceKind.__dict__)
for c in input.each_child(descended_from_type=otio.schema.Track)
if c.kind not in (otio.schema.TrackKind.__dict__)
)
)
View
@@ -66,7 +66,7 @@ def __init__(self, *args, **kwargs):
self.resize(900, 500)
# widgets
self.sequences_widget = QtGui.QListWidget(parent=self)
self.tracks_widget = QtGui.QListWidget(parent=self)
self.timeline_widget = otioViewWidget.timeline_widget.Timeline(
parent=self
)
@@ -84,7 +84,7 @@ def __init__(self, *args, **kwargs):
layout.addWidget(self.details_widget)
layout.addWidget(self.timeline_widget)
splitter.addWidget(self.sequences_widget)
splitter.addWidget(self.tracks_widget)
splitter.addWidget(widg)
splitter.setSizes([200, 700])
@@ -98,8 +98,8 @@ def __init__(self, *args, **kwargs):
file_menu.addAction(file_load)
# signals
self.sequences_widget.itemSelectionChanged.connect(
self._change_sequence
self.tracks_widget.itemSelectionChanged.connect(
self._change_track
)
self.timeline_widget.selection_changed.connect(
self.details_widget.set_item
@@ -130,23 +130,23 @@ def load(self, path):
self._current_file = path
self.setWindowTitle('OpenTimelineIO View: "{}"'.format(path))
self.details_widget.set_item(None)
self.sequences_widget.clear()
self.tracks_widget.clear()
file_contents = otio.adapters.read_from_file(path)
if isinstance(file_contents, otio.schema.Timeline):
self.timeline_widget.set_timeline(file_contents)
self.sequences_widget.setVisible(False)
self.tracks_widget.setVisible(False)
elif isinstance(
file_contents,
otio.schema.SerializableCollection
):
for s in file_contents:
TimelineWidgetItem(s, s.name, self.sequences_widget)
self.sequences_widget.setVisible(True)
TimelineWidgetItem(s, s.name, self.tracks_widget)
self.tracks_widget.setVisible(True)
self.timeline_widget.set_timeline(None)
def _change_sequence(self):
selection = self.sequences_widget.selectedItems()
def _change_track(self):
selection = self.tracks_widget.selectedItems()
if selection:
self.timeline_widget.set_timeline(selection[0].timeline)
@@ -91,10 +91,10 @@ def _match_existing_shot(item, existing_shots):
# ------------------------
# building single sequence
# building single track
# ------------------------
def _build_shot(item, track_no, sequence_range, existing_shot=None):
def _build_shot(item, track_no, track_range, existing_shot=None):
camera = None
if existing_shot is None:
camera = cmds.camera(name=item.name.split('.')[0] + '_cam')[0]
@@ -106,8 +106,8 @@ def _build_shot(item, track_no, sequence_range, existing_shot=None):
currentCamera=camera,
startTime=item.trimmed_range().start_time.value,
endTime=item.trimmed_range().end_time_inclusive().value,
sequenceStartTime=sequence_range.start_time.value,
sequenceEndTime=sequence_range.end_time_inclusive().value
sequenceStartTime=track_range.start_time.value,
sequenceEndTime=track_range.end_time_inclusive().value
)
@@ -116,13 +116,13 @@ def _build_track(track, track_no, existing_shots=None):
if not isinstance(item, otio.schema.Clip):
continue
sequence_range = track.range_of_child_at_index(n)
track_range = track.range_of_child_at_index(n)
if existing_shots is not None:
existing_shot = _match_existing_shot(item, existing_shots)
else:
existing_shot = None
_build_shot(item, track_no, sequence_range, existing_shot)
_build_shot(item, track_no, track_range, existing_shot)
def build_sequence(timeline, clean=False):
@@ -133,7 +133,7 @@ def build_sequence(timeline, clean=False):
tracks = [
track for track in timeline.tracks
if track.kind == otio.schema.SequenceKind.Video
if track.kind == otio.schema.TrackKind.Video
]
for track_no, track in enumerate(reversed(tracks)):
@@ -146,7 +146,7 @@ def read_from_file(path, clean=True):
# -----------------------
# parsing single sequence
# parsing single track
# -----------------------
def _get_gap(duration):
@@ -181,7 +181,7 @@ def _read_shot(shot):
def _read_track(shots):
v = otio.schema.Sequence(kind=otio.schema.sequence.SequenceKind.Video)
v = otio.schema.Track(kind=otio.schema.track.TrackKind.Video)
last_clip_end = 0
for shot in shots:
@@ -70,7 +70,7 @@ def write_otio(otio_obj, to_session):
WRITE_TYPE_MAP = {
otio.schema.Timeline: _write_timeline,
otio.schema.Stack: _write_stack,
otio.schema.Sequence: _write_sequence,
otio.schema.Track: _write_track,
otio.schema.Clip: _write_item,
otio.schema.Gap: _write_item,
otio.schema.Transition: _write_transition,
@@ -178,10 +178,10 @@ def _write_stack(in_stack, to_session):
return new_stack
def _write_sequence(in_seq, to_session):
new_seq = to_session.newNode("Sequence", str(in_seq.name) or "sequence")
def _write_track(in_seq, to_session):
new_seq = to_session.newNode("Sequence", str(in_seq.name) or "track")
items_to_serialize = otio.algorithms.sequence_with_expanded_transitions(
items_to_serialize = otio.algorithms.track_with_expanded_transitions(
in_seq
)
Oops, something went wrong.

0 comments on commit 5f42fb0

Please sign in to comment.