Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/fix_error_on_publish_clip
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjezek001 authored Jul 18, 2024
2 parents 0a49515 + 3187040 commit 6a9f12c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 47 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
7 changes: 3 additions & 4 deletions create_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ def safe_copy_file(src_path: str, dst_path: str):
return

dst_dir: str = os.path.dirname(dst_path)
try:
os.makedirs(dst_dir)
except Exception:
pass
os.makedirs(dst_dir, exist_ok=True)

shutil.copy2(src_path, dst_path)

Expand Down Expand Up @@ -355,6 +352,8 @@ def copy_addon_package(
# Copy server content
for src_file, dst_subpath in files_mapping:
dst_path: str = os.path.join(addon_output_dir, dst_subpath)
dst_dir: str = os.path.dirname(dst_path)
os.makedirs(dst_dir, exist_ok=True)
if isinstance(src_file, io.BytesIO):
with open(dst_path, "wb") as stream:
stream.write(src_file.getvalue())
Expand Down
30 changes: 0 additions & 30 deletions server/imageio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@
from ayon_server.settings.validators import ensure_unique_names


class ImageIOConfigModel(BaseSettingsModel):
"""[DEPRECATED] Addon OCIO config settings. Please set the OCIO config
path in the Core addon profiles here
(ayon+settings://core/imageio/ocio_config_profiles).
"""

override_global_config: bool = SettingsField(
False,
title="Override global OCIO config",
description=(
"DEPRECATED functionality. Please set the OCIO config path in the "
"Core addon profiles here (ayon+settings://core/imageio/"
"ocio_config_profiles)."
),
)
filepath: list[str] = SettingsField(
default_factory=list,
title="Config path",
description=(
"DEPRECATED functionality. Please set the OCIO config path in the "
"Core addon profiles here (ayon+settings://core/imageio/"
"ocio_config_profiles)."
),
)


class ImageIOFileRuleModel(BaseSettingsModel):
name: str = SettingsField("", title="Rule name")
pattern: str = SettingsField("", title="Regex pattern")
Expand Down Expand Up @@ -69,10 +43,6 @@ class ResolveImageIOModel(BaseSettingsModel):
title="Remapping colorspace names",
default_factory=ImageIORemappingModel
)
ocio_config: ImageIOConfigModel = SettingsField(
default_factory=ImageIOConfigModel,
title="OCIO config"
)
file_rules: ImageIOFileRulesModel = SettingsField(
default_factory=ImageIOFileRulesModel,
title="File Rules"
Expand Down

0 comments on commit 6a9f12c

Please sign in to comment.