Skip to content

Commit edb33c9

Browse files
Merge pull request #84 from ynput/enhancement/remove-backwards-compatibility
Chore: Remove backwards compatibility
2 parents aedb271 + 513741f commit edb33c9

11 files changed

Lines changed: 30 additions & 49 deletions

File tree

client/ayon_resolve/api/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
maintain_current_timeline,
1919
get_project_manager,
2020
get_current_resolve_project,
21-
get_current_project, # backward compatibility
2221
get_current_timeline,
2322
get_any_timeline,
2423
get_new_timeline,
@@ -33,11 +32,8 @@
3332
get_video_track_names,
3433
get_current_timeline_items,
3534
get_timeline_item_by_name,
36-
get_pype_timeline_item_by_name, # backward compatibility
3735
get_timeline_item_ayon_tag,
38-
get_timeline_item_pype_tag, # backward compatibility
3936
set_timeline_item_ayon_tag,
40-
set_timeline_item_pype_tag, # backward compatibility
4137
imprint,
4238
set_publish_attribute,
4339
get_publish_attribute,
@@ -101,7 +97,6 @@
10197
"maintain_current_timeline",
10298
"get_project_manager",
10399
"get_current_resolve_project",
104-
"get_current_project", # backward compatibility
105100
"get_current_timeline",
106101
"get_any_timeline",
107102
"get_new_timeline",
@@ -116,11 +111,8 @@
116111
"get_video_track_names",
117112
"get_current_timeline_items",
118113
"get_timeline_item_by_name",
119-
"get_pype_timeline_item_by_name", # backward compatibility
120114
"get_timeline_item_ayon_tag",
121-
"get_timeline_item_pype_tag", # backward compatibility
122115
"set_timeline_item_ayon_tag",
123-
"set_timeline_item_pype_tag", # backward compatibility
124116
"imprint",
125117
"set_publish_attribute",
126118
"get_publish_attribute",

client/ayon_resolve/api/lib.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ def get_current_resolve_project():
163163
project_manager = get_project_manager()
164164
return project_manager.GetCurrentProject()
165165

166-
# alias for backward compatibility
167-
get_current_project = get_current_resolve_project
168-
169166

170167
def get_current_timeline(new=False):
171168
"""Get current timeline object.
@@ -510,7 +507,8 @@ def get_current_timeline_items(
510507
"track": {
511508
"name": _track_name,
512509
"index": track_index,
513-
"type": track_type}
510+
"type": track_type,
511+
}
514512
}
515513
# get track item object and its color
516514
for clip_index, ti in enumerate(_clips[track_index]):
@@ -533,10 +531,11 @@ def get_timeline_item_by_name(name: str) -> object:
533531
534532
Returns:
535533
object: resolve.TimelineItem
534+
536535
"""
537536
for _ti_data in get_current_timeline_items():
538537
_ti_clip = _ti_data["clip"]["item"]
539-
tag_data = get_timeline_item_pype_tag(_ti_clip)
538+
tag_data = get_timeline_item_ayon_tag(_ti_clip)
540539
tag_name = tag_data.get("namespace")
541540
if not tag_name:
542541
continue
@@ -545,19 +544,16 @@ def get_timeline_item_by_name(name: str) -> object:
545544
return None
546545

547546

548-
# alias for backward compatibility
549-
get_pype_timeline_item_by_name = get_timeline_item_by_name
550-
551-
552547
def get_timeline_item_ayon_tag(timeline_item):
553548
"""
554549
Get ayon track item tag created by creator or loader plugin.
555550
556-
Attributes:
557-
trackItem (resolve.TimelineItem): resolve object
551+
Args:
552+
timeline_item (resolve.TimelineItem): resolve object
558553
559554
Returns:
560555
dict: ayon tag data
556+
561557
"""
562558
return_tag = None
563559

@@ -577,9 +573,6 @@ def get_timeline_item_ayon_tag(timeline_item):
577573

578574
return return_tag
579575

580-
# alias for backward compatibility
581-
get_timeline_item_pype_tag = get_timeline_item_ayon_tag
582-
583576

584577
def set_timeline_item_ayon_tag(timeline_item, data=None):
585578
"""
@@ -620,10 +613,6 @@ def set_timeline_item_ayon_tag(timeline_item, data=None):
620613
return tag_data
621614

622615

623-
# alias for backward compatibility
624-
set_timeline_item_pype_tag = set_timeline_item_ayon_tag
625-
626-
627616
def imprint(timeline_item, data=None):
628617
"""
629618
Adding `AYON data` into a timeline item track item tag.
@@ -1188,7 +1177,7 @@ def iter_all_media_pool_clips(root=None):
11881177
root (Optional[resolve.Folder]): root folder / bin object.
11891178
When None, defaults to media pool root folder.
11901179
"""
1191-
root = root or get_current_project().GetMediaPool().GetRootFolder()
1180+
root = root or get_current_resolve_project().GetMediaPool().GetRootFolder()
11921181
queue = [root]
11931182
for folder in queue:
11941183
for clip in folder.GetClipList():

client/ayon_resolve/api/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, loader_obj, context, **options):
3535
"""
3636
self.__dict__.update(loader_obj.__dict__)
3737
self.context = context
38-
self.active_project = lib.get_current_project()
38+
self.active_project = lib.get_current_resolve_project()
3939

4040
# try to get value from options or evaluate key value for `handles`
4141
self.with_handles = options.get("handles") is True

client/ayon_resolve/api/rendering.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ayon_core.lib import Logger
1010

1111
from .lib import (
12-
get_current_project,
12+
get_current_resolve_project,
1313
maintain_current_timeline,
1414
maintain_page_by_name,
1515
)
@@ -45,7 +45,7 @@ def _render_timelines(timelines, target_render_directory):
4545
Returns:
4646
bool: True if all renders are successful, False otherwise
4747
"""
48-
bmr_project = get_current_project()
48+
bmr_project = get_current_resolve_project()
4949
failed_timelines = []
5050
for timeline_to_render in timelines:
5151
with maintain_current_timeline(timeline_to_render):
@@ -80,7 +80,7 @@ def render_all_timelines(target_render_directory):
8080
Returns:
8181
bool: True if all renders are successful, False otherwise
8282
"""
83-
bmr_project = get_current_project()
83+
bmr_project = get_current_resolve_project()
8484
with maintain_page_by_name("Deliver"):
8585
timelineCount = bmr_project.GetTimelineCount()
8686
all_timelines = [
@@ -109,7 +109,7 @@ def render_single_timeline(timeline, target_render_directory):
109109

110110
def is_rendering_in_progress():
111111
"""Check if rendering is in progress"""
112-
bmr_project = get_current_project()
112+
bmr_project = get_current_resolve_project()
113113
if not bmr_project:
114114
return False
115115

@@ -133,7 +133,7 @@ def apply_drx_to_all_timeline_items(timeline, path, grade_mode=0):
133133

134134

135135
def apply_drx_to_all_timelines(path, grade_mode=0):
136-
bmr_project = get_current_project()
136+
bmr_project = get_current_resolve_project()
137137
if not bmr_project:
138138
return False
139139
timelineCount = bmr_project.GetTimelineCount()
@@ -148,7 +148,7 @@ def apply_drx_to_all_timelines(path, grade_mode=0):
148148

149149
def delete_all_processed_jobs():
150150
"""Delete all processed jobs"""
151-
bmr_project = get_current_project()
151+
bmr_project = get_current_resolve_project()
152152
if not _PROCESSING_JOBS:
153153
return
154154

@@ -161,7 +161,7 @@ def delete_all_processed_jobs():
161161
def set_render_preset_from_file(preset_file_path):
162162
from . import bmdvr
163163

164-
bmr_project = get_current_project()
164+
bmr_project = get_current_resolve_project()
165165
preset_path = Path(preset_file_path)
166166

167167
# make sure the file exists
@@ -184,7 +184,7 @@ def set_render_preset_from_file(preset_file_path):
184184

185185

186186
def set_format_and_codec(render_format, render_codec):
187-
bmr_project = get_current_project()
187+
bmr_project = get_current_resolve_project()
188188

189189
available_render_formats = bmr_project.GetRenderFormats()
190190
log.debug(f"Available formats: {pformat(available_render_formats)}")

client/ayon_resolve/plugins/create/create_workfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ def _dumps_data_as_project_setting(self, data):
3232
# https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=
3333
# 189685&hilit=python+database#p991541
3434
note = json.dumps(data)
35-
proj = lib.get_current_project()
35+
proj = lib.get_current_resolve_project()
3636
proj.SetSetting("colorVersion10Name", note)
3737

3838
def _loads_data_from_project_setting(self):
3939
"""Retrieve workfile data from project setting."""
40-
proj = lib.get_current_project()
40+
proj = lib.get_current_resolve_project()
4141
setting_content = proj.GetSetting("colorVersion10Name")
4242

4343
if setting_content:

client/ayon_resolve/plugins/load/load_editorial_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def load(self, context, name, namespace, data):
3737
if not search_folder_path.exists():
3838
search_folder_path = Path(files).parent
3939

40-
project = lib.get_current_project()
40+
project = lib.get_current_resolve_project()
4141
media_pool = project.GetMediaPool()
4242
folder_path = context["folder"]["path"]
4343

client/ayon_resolve/plugins/load/load_media.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def project_color_science_mode(project=None, mode="davinciYRGBColorManagedv2"):
5252
"""
5353

5454
if project is None:
55-
project = lib.get_current_project()
55+
project = lib.get_current_resolve_project()
5656

5757
original_mode = project.GetSetting("colorScienceMode")
5858
if original_mode != mode:
@@ -107,7 +107,7 @@ def find_clip_usage(media_pool_item, project=None):
107107
return []
108108

109109
if project is None:
110-
project = lib.get_current_project()
110+
project = lib.get_current_resolve_project()
111111

112112
matching_items = []
113113
unique_id = media_pool_item.GetUniqueId()
@@ -202,7 +202,7 @@ def load(self, context, name, namespace, options):
202202
representation = context["representation"]
203203
self._project_name = context["project"]["name"]
204204

205-
project = lib.get_current_project()
205+
project = lib.get_current_resolve_project()
206206
media_pool = project.GetMediaPool()
207207

208208
# Allow to use an existing media pool item and re-use it
@@ -346,7 +346,7 @@ def update(self, container, context):
346346

347347
def remove(self, container):
348348
# Remove MediaPoolItem entry
349-
project = lib.get_current_project()
349+
project = lib.get_current_resolve_project()
350350
media_pool = project.GetMediaPool()
351351
item = container["_item"]
352352

client/ayon_resolve/plugins/publish/collect_shots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def process(self, instance):
9191

9292
except KeyError:
9393
# Retrieve resolution for project.
94-
project = lib.get_current_project()
94+
project = lib.get_current_resolve_project()
9595
project_settings = project.GetSetting()
9696
try:
9797
pixel_aspect = int(project_settings["timelinePixelAspectRatio"])

client/ayon_resolve/plugins/publish/extract_editorial_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ayon_core.pipeline.publish.lib import get_instance_expected_output_path
88
from ayon_resolve.api.lib import (
99
maintain_current_timeline,
10-
get_current_project,
10+
get_current_resolve_project,
1111
export_timeline_otio_native
1212
)
1313
from ayon_resolve.otio import davinci_export
@@ -62,7 +62,7 @@ def process(self, instance):
6262

6363
# export otio representation
6464
self.export_otio_representation(
65-
get_current_project(), timeline, otio_file_path
65+
get_current_resolve_project(), timeline, otio_file_path
6666
)
6767

6868
# Find Intermediate file representation file name

client/ayon_resolve/utility_scripts/develop/test_rendering_editorial_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ayon_core.lib import Logger
88

99
from ayon_resolve.api.lib import (
10-
get_current_project,
10+
get_current_resolve_project,
1111
maintain_page_by_name,
1212
)
1313
from ayon_resolve.api.rendering import (
@@ -47,7 +47,7 @@ def main(
4747
log.error("Unable to set render format and codec.")
4848
sys.exit()
4949

50-
timeline = get_current_project().GetCurrentTimeline()
50+
timeline = get_current_resolve_project().GetCurrentTimeline()
5151

5252
if not render_single_timeline(
5353
timeline,

0 commit comments

Comments
 (0)