[Bf-extensions-cvs] [19e8c6b] master: Storypencil: Rename "slave" to "secondary"
Antonio Vazquez
noreply at git.blender.org
Tue Nov 22 20:27:54 CET 2022
Commit: 19e8c6bbf0dc048206c770c337e28c6c4c47c828
Author: Antonio Vazquez
Date: Tue Nov 22 20:27:50 2022 +0100
Branches: master
https://developer.blender.org/rBAC19e8c6bbf0dc048206c770c337e28c6c4c47c828
Storypencil: Rename "slave" to "secondary"
Old name was not used today.
===================================================================
M storypencil/__init__.py
M storypencil/dopesheet_overlay.py
M storypencil/synchro.py
===================================================================
diff --git a/storypencil/__init__.py b/storypencil/__init__.py
index e468201..b8f4536 100644
--- a/storypencil/__init__.py
+++ b/storypencil/__init__.py
@@ -57,9 +57,9 @@ classes = (
scene_tools.STORYPENCIL_OT_NewScene,
synchro.STORYPENCIL_OT_WindowBringFront,
synchro.STORYPENCIL_OT_WindowCloseOperator,
- synchro.STORYPENCIL_OT_SyncToggleSlave,
+ synchro.STORYPENCIL_OT_SyncToggleSecondary,
synchro.STORYPENCIL_OT_SetSyncMainOperator,
- synchro.STORYPENCIL_OT_AddSlaveWindowOperator,
+ synchro.STORYPENCIL_OT_AddSecondaryWindowOperator,
synchro.STORYPENCIL_OT_Switch,
render.STORYPENCIL_OT_RenderAction,
ui.STORYPENCIL_PT_Settings,
@@ -161,7 +161,7 @@ def register():
bpy.context.window_manager.storypencil_settings.active = False
bpy.context.window_manager.storypencil_settings.main_window_id = ""
- bpy.context.window_manager.storypencil_settings.slave_windows_ids = ""
+ bpy.context.window_manager.storypencil_settings.secondary_windows_ids = ""
# UI integration in dopesheet header
bpy.types.DOPESHEET_HT_header.append(synchro.draw_sync_header)
diff --git a/storypencil/dopesheet_overlay.py b/storypencil/dopesheet_overlay.py
index 754b8e5..2c00d8e 100644
--- a/storypencil/dopesheet_overlay.py
+++ b/storypencil/dopesheet_overlay.py
@@ -7,7 +7,7 @@ import gpu
from gpu_extras.batch import batch_for_shader
from .utils import (redraw_all_areas_by_type)
-from .synchro import (is_slave_window, window_id, get_main_strip)
+from .synchro import (is_secondary_window, window_id, get_main_strip)
Int3 = typing.Tuple[int, int, int]
@@ -64,7 +64,7 @@ def draw_callback_px(line_drawer: LineDrawer):
if (
not wm.storypencil_settings.active
or not wm.storypencil_settings.show_main_strip_range
- or not is_slave_window(wm, window_id(context.window))
+ or not is_secondary_window(wm, window_id(context.window))
):
return
diff --git a/storypencil/synchro.py b/storypencil/synchro.py
index 81b47b9..ecdf4cd 100644
--- a/storypencil/synchro.py
+++ b/storypencil/synchro.py
@@ -71,12 +71,12 @@ class STORYPENCIL_OT_SetSyncMainOperator(Operator):
description="Main window ID",
)
- def copy_settings(self, main_window, slave_window):
- if main_window is None or slave_window is None:
+ def copy_settings(self, main_window, secondary_window):
+ if main_window is None or secondary_window is None:
return
- slave_window.scene.storypencil_main_workspace = main_window.scene.storypencil_main_workspace
- slave_window.scene.storypencil_main_scene = main_window.scene.storypencil_main_scene
- slave_window.scene.storypencil_edit_workspace = main_window.scene.storypencil_edit_workspace
+ secondary_window.scene.storypencil_main_workspace = main_window.scene.storypencil_main_workspace
+ secondary_window.scene.storypencil_main_scene = main_window.scene.storypencil_main_scene
+ secondary_window.scene.storypencil_edit_workspace = main_window.scene.storypencil_edit_workspace
def execute(self, context):
options = context.window_manager.storypencil_settings
@@ -87,43 +87,43 @@ class STORYPENCIL_OT_SetSyncMainOperator(Operator):
main_windows = get_main_windows_list(wm)
main_window = get_main_window(wm)
- slave_window = get_slave_window(wm)
+ secondary_window = get_secondary_window(wm)
# Active sync
options.active = True
- if slave_window is None:
+ if secondary_window is None:
# Open a new window
if len(main_windows) < 2:
- bpy.ops.storypencil.create_slave_window()
- slave_window = get_slave_window(wm)
- self.copy_settings(get_main_window(wm), slave_window)
+ bpy.ops.storypencil.create_secondary_window()
+ secondary_window = get_secondary_window(wm)
+ self.copy_settings(get_main_window(wm), secondary_window)
return {'FINISHED'}
else:
# Reuse the existing window
- slave_window = get_not_main_window(wm)
+ secondary_window = get_not_main_window(wm)
else:
- # Open new slave
+ # Open new secondary
if len(main_windows) < 2:
- bpy.ops.storypencil.create_slave_window()
- slave_window = get_slave_window(wm)
- self.copy_settings(get_main_window(wm), slave_window)
+ bpy.ops.storypencil.create_secondary_window()
+ secondary_window = get_secondary_window(wm)
+ self.copy_settings(get_main_window(wm), secondary_window)
return {'FINISHED'}
else:
# Reuse the existing window
- slave_window = get_not_main_window(wm)
+ secondary_window = get_not_main_window(wm)
- if slave_window:
- enable_slave_window(wm, window_id(slave_window))
- win_id = window_id(slave_window)
- self.copy_settings(get_main_window(wm), slave_window)
+ if secondary_window:
+ enable_secondary_window(wm, window_id(secondary_window))
+ win_id = window_id(secondary_window)
+ self.copy_settings(get_main_window(wm), secondary_window)
bpy.ops.storypencil.sync_window_bring_front(win_id=win_id)
return {'FINISHED'}
-class STORYPENCIL_OT_AddSlaveWindowOperator(Operator):
- bl_idname = "storypencil.create_slave_window"
- bl_label = "Create Slave Window"
- bl_description = "Create a Slave Main Window and enable Synchronization"
+class STORYPENCIL_OT_AddSecondaryWindowOperator(Operator):
+ bl_idname = "storypencil.create_secondary_window"
+ bl_label = "Create Secondary Window"
+ bl_description = "Create a Secondary Main Window and enable Synchronization"
bl_options = {'INTERNAL'}
def execute(self, context):
@@ -133,16 +133,16 @@ class STORYPENCIL_OT_AddSlaveWindowOperator(Operator):
# get newly created window by comparing to previous list
new_window = (set(context.window_manager.windows[:]) - windows).pop()
# activate sync system and enable sync for this window
- toggle_slave_window(context.window_manager, window_id(new_window))
+ toggle_secondary_window(context.window_manager, window_id(new_window))
context.window_manager.storypencil_settings.active = True
# trigger initial synchronization to open the current Sequence's Scene
on_frame_changed()
# Configure the new window
- self.configure_new_slave_window(context, new_window)
+ self.configure_new_secondary_window(context, new_window)
return {'FINISHED'}
- def configure_new_slave_window(self, context, new_window):
+ def configure_new_secondary_window(self, context, new_window):
wrk_name = context.scene.storypencil_edit_workspace.name
override_context = context.copy()
override_context["window"] = new_window
@@ -183,7 +183,7 @@ class STORYPENCIL_OT_WindowBringFront(Operator):
class STORYPENCIL_OT_WindowCloseOperator(Operator):
- bl_idname = "storypencil.close_slave_window"
+ bl_idname = "storypencil.close_secondary_window"
bl_label = "Close Window"
bl_description = "Close a specific Window"
bl_options = {'INTERNAL'}
@@ -212,63 +212,63 @@ def validate_sync(window_manager: WindowManager) -> bool:
return window_manager.storypencil_settings.active
-def get_slave_window_indices(wm: WindowManager) -> List[str]:
- """Get slave Windows indices as a list of IDs
+def get_secondary_window_indices(wm: WindowManager) -> List[str]:
+ """Get secondary Windows indices as a list of IDs
:param wm: the WindowManager to consider
- :return: the list of slave Windows IDs
+ :return: the list of secondary Windows IDs
"""
- return split_win_ids(wm.storypencil_settings.slave_windows_ids)
+ return split_win_ids(wm.storypencil_settings.secondary_windows_ids)
-def is_slave_window(window_manager: WindowManager, win_id: str) -> bool:
- """Return wether the Window identified by 'win_id' is a slave window.
+def is_secondary_window(window_manager: WindowManager, win_id: str) -> bool:
+ """Return wether the Window identified by 'win_id' is a secondary window.
- :return: whether this Window is a sync slave
+ :return: whether this Window is a sync secondary
"""
- return win_id in get_slave_window_indices(window_manager)
+ return win_id in get_secondary_window_indices(window_manager)
-def enable_slave_window(wm: WindowManager, win_id: str):
- """Enable the slave status of a Window.
+def enable_secondary_window(wm: WindowManager, win_id: str):
+ """Enable the secondary status of a Window.
:param wm: the WindowManager instance
:param win_id: the id of the window
"""
- slave_indices = get_slave_window_indices(wm)
+ secondary_indices = get_secondary_window_indices(wm)
win_id_str = win_id
# Delete old indice if exist
- if win_id_str in slave_indices:
- slave_indices.remove(win_id_str)
+ if win_id_str in secondary_indices:
+ secondary_indices.remove(win_id_str)
# Add indice
- slave_indices.append(win_id_str)
+ secondary_indices.append(win_id_str)
- # rebuild the whole list of valid slave windows
- slave_indices = [
- idx for idx in slave_indices if get_window_from_id(wm, idx)]
+ # rebuild the whole list of valid secondary windows
+ secondary_indices = [
+ idx for idx in secondary_indices if get_window_from_id(wm, idx)]
- wm.storypencil_settings.slave_windows_ids = join_win_ids(slave_indices)
+ wm.storypencil_settings.secondary_windows_ids = join_win_ids(secondary_indices)
-def toggle_slave_window(wm: WindowManager, win_id: str):
- """Toggle the slave status of a Window.
+def toggle_secondary_window(wm: WindowManager, win_id: str):
+ """Toggle the secondary status of a Window.
:param wm: the WindowManager instance
:param win_id: the id of the window
"""
- s
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list