Minor style and logic tweaks
+24 −25 · 4 files changed
-
CHANGELOG.md+2 −0 -
spa_sequencer/sequence/overlay.py+1 −3 -
spa_sequencer/sync/core.py+8 −9 -
spa_sequencer/sync/ops.py+13 −13
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +- Port the add-on to Blender 4.0 (credit to [@NickTiny](https://github.com/NickTiny)) + ## [1.0.1] - 2023-3-08 - Added support for strip opacity in the batch render. Now values and keyframed animation on opacity strips is transferred during batch render. @@ -93,9 +93,7 @@ def draw_shot_strip( # Shot name font_id = 0 blf.color(font_id, *(TEXT_COLOR_ACTIVE if active else TEXT_COLOR_BASE)) - blf.size( - font_id, int(11 * bpy.context.preferences.system.ui_scale) - ) # removed arg 72 + blf.size(font_id, int(11 * bpy.context.preferences.system.ui_scale)) # Compute text dimensions for horizontal centering dims = blf.dimensions(0, strip.name) @@ -597,15 +597,14 @@ def on_load_post(*args): # Auto-setup the system for the new file if the active screen contains # a Sequence Editor area defining a scene with at least 1 scene strip. for scene in bpy.data.scenes: - if scene.sequence_editor: - seq_editor = scene.sequence_editor - if seq_editor and any( - isinstance(s, bpy.types.SceneSequence) for s in seq_editor.sequences - ): - sync_settings.master_scene = scene - sync_settings.enabled = True - update_sync_cache_from_current_state() - break + seq_editor = scene.sequence_editor + if not seq_editor: + continue + if any(isinstance(s, bpy.types.SceneSequence) for s in seq_editor.sequences): + sync_settings.master_scene = scene + sync_settings.enabled = True + update_sync_cache_from_current_state() + break @bpy.app.handlers.persistent @@ -18,19 +18,19 @@ class WM_OT_timeline_sync_toggle(bpy.types.Operator): sync_settings = get_sync_settings() sync_settings.enabled = not sync_settings.enabled - """NOTE: The below code is an integration with - https://github.com/The-SPA-Studios/blender - it is disabled unless space_data.scene_override - is included in master.""" - - # Setup with active space's data if applicable - # if ( - # sync_settings.enabled - # and isinstance(context.space_data, bpy.types.SpaceSequenceEditor) - # # and context.space_data.scene_override - # ): - # Use overriden scene defined in the SpaceSequence editor as master scene - # sync_settings.master_scene = context.space_data.scene_override + # NOTE: The following code block will only be executed + # if we are running a SPA version of Blender + # (https://github.com/The-SPA-Studios/blender) + # that allows for scene overrides on a space. + if hasattr(context.space_data, "scene_override"): + # Setup with active space's data if applicable + if ( + sync_settings.enabled + and isinstance(context.space_data, bpy.types.SpaceSequenceEditor) + and context.space_data.scene_override + ): + # Use overriden scene defined in the SpaceSequence editor as master scene + sync_settings.master_scene = context.space_data.scene_override # Trigger sync system update sync_system_update(context)