70 lines
1.7 KiB
Python
70 lines
1.7 KiB
Python
|
|
||
|
import time
|
||
|
|
||
|
import bpy
|
||
|
from bpy.types import Operator
|
||
|
|
||
|
from vse_toolbox.sequencer_utils import (get_strips, render_strips)
|
||
|
from vse_toolbox.bl_utils import get_scene_settings
|
||
|
|
||
|
|
||
|
|
||
|
class VSETB_OT_render(Operator):
|
||
|
bl_idname = "vse_toolbox.strips_render"
|
||
|
bl_label = "Render Shots Strips"
|
||
|
bl_description = "Render Shots Strips"
|
||
|
bl_options = {"REGISTER", "UNDO"}
|
||
|
|
||
|
#selected_only : BoolProperty(name="Selected Only", default=False)
|
||
|
|
||
|
@classmethod
|
||
|
def poll(cls, context):
|
||
|
settings = get_scene_settings()
|
||
|
return settings.active_project
|
||
|
|
||
|
def invoke(self, context, event):
|
||
|
scn = context.scene
|
||
|
settings = get_scene_settings()
|
||
|
|
||
|
return context.window_manager.invoke_props_dialog(self)
|
||
|
|
||
|
def draw(self, context):
|
||
|
scn = context.scene
|
||
|
settings = get_scene_settings()
|
||
|
|
||
|
layout = self.layout
|
||
|
col = layout.column()
|
||
|
col.use_property_split = True
|
||
|
col.use_property_decorate = False
|
||
|
#col.prop(settings, 'channel', text='Channel')
|
||
|
#col.prop(self, 'selected_only')
|
||
|
|
||
|
col.prop(settings.active_project, "render_template")
|
||
|
|
||
|
def execute(self, context):
|
||
|
scn = context.scene
|
||
|
settings = get_scene_settings()
|
||
|
strips = get_strips(channel='Shots', selected_only=True)
|
||
|
|
||
|
start_time = time.perf_counter()
|
||
|
render_strips(strips, settings.active_project.render_template)
|
||
|
|
||
|
self.report({"INFO"}, f'Strips rendered in {time.perf_counter()-start_time} seconds')
|
||
|
|
||
|
return {"FINISHED"}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
classes = (
|
||
|
VSETB_OT_render,
|
||
|
)
|
||
|
|
||
|
def register():
|
||
|
for cls in classes:
|
||
|
bpy.utils.register_class(cls)
|
||
|
|
||
|
def unregister():
|
||
|
for cls in reversed(classes):
|
||
|
bpy.utils.unregister_class(cls)
|