Files
scene-renderer/scene_renderer/panel.py

128 lines
4.6 KiB
Python

import bpy
class SCENERENDERER_PT_panel(bpy.types.Panel):
bl_label = "Scene Renderer"
bl_idname = "SCENERENDERER_PT_panel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Scene Renderer"
def draw(self, context):
layout = self.layout
settings = context.scene.scene_renderer
# --- General toggles ---
row = layout.row(align=True)
row.prop(settings, "test_mode", toggle=True)
row.prop(settings, "skip_existing", toggle=True)
layout.prop(settings, "use_cpu")
# --- Resolution ---
box = layout.box()
row = box.row()
row.prop(settings, "override_resolution")
if settings.override_resolution:
col = box.column(align=True)
col.prop(settings, "resolution_x")
col.prop(settings, "resolution_y")
col.prop(settings, "resolution_percentage", slider=True)
# --- Sampling ---
box = layout.box()
box.label(text="Sampling", icon='OUTLINER_OB_LIGHT')
box.prop(settings, "samples")
box.prop(settings, "min_samples")
row = box.row()
row.prop(settings, "use_noise_threshold", text="Noise Threshold")
sub = row.row()
sub.active = settings.use_noise_threshold
sub.prop(settings, "noise_threshold", text="")
box.prop(settings, "time_limit")
# --- Denoising ---
box = layout.box()
box.label(text="Denoising", icon='MOD_SMOOTH')
box.prop(settings, "use_denoising")
if settings.use_denoising:
box.prop(settings, "denoiser")
box.prop(settings, "denoising_input_passes")
# --- Light Bounces ---
box = layout.box()
box.label(text="Light Bounces", icon='LIGHT_SUN')
box.prop(settings, "max_bounces")
col = box.column(align=True)
col.prop(settings, "diffuse_bounces")
col.prop(settings, "glossy_bounces")
col.prop(settings, "transmission_bounces")
col.prop(settings, "transparent_max_bounces")
col.prop(settings, "volume_bounces")
# --- Clamping ---
box = layout.box()
row = box.row()
row.prop(settings, "use_clamping")
if settings.use_clamping:
col = box.column(align=True)
col.prop(settings, "clamp_direct")
col.prop(settings, "clamp_indirect")
# --- Film ---
box = layout.box()
box.label(text="Film", icon='CAMERA_DATA')
box.prop(settings, "film_transparent")
box.prop(settings, "film_filter_width")
# --- Output ---
box = layout.box()
box.label(text="Output", icon='OUTPUT')
box.prop(settings, "output_format")
# Color depth only for formats that support it
if settings.output_format in ('PNG', 'TIFF', 'OPEN_EXR'):
box.prop(settings, "color_depth")
# --- Color Management ---
box = layout.box()
box.label(text="Color", icon='SHADING_RENDERED')
box.prop(settings, "exposure", slider=True)
box.prop(settings, "look")
# --- Render button ---
layout.separator()
from . import operators
if operators.g_is_rendering:
scene_name = ""
if len(operators.g_scenes_to_render) > 0 and operators.g_render_index > 0:
scene_name = operators.g_scenes_to_render[operators.g_render_index - 1]
layout.label(text=f"Rendering: {scene_name} ({operators.g_render_index}/{len(operators.g_scenes_to_render)})", icon='SCENE_DATA')
if operators.g_progress_text:
layout.label(text=operators.g_progress_text, icon='TIME')
else:
layout.label(text="Initializing...", icon='TIME')
row = layout.row(align=True)
row.scale_y = 2.0
row.operator(
"scenerenderer.cancel_batch",
text="Cancel Render",
icon='CANCEL',
)
else:
row = layout.row(align=True)
row.scale_y = 2.0
op1 = row.operator("scenerenderer.render_all", text="Current Scene", icon='RENDER_STILL')
op1.render_only_current = True
op2 = row.operator("scenerenderer.render_all", text="All Scenes", icon='RENDER_ANIMATION')
op2.render_only_current = False
layout.separator()
row = layout.row(align=True)
row.scale_y = 2.0
row.operator("scenerenderer.launch_swarm", text="Start Render Swarm (Network)", icon='NODETREE')