Skip to content

Commit

Permalink
Do not create timeline when opening the Loader UI or on calling `get_…
Browse files Browse the repository at this point in the history
…current_timeline_items`
  • Loading branch information
BigRoy committed Jul 8, 2024
1 parent fd078ba commit 91ca1c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
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

0 comments on commit 91ca1c0

Please sign in to comment.