1 # SPDX-License-Identifier: GPL-2.0-or-later
3 # ----------------------------------------------
5 # ----------------------------------------------
7 "name": "Storypencil - Storyboard Tools",
8 "description": "Storyboard tools",
9 "author": "Antonio Vazquez, Matias Mendiola, Daniel Martinez Lara, Rodrigo Blaas, Samuel Bernou",
14 "category": "Sequencer",
17 # ----------------------------------------------
19 # ----------------------------------------------
23 importlib
.reload(utils
)
24 importlib
.reload(synchro
)
25 importlib
.reload(dopesheet_overlay
)
26 importlib
.reload(scene_tools
)
27 importlib
.reload(sound
)
28 importlib
.reload(render
)
33 from . import dopesheet_overlay
34 from . import scene_tools
40 from bpy
.types
import (
45 from bpy
.props
import (
53 # --------------------------------------------------------------
54 # Register all operators, props and panels
55 # --------------------------------------------------------------
57 synchro
.STORYPENCIL_PG_Settings
,
58 scene_tools
.STORYPENCIL_OT_Setup
,
59 scene_tools
.STORYPENCIL_OT_NewScene
,
60 synchro
.STORYPENCIL_OT_WindowBringFront
,
61 synchro
.STORYPENCIL_OT_WindowCloseOperator
,
62 synchro
.STORYPENCIL_OT_SyncToggleSecondary
,
63 synchro
.STORYPENCIL_OT_SetSyncMainOperator
,
64 synchro
.STORYPENCIL_OT_AddSecondaryWindowOperator
,
65 synchro
.STORYPENCIL_OT_Switch
,
66 synchro
.STORYPENCIL_OT_TabSwitch
,
67 sound
.STORYPENCIL_OT_duplicate_sound_in_edit_scene
,
68 render
.STORYPENCIL_OT_RenderAction
,
69 ui
.STORYPENCIL_PT_Settings
,
70 ui
.STORYPENCIL_PT_ModePanel
,
71 ui
.STORYPENCIL_PT_SettingsNew
,
72 ui
.STORYPENCIL_PT_RenderPanel
,
73 ui
.STORYPENCIL_PT_General
,
77 def save_mode(self
, context
):
78 wm
= context
.window_manager
79 if context
.scene
.storypencil_mode
== 'WINDOW':
80 context
.scene
.storypencil_use_new_window
= True
82 context
.scene
.storypencil_use_new_window
= False
84 wm
['storypencil_use_new_window'] = context
.scene
.storypencil_use_new_window
85 # Close all secondary windows
86 if context
.scene
.storypencil_use_new_window
is False:
88 for win
in context
.window_manager
.windows
:
89 # Don't close actual window
90 if win
== context
.window
:
92 win_id
= str(win
.as_pointer())
93 if win_id
!= wm
.storypencil_settings
.main_window_id
and win
.parent
is None:
95 bpy
.ops
.wm
.window_close(c
)
99 def register_keymaps():
100 addon
= bpy
.context
.window_manager
.keyconfigs
.addon
101 km
= addon
.keymaps
.new(name
="Sequencer", space_type
="SEQUENCE_EDITOR")
102 kmi
= km
.keymap_items
.new(
103 idname
="storypencil.tabswitch",
106 shift
=False, ctrl
=False, alt
= False, oskey
=False,
109 addon_keymaps
.append((km
, kmi
))
111 def unregister_keymaps():
112 for km
, kmi
in addon_keymaps
:
113 km
.keymap_items
.remove(kmi
)
114 addon_keymaps
.clear()
117 from bpy
.utils
import register_class
122 Scene
.storypencil_scene_duration
= IntProperty(
123 name
="Scene Duration",
124 description
="Default Duration for new Scene",
130 Scene
.storypencil_use_new_window
= BoolProperty(name
="Open in new window",
131 description
="Use secondary main window to edit scenes",
134 Scene
.storypencil_main_workspace
= PointerProperty(type=WorkSpace
,
135 description
="Main Workspace used for editing Storyboard")
136 Scene
.storypencil_main_scene
= PointerProperty(type=Scene
,
137 description
="Main Scene used for editing Storyboard")
138 Scene
.storypencil_edit_workspace
= PointerProperty(type=WorkSpace
,
139 description
="Workspace used for changing drawings")
141 Scene
.storypencil_base_scene
= PointerProperty(type=Scene
,
142 description
="Template Scene used for creating new scenes")
144 Scene
.storypencil_render_render_path
= StringProperty(name
="Output Path", subtype
='FILE_PATH', maxlen
=256,
145 description
="Directory/name to save files")
147 Scene
.storypencil_name_prefix
= StringProperty(name
="Scene Name Prefix", maxlen
=20, default
="")
149 Scene
.storypencil_name_suffix
= StringProperty(name
="Scene Name Suffix", maxlen
=20, default
="")
151 Scene
.storypencil_render_onlyselected
= BoolProperty(name
="Render only Selected Strips",
152 description
="Render only the selected strips",
155 Scene
.storypencil_render_channel
= IntProperty(name
="Channel",
156 description
="Channel to set the new rendered video",
157 default
=5, min=1, max=128)
159 Scene
.storypencil_add_render_strip
= BoolProperty(name
="Import Rendered Strips",
160 description
="Add a Strip with the render",
163 Scene
.storypencil_render_step
= IntProperty(name
="Image Steps",
164 description
="Minimum frames number to generate images between keyframes (0 to disable)",
165 default
=0, min=0, max=128)
167 Scene
.storypencil_render_numbering
= EnumProperty(name
="Image Numbering",
169 ('FRAME', "Frame", "Use real frame number"),
170 ('CONSECUTIVE', "Consecutive", "Use sequential numbering"),
172 description
="Defines how frame is named")
174 Scene
.storypencil_add_render_byfolder
= BoolProperty(name
="Folder by Strip",
175 description
="Create a separated folder for each strip",
178 Scene
.storypencil_copy_sounds
= BoolProperty(name
="Copy Sounds",
179 description
="Copy automatically the sounds from VSE to edit scene",
182 Scene
.storypencil_mode
= EnumProperty(name
="Mode",
184 ('SWITCH', "Switch", "Use same window and switch scene"),
185 ('WINDOW', "New Window", "Use a new window for editing"),
188 description
="Defines how frame is named")
189 Scene
.storypencil_selected_scn_only
= BoolProperty(name
='Selected Scene Only',
191 description
='Selected Scenes only')
192 Scene
.storypencil_skip_sound_mute
= BoolProperty(name
='Ignore Muted Sound',
194 description
='Skip muted sound')
196 WindowManager
.storypencil_settings
= PointerProperty(
197 type=synchro
.STORYPENCIL_PG_Settings
,
198 name
="Storypencil settings",
199 description
="Storypencil tool settings",
203 bpy
.app
.handlers
.frame_change_post
.append(synchro
.on_frame_changed
)
204 bpy
.app
.handlers
.load_post
.append(synchro
.sync_autoconfig
)
206 bpy
.context
.window_manager
.storypencil_settings
.active
= False
207 bpy
.context
.window_manager
.storypencil_settings
.main_window_id
= ""
208 bpy
.context
.window_manager
.storypencil_settings
.secondary_windows_ids
= ""
210 # UI integration in dopesheet header
211 bpy
.types
.DOPESHEET_HT_header
.append(synchro
.draw_sync_header
)
212 dopesheet_overlay
.register()
214 synchro
.sync_autoconfig()
216 # UI integration in VSE header
217 bpy
.types
.SEQUENCER_HT_header
.remove(synchro
.draw_sync_sequencer_header
)
218 bpy
.types
.SEQUENCER_HT_header
.append(synchro
.draw_sync_sequencer_header
)
220 bpy
.types
.SEQUENCER_MT_add
.append(scene_tools
.draw_new_scene
)
221 bpy
.types
.VIEW3D_MT_draw_gpencil
.append(scene_tools
.setup_storyboard
)
227 from bpy
.utils
import unregister_class
228 for cls
in reversed(classes
):
229 unregister_class(cls
)
232 bpy
.app
.handlers
.frame_change_post
.remove(synchro
.on_frame_changed
)
233 bpy
.app
.handlers
.load_post
.remove(synchro
.sync_autoconfig
)
235 # remove UI integration
236 bpy
.types
.DOPESHEET_HT_header
.remove(synchro
.draw_sync_header
)
237 dopesheet_overlay
.unregister()
238 bpy
.types
.SEQUENCER_HT_header
.remove(synchro
.draw_sync_sequencer_header
)
240 bpy
.types
.SEQUENCER_MT_add
.remove(scene_tools
.draw_new_scene
)
241 bpy
.types
.VIEW3D_MT_draw_gpencil
.remove(scene_tools
.setup_storyboard
)
243 del Scene
.storypencil_scene_duration
244 del WindowManager
.storypencil_settings
246 del Scene
.storypencil_base_scene
247 del Scene
.storypencil_main_workspace
248 del Scene
.storypencil_main_scene
249 del Scene
.storypencil_edit_workspace
251 del Scene
.storypencil_render_render_path
252 del Scene
.storypencil_name_prefix
253 del Scene
.storypencil_name_suffix
254 del Scene
.storypencil_render_onlyselected
255 del Scene
.storypencil_render_channel
256 del Scene
.storypencil_render_step
257 del Scene
.storypencil_add_render_strip
258 del Scene
.storypencil_render_numbering
259 del Scene
.storypencil_add_render_byfolder
260 del Scene
.storypencil_copy_sounds
261 del Scene
.storypencil_mode
262 del Scene
.storypencil_selected_scn_only
263 del Scene
.storypencil_skip_sound_mute
265 if __name__
== '__main__':