Ops to render selected scenes only
0.5.9 - feat: Select which scene to render - ui: `replaced render all sub-scene` by `Render Selected Scenes`main
parent
51a681b880
commit
d3871dcc88
|
@ -14,6 +14,11 @@ Activate / deactivate layer opaticty according to prefix
|
|||
Activate / deactivate all masks using MA layers
|
||||
-->
|
||||
|
||||
0.5.9
|
||||
|
||||
- feat: Select which scene to render
|
||||
- ui: `replaced render all sub-scene` by `Render Selected Scenes`
|
||||
|
||||
0.5.8
|
||||
|
||||
- fix: skipping when rendering multiscene
|
||||
|
|
|
@ -2,6 +2,10 @@ import bpy
|
|||
from . import fn
|
||||
from time import time
|
||||
|
||||
from bpy.types import Panel, UIList, Operator, PropertyGroup, Menu
|
||||
from bpy.props import PointerProperty, IntProperty, BoolProperty, StringProperty, EnumProperty, FloatProperty
|
||||
|
||||
|
||||
class GPEXP_OT_render_all_scenes(bpy.types.Operator):
|
||||
bl_idname = "gp.render_all_scenes"
|
||||
bl_label = "Render all scenes"
|
||||
|
@ -38,14 +42,78 @@ class GPEXP_OT_render_all_scenes(bpy.types.Operator):
|
|||
return {"FINISHED"}
|
||||
|
||||
|
||||
class GPEXP_scene_select_prop(PropertyGroup):
|
||||
name : StringProperty()
|
||||
select: BoolProperty()
|
||||
class GPEXP_OT_render_selected_scene(bpy.types.Operator):
|
||||
bl_idname = "gp.render_selected_scenes"
|
||||
bl_label = "Render Selected Scenes"
|
||||
bl_description = "Launch render of selected scenes with a selection popup"
|
||||
bl_options = {"REGISTER"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.scene.scenes_list.clear()
|
||||
for s in bpy.data.scenes:
|
||||
scn_item = context.scene.scenes_list.add()
|
||||
scn_item.name = s.name
|
||||
scn_item.select = s.name != 'Scene'
|
||||
|
||||
return context.window_manager.invoke_props_dialog(self, width=250)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
col = layout.column()
|
||||
for si in context.scene.scenes_list:
|
||||
row = col.row()
|
||||
row.label(text=si.name)
|
||||
row.prop(si, 'select',text='')
|
||||
|
||||
def execute(self, context):
|
||||
scn_to_render = [si.name for si in context.scene.scenes_list if si.select]
|
||||
|
||||
start = time()
|
||||
ct = 0
|
||||
for scn_name in scn_to_render:
|
||||
scn = bpy.data.scenes.get(scn_name)
|
||||
if not scn.use_nodes:
|
||||
print(f'{scn.name} has use node deactivated')
|
||||
continue
|
||||
|
||||
outfiles = [n for n in scn.node_tree.nodes if n.type == 'OUTPUT_FILE']
|
||||
if not outfiles:
|
||||
print(f'\n -!-> Skip {scn.name}, No output files')
|
||||
continue
|
||||
|
||||
if all(x.mute for x in outfiles):
|
||||
print(f'\n -!-> Skip {scn.name}, All output file are muted')
|
||||
continue
|
||||
|
||||
print(f'\n --> Rendering {scn.name}')
|
||||
# bpy.context.window.scene = scn
|
||||
bpy.ops.render.render(animation=True, scene=scn.name)
|
||||
ct += 1
|
||||
|
||||
print(f'\nDone. {ct} scenes rendered in {time()-start:.2f}s')
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
classes=(
|
||||
GPEXP_scene_select_prop,
|
||||
GPEXP_OT_render_selected_scene,
|
||||
GPEXP_OT_render_all_scenes,
|
||||
)
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
bpy.types.Scene.scenes_list = bpy.props.CollectionProperty(type=GPEXP_scene_select_prop)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
bpy.utils.unregister_class(cls)
|
||||
|
||||
del bpy.types.Scene.scenes_list
|
|
@ -2,7 +2,7 @@ bl_info = {
|
|||
"name": "GP Render",
|
||||
"description": "Organise export of gp layers through compositor output",
|
||||
"author": "Samuel Bernou",
|
||||
"version": (0, 5, 8),
|
||||
"version": (0, 5, 9),
|
||||
"blender": (2, 93, 0),
|
||||
"location": "View3D",
|
||||
"warning": "",
|
||||
|
|
4
ui.py
4
ui.py
|
@ -136,7 +136,9 @@ class GPEXP_PT_gp_node_ui(Panel):
|
|||
row.operator('gp.set_crop_from_selection', icon='CON_OBJECTSOLVER', text='Autoset Crop')
|
||||
row.operator('gp.export_crop_coord_to_json', icon='FILE', text='Export json')
|
||||
|
||||
layout.operator('gp.render_all_scenes', icon='RENDER_ANIMATION', text='Render All Sub-Scene')
|
||||
row = layout.row(align=True)
|
||||
row.operator('gp.render_selected_scenes', icon='RENDER_ANIMATION', text='Render Selected Scene')
|
||||
# row.operator('gp.render_all_scenes', icon='RENDER_ANIMATION', text='Render All')
|
||||
|
||||
layout.prop(prefs, 'advanced', text='Show Advanced Options')
|
||||
# layout.operator('gp.add_object_to_render', icon='RENDERLAYERS', text='Layer To Render').mode = 'ALL'
|
||||
|
|
Loading…
Reference in New Issue