Skip to content

Commit

Permalink
Implement multiple timeline support for xml and viewer (#130)
Browse files Browse the repository at this point in the history
* Implement multiple timeline support for xml and viewer. Bugfixes

- implement multiple timeline read and write support for fcp_xml adapter
- implement browsing multiple timelines in otioview
- otioview, hide empty tracks
- bugfix fcp_xml-write, timeline ranges not correct if clip rate differs from containing timeline rate
- bugfix fcp_xml-write, when casting float to int we get rounding errors
- bugfix otioview, clip marker not displaying at correct location if clip source doesn`t start at 0
- bugfix otioview, clip marker displaying outside clip range

* Bugfixes

- writing incorrect frame ranges around transitions where source rate
  differs from timeline rate
- failing unittest trying to _get_single_sequence
  • Loading branch information
bashesenaxis authored and jminor committed Jul 24, 2017
1 parent 74e25da commit 93261fe
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 61 deletions.
35 changes: 31 additions & 4 deletions bin/otioview.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def _parsed_args():
return parser.parse_args()


class TimelineWidgetItem(QtGui.QListWidgetItem):
def __init__(self, timeline, *args, **kwargs):
super(TimelineWidgetItem, self).__init__(*args, **kwargs)
self.timeline = timeline


class Main(QtGui.QMainWindow):

def __init__(self, *args, **kwargs):
Expand All @@ -40,19 +46,24 @@ def __init__(self, *args, **kwargs):
self.resize(900, 500)

# widgets
self.sequences = QtGui.QListWidget(parent=self)
self.timeline = otioViewWidget.timeline.Timeline(parent=self)
self.details = otioViewWidget.details.Details(parent=self)

# layout
splitter = QtGui.QSplitter(parent=self)
self.setCentralWidget(splitter)

widg = QtGui.QWidget(parent=self)
layout = QtGui.QVBoxLayout()

self.setCentralWidget(widg)
widg.setLayout(layout)

layout.addWidget(self.details)
layout.addWidget(self.timeline)

splitter.addWidget(self.sequences)
splitter.addWidget(widg)
splitter.setSizes([200, 700])

# menu
menubar = self.menuBar()

Expand All @@ -63,6 +74,7 @@ def __init__(self, *args, **kwargs):
file_menu.addAction(file_load)

# signals
self.sequences.itemSelectionChanged.connect(self._change_sequence)
self.timeline.selection_changed.connect(self.details.set_item)

def _file_load(self):
Expand Down Expand Up @@ -96,7 +108,22 @@ def load(self, path):
self._current_file = path
self.setWindowTitle('OTIO viewer - ' + path)
self.details.set_item(None)
self.timeline.set_timeline(otio.adapters.read_from_file(path))
self.sequences.clear()
file_contents = otio.adapters.read_from_file(path)
if isinstance(file_contents, otio.schema.Timeline):
self.timeline.set_timeline(file_contents)
self.sequences.setVisible(False)
elif isinstance(file_contents,
otio.schema.SerializeableCollection):
for s in file_contents:
TimelineWidgetItem(s, s.name, self.sequences)
self.sequences.setVisible(True)
self.timeline.set_timeline(None)

def _change_sequence(self):
selection = self.sequences.selectedItems()
if selection:
self.timeline.set_timeline(selection[0].timeline)


def main():
Expand Down
Loading

0 comments on commit 93261fe

Please sign in to comment.