Move Anim_Setup
module into Blender_Kitsu
#5
@ -74,6 +74,10 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
|
|||||||
bl_idname = "shotbuilder.new_shot_file"
|
bl_idname = "shotbuilder.new_shot_file"
|
||||||
bl_label = "New Production Shot File"
|
bl_label = "New Production Shot File"
|
||||||
|
|
||||||
|
_timer = None
|
||||||
|
_built_shot = False
|
||||||
|
_add_vse_area = False
|
||||||
|
|
||||||
production_root: bpy.props.StringProperty( # type: ignore
|
production_root: bpy.props.StringProperty( # type: ignore
|
||||||
name="Production Root",
|
name="Production Root",
|
||||||
description="Root of the production",
|
description="Root of the production",
|
||||||
@ -104,6 +108,16 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
|
|||||||
items=production_task_type_items
|
items=production_task_type_items
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def modal(self, context, event):
|
||||||
|
if event.type == 'TIMER' and not self._add_vse_area:
|
||||||
|
# Show Storyboard/Animatic from VSE
|
||||||
|
"""Running as Modal Event because functions within execute() function like
|
||||||
|
animation_workspace_delete_others() changed UI context that needs to be refreshed.
|
||||||
|
https://docs.blender.org/api/current/info_gotcha.html#no-updates-after-changing-ui-context"""
|
||||||
|
animation_workspace_vse_area_add(self, context)
|
||||||
|
self._add_vse_area = True
|
||||||
|
return {'PASS_THROUGH'}
|
||||||
|
|
||||||
def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> Set[str]:
|
def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> Set[str]:
|
||||||
addon_prefs = prefs.addon_prefs_get(bpy.context)
|
addon_prefs = prefs.addon_prefs_get(bpy.context)
|
||||||
project = cache.project_active_get()
|
project = cache.project_active_get()
|
||||||
@ -152,6 +166,10 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
|
|||||||
return cast(Set[str], context.window_manager.invoke_props_dialog(self, width=400))
|
return cast(Set[str], context.window_manager.invoke_props_dialog(self, width=400))
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context) -> Set[str]:
|
def execute(self, context: bpy.types.Context) -> Set[str]:
|
||||||
|
wm = context.window_manager
|
||||||
|
self._timer = wm.event_timer_add(0.1, window=context.window)
|
||||||
|
wm.modal_handler_add(self)
|
||||||
|
if not self._built_shot:
|
||||||
if not self.production_root:
|
if not self.production_root:
|
||||||
self.report(
|
self.report(
|
||||||
{'ERROR'}, "Shot builder can only be started from the File menu. Shortcuts like CTRL-N don't work")
|
{'ERROR'}, "Shot builder can only be started from the File menu. Shortcuts like CTRL-N don't work")
|
||||||
@ -180,10 +198,9 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
|
|||||||
# Set Shot Frame Range
|
# Set Shot Frame Range
|
||||||
context.scene.frame_start = addon_prefs.shot_builder_frame_offset
|
context.scene.frame_start = addon_prefs.shot_builder_frame_offset
|
||||||
context.scene.frame_end = shot.nb_frames + addon_prefs.shot_builder_frame_offset
|
context.scene.frame_end = shot.nb_frames + addon_prefs.shot_builder_frame_offset
|
||||||
|
self._built_shot = True
|
||||||
# Show Storyboard/Animatic from VSE
|
return {'RUNNING_MODAL'}
|
||||||
#animation_workspace_vse_area_add(self, context) # TODO FIX BECAUSE THIS DOESN"T RUN https://docs.blender.org/api/current/info_gotcha.html#no-updates-after-changing-ui-context
|
if self._built_shot and self._add_vse_area:
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
def draw(self, context: bpy.types.Context) -> None:
|
def draw(self, context: bpy.types.Context) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user