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

Do not create timeline on opening Loader UI #9

Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 9 additions & 12 deletions client/ayon_resolve/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import os
import contextlib
from typing import List, Dict, Any
from opentimelineio import opentime

from ayon_core.lib import Logger
Expand Down Expand Up @@ -101,8 +102,7 @@ def get_current_timeline(new=False):
new timeline if none exists

Returns:
TODO: will need to reflect future `None`
object: resolve.Timeline
object | None: resolve.Timeline
"""
project = get_current_project()
timeline = project.GetCurrentTimeline()
Expand Down Expand Up @@ -385,19 +385,17 @@ def get_current_timeline_items(
filter: bool = False,
track_type: str = None,
track_name: str = None,
selecting_color: str = None) -> list:
""" Gets all available current timeline track items
"""
selecting_color: str = None) -> List[Dict[str, Any]]:
"""Get all available current timeline track items"""
track_type = track_type or "video"
selecting_color = selecting_color or "Chocolate"
project = get_current_project()

# get timeline anyhow
timeline = (
get_current_timeline() or
get_any_timeline() or
get_new_timeline()
)
timeline = get_current_timeline() or get_any_timeline()
if not timeline:
return []

selected_clips = []

# get all tracks count filtered by track type
Expand All @@ -412,8 +410,7 @@ def get_current_timeline_items(
if track_name and _track_name not in track_name:
continue

timeline_items = timeline.GetItemListInTrack(
track_type, track_index)
timeline_items = timeline.GetItemListInTrack(track_type, track_index)
_clips[track_index] = timeline_items

_data = {
Expand Down
4 changes: 3 additions & 1 deletion client/ayon_resolve/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ def __init__(self, loader_obj, context, **options):
loader_cls.timeline = self.active_timeline

else:
self.active_timeline = lib.get_current_timeline()
self.active_timeline = (
lib.get_current_timeline() or lib.get_new_timeline()
)

def _populate_data(self):
""" Gets context and convert it to self.data
Expand Down