Skip to content

Commit 26de4be

Browse files
jhery-rdotedwaine
authored andcommitted
Fix annotation export crash when viewed container is a Subset (#244)
The annotations exporter accessed the playhead via session.viewed_container.playhead, which assumes the viewed container is always a Playlist. When media is loaded by a Python plugin (e.g. rdo_browser) that sets the viewer to a Subset, this crashes with "'Subset' object has no attribute 'playhead'" because the Subset class does not expose a playhead property. Replace all 5 call sites with self.current_playhead(), which is provided by PluginBase and returns the active playhead regardless of the viewed container type. Signed-off-by: Ted Waine <ted.waine@gmail.com>
1 parent e47b388 commit 26de4be

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/plugin/python_plugins/annotations_exporter/annotations_exporter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def attribute_changed(self, attr, role):
159159
if attr == self.scope:
160160
if self.scope.value() in ["Current Media", "Current Frame"]:
161161
self.user_name.set_value(
162-
self.connection.api.session.viewed_container.playhead.on_screen_media.name
162+
self.current_playhead().on_screen_media.name
163163
)
164164
elif self.scope.value() == "Current Playlist / Timeline":
165165
self.user_name.set_value(
@@ -232,7 +232,7 @@ def do_export(self, scope, export_type, user_name, output_folder, file_type, res
232232
elif scope == "Current Media":
233233

234234
self.export_media_annotations(
235-
self.connection.api.session.viewed_container.playhead.on_screen_media
235+
self.current_playhead().on_screen_media
236236
)
237237

238238
elif scope == "Current Playlist / Timeline":
@@ -254,7 +254,7 @@ def do_export(self, scope, export_type, user_name, output_folder, file_type, res
254254
gp_file_path = self.__output_folder + "/greasePencil.xml"
255255
self.make_greaspencil_xml_file(
256256
gp_file_path,
257-
self.connection.api.session.viewed_container.playhead.on_screen_media.media_source().rate.fps()
257+
self.current_playhead().on_screen_media.media_source().rate.fps()
258258
)
259259
# now we zip the folder
260260
final_name = shutil.make_archive(self.__output_folder + "/" + self.user_name.value(), 'zip', __tmp_folder)
@@ -314,8 +314,8 @@ def export_frame(self, idx, frame, duration, bookmark, media):
314314

315315
def export_bookmark_on_current_frame(self):
316316

317-
m = self.connection.api.session.viewed_container.playhead.on_screen_media
318-
current_frame = self.connection.api.session.viewed_container.playhead.attributes['Media Logical Frame'].value()
317+
m = self.current_playhead().on_screen_media
318+
current_frame = self.current_playhead().attributes['Media Logical Frame'].value()
319319
bookmarks = m.ordered_bookmarks()
320320
bookmark = None
321321
for bm in bookmarks:

0 commit comments

Comments
 (0)