1 # SPDX-FileCopyrightText: 2022-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 # ----------------------------------------------
7 # ----------------------------------------------
9 "name": "Storypencil - Storyboard Tools",
10 "description": "Storyboard tools",
11 "author": "Antonio Vazquez, Matias Mendiola, Daniel Martinez Lara, Rodrigo Blaas, Samuel Bernou",
16 "category": "Sequencer",
19 # ----------------------------------------------
21 # ----------------------------------------------
25 importlib
.reload(utils
)
26 importlib
.reload(synchro
)
27 importlib
.reload(dopesheet_overlay
)
28 importlib
.reload(scene_tools
)
29 importlib
.reload(sound
)
30 importlib
.reload(render
)
35 from . import dopesheet_overlay
36 from . import scene_tools
42 from bpy
.types
import (
47 from bpy
.props
import (
55 # --------------------------------------------------------------
56 # Register all operators, props and panels
57 # --------------------------------------------------------------
59 synchro
.STORYPENCIL_PG_Settings
,
60 scene_tools
.STORYPENCIL_OT_Setup
,
61 scene_tools
.STORYPENCIL_OT_NewScene
,
62 synchro
.STORYPENCIL_OT_WindowBringFront
,
63 synchro
.STORYPENCIL_OT_WindowCloseOperator
,
64 synchro
.STORYPENCIL_OT_SyncToggleSecondary
,
65 synchro
.STORYPENCIL_OT_SetSyncMainOperator
,
66 synchro
.STORYPENCIL_OT_AddSecondaryWindowOperator
,
67 synchro
.STORYPENCIL_OT_Switch
,
68 synchro
.STORYPENCIL_OT_TabSwitch
,
69 sound
.STORYPENCIL_OT_duplicate_sound_in_edit_scene
,
70 render
.STORYPENCIL_OT_RenderAction
,
71 ui
.STORYPENCIL_PT_Settings
,
72 ui
.STORYPENCIL_PT_ModePanel
,
73 ui
.STORYPENCIL_PT_SettingsNew
,
74 ui
.STORYPENCIL_PT_RenderPanel
,
75 ui
.STORYPENCIL_PT_General
,
79 def save_mode(self
, context
):
80 wm
= context
.window_manager
81 if context
.scene
.storypencil_mode
== 'WINDOW':
82 context
.scene
.storypencil_use_new_window
= True
84 context
.scene
.storypencil_use_new_window
= False
86 wm
['storypencil_use_new_window'] = context
.scene
.storypencil_use_new_window
87 # Close all secondary windows
88 if context
.scene
.storypencil_use_new_window
is False:
90 for win
in context
.window_manager
.windows
:
91 # Don't close actual window
92 if win
== context
.window
:
94 win_id
= str(win
.as_pointer())
95 if win_id
!= wm
.storypencil_settings
.main_window_id
and win
.parent
is None:
97 bpy
.ops
.wm
.window_close(c
)
101 def register_keymaps():
102 kc
= bpy
.context
.window_manager
.keyconfigs
.addon
105 km
= kc
.keymaps
.new(name
="Sequencer", space_type
="SEQUENCE_EDITOR")
106 kmi
= km
.keymap_items
.new(
107 idname
="storypencil.tabswitch",
110 shift
=False, ctrl
=False, alt
= False, oskey
=False,
113 addon_keymaps
.append((km
, kmi
))
115 def unregister_keymaps():
116 for km
, kmi
in addon_keymaps
:
117 km
.keymap_items
.remove(kmi
)
118 addon_keymaps
.clear()
121 from bpy
.utils
import register_class
126 Scene
.storypencil_scene_duration
= IntProperty(
127 name
="Scene Duration",
128 description
="Default Duration for new Scene",
134 Scene
.storypencil_use_new_window
= BoolProperty(name
="Open in new window",
135 description
="Use secondary main window to edit scenes",
138 Scene
.storypencil_main_workspace
= PointerProperty(type=WorkSpace
,
139 description
="Main Workspace used for editing Storyboard")
140 Scene
.storypencil_main_scene
= PointerProperty(type=Scene
,
141 description
="Main Scene used for editing Storyboard")
142 Scene
.storypencil_edit_workspace
= PointerProperty(type=WorkSpace
,
143 description
="Workspace used for changing drawings")
145 Scene
.storypencil_base_scene
= PointerProperty(type=Scene
,
146 description
="Template Scene used for creating new scenes")
148 Scene
.storypencil_render_render_path
= StringProperty(name
="Output Path", subtype
='FILE_PATH', maxlen
=256,
149 description
="Directory/name to save files")
151 Scene
.storypencil_name_prefix
= StringProperty(name
="Scene Name Prefix", maxlen
=20, default
="")
153 Scene
.storypencil_name_suffix
= StringProperty(name
="Scene Name Suffix", maxlen
=20, default
="")
155 Scene
.storypencil_render_onlyselected
= BoolProperty(name
="Render only Selected Strips",
156 description
="Render only the selected strips",
159 Scene
.storypencil_render_channel
= IntProperty(name
="Channel",
160 description
="Channel to set the new rendered video",
161 default
=5, min=1, max=128)
163 Scene
.storypencil_add_render_strip
= BoolProperty(name
="Import Rendered Strips",
164 description
="Add a Strip with the render",
167 Scene
.storypencil_render_step
= IntProperty(name
="Image Steps",
168 description
="Minimum frames number to generate images between keyframes (0 to disable)",
169 default
=0, min=0, max=128)
171 Scene
.storypencil_render_numbering
= EnumProperty(name
="Image Numbering",
173 ('FRAME', "Frame", "Use real frame number"),
174 ('CONSECUTIVE', "Consecutive", "Use sequential numbering"),
176 description
="Defines how frame is named")
178 Scene
.storypencil_add_render_byfolder
= BoolProperty(name
="Folder by Strip",
179 description
="Create a separated folder for each strip",
182 Scene
.storypencil_copy_sounds
= BoolProperty(name
="Copy Sounds",
183 description
="Copy automatically the sounds from VSE to edit scene",
186 Scene
.storypencil_mode
= EnumProperty(name
="Mode",
188 ('SWITCH', "Switch", "Use same window and switch scene"),
189 ('WINDOW', "New Window", "Use a new window for editing"),
192 description
="Defines how frame is named")
193 Scene
.storypencil_selected_scn_only
= BoolProperty(name
='Selected Scene Only',
195 description
='Selected Scenes only')
196 Scene
.storypencil_skip_sound_mute
= BoolProperty(name
='Ignore Muted Sound',
198 description
='Skip muted sound')
200 WindowManager
.storypencil_settings
= PointerProperty(
201 type=synchro
.STORYPENCIL_PG_Settings
,
202 name
="Storypencil settings",
203 description
="Storypencil tool settings",
207 bpy
.app
.handlers
.frame_change_post
.append(synchro
.on_frame_changed
)
208 bpy
.app
.handlers
.load_post
.append(synchro
.sync_autoconfig
)
210 bpy
.context
.window_manager
.storypencil_settings
.active
= False
211 bpy
.context
.window_manager
.storypencil_settings
.main_window_id
= ""
212 bpy
.context
.window_manager
.storypencil_settings
.secondary_windows_ids
= ""
214 # UI integration in dopesheet header
215 bpy
.types
.DOPESHEET_HT_header
.append(synchro
.draw_sync_header
)
216 dopesheet_overlay
.register()
218 synchro
.sync_autoconfig()
220 # UI integration in VSE header
221 bpy
.types
.SEQUENCER_HT_header
.remove(synchro
.draw_sync_sequencer_header
)
222 bpy
.types
.SEQUENCER_HT_header
.append(synchro
.draw_sync_sequencer_header
)
224 bpy
.types
.SEQUENCER_MT_add
.append(scene_tools
.draw_new_scene
)
225 bpy
.types
.VIEW3D_MT_draw_gpencil
.append(scene_tools
.setup_storyboard
)
231 from bpy
.utils
import unregister_class
232 for cls
in reversed(classes
):
233 unregister_class(cls
)
236 bpy
.app
.handlers
.frame_change_post
.remove(synchro
.on_frame_changed
)
237 bpy
.app
.handlers
.load_post
.remove(synchro
.sync_autoconfig
)
239 # remove UI integration
240 bpy
.types
.DOPESHEET_HT_header
.remove(synchro
.draw_sync_header
)
241 dopesheet_overlay
.unregister()
242 bpy
.types
.SEQUENCER_HT_header
.remove(synchro
.draw_sync_sequencer_header
)
244 bpy
.types
.SEQUENCER_MT_add
.remove(scene_tools
.draw_new_scene
)
245 bpy
.types
.VIEW3D_MT_draw_gpencil
.remove(scene_tools
.setup_storyboard
)
247 del Scene
.storypencil_scene_duration
248 del WindowManager
.storypencil_settings
250 del Scene
.storypencil_base_scene
251 del Scene
.storypencil_main_workspace
252 del Scene
.storypencil_main_scene
253 del Scene
.storypencil_edit_workspace
255 del Scene
.storypencil_render_render_path
256 del Scene
.storypencil_name_prefix
257 del Scene
.storypencil_name_suffix
258 del Scene
.storypencil_render_onlyselected
259 del Scene
.storypencil_render_channel
260 del Scene
.storypencil_render_step
261 del Scene
.storypencil_add_render_strip
262 del Scene
.storypencil_render_numbering
263 del Scene
.storypencil_add_render_byfolder
264 del Scene
.storypencil_copy_sounds
265 del Scene
.storypencil_mode
266 del Scene
.storypencil_selected_scn_only
267 del Scene
.storypencil_skip_sound_mute
269 if __name__
== '__main__':