1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
25 class RENDER_MT_presets(bpy.types.Menu):
26 bl_label = "Render Presets"
27 preset_subdir = "render"
28 preset_operator = "script.python_file_run"
29 draw = bpy.types.Menu.draw_preset
32 class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
33 bl_label = "FFMPEG Presets"
34 preset_subdir = "ffmpeg"
35 preset_operator = "script.python_file_run"
36 draw = bpy.types.Menu.draw_preset
39 class RenderButtonsPanel(bpy.types.Panel):
40 bl_space_type = 'PROPERTIES'
41 bl_region_type = 'WINDOW'
43 # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
45 def poll(self, context):
46 rd = context.scene.render
47 return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
50 class RENDER_PT_render(RenderButtonsPanel):
52 COMPAT_ENGINES = {'BLENDER_RENDER'}
54 def draw(self, context):
57 rd = context.scene.render
58 wide_ui = context.region.width > narrowui
60 split = layout.split()
63 col.operator("render.render", text="Image", icon='RENDER_STILL')
67 col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
69 layout.prop(rd, "display_mode", text="Display")
72 class RENDER_PT_layers(RenderButtonsPanel):
74 bl_default_closed = True
75 COMPAT_ENGINES = {'BLENDER_RENDER'}
77 def draw(self, context):
82 wide_ui = context.region.width > narrowui
85 row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
87 col = row.column(align=True)
88 col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
89 col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
91 rl = rd.layers[rd.active_layer_index]
94 layout.prop(rl, "name")
96 split = layout.split()
99 col.prop(scene, "visible_layers", text="Scene")
102 col.prop(rl, "visible_layers", text="Layer")
104 layout.prop(rl, "light_override", text="Light")
105 layout.prop(rl, "material_override", text="Material")
108 layout.label(text="Include:")
110 split = layout.split()
113 col.prop(rl, "zmask")
115 row.prop(rl, "zmask_negate", text="Negate")
116 row.active = rl.zmask
117 col.prop(rl, "all_z")
120 col.prop(rl, "solid")
122 col.prop(rl, "ztransp")
127 col.prop(rl, "strand")
130 split = layout.split()
131 split.label(text="Zmask Layers:")
132 split.column().prop(rl, "zmask_layers", text="")
136 split = layout.split()
139 col.label(text="Passes:")
140 col.prop(rl, "pass_combined")
141 col.prop(rl, "pass_z")
142 col.prop(rl, "pass_vector")
143 col.prop(rl, "pass_normal")
144 col.prop(rl, "pass_uv")
145 col.prop(rl, "pass_mist")
146 col.prop(rl, "pass_object_index")
147 col.prop(rl, "pass_color")
152 col.prop(rl, "pass_diffuse")
154 row.prop(rl, "pass_specular")
155 row.prop(rl, "pass_specular_exclude", text="", icon='X')
157 row.prop(rl, "pass_shadow")
158 row.prop(rl, "pass_shadow_exclude", text="", icon='X')
160 row.prop(rl, "pass_emit")
161 row.prop(rl, "pass_emit_exclude", text="", icon='X')
163 row.prop(rl, "pass_ao")
164 row.prop(rl, "pass_ao_exclude", text="", icon='X')
166 row.prop(rl, "pass_environment")
167 row.prop(rl, "pass_environment_exclude", text="", icon='X')
169 row.prop(rl, "pass_indirect")
170 row.prop(rl, "pass_indirect_exclude", text="", icon='X')
172 row.prop(rl, "pass_reflection")
173 row.prop(rl, "pass_reflection_exclude", text="", icon='X')
175 row.prop(rl, "pass_refraction")
176 row.prop(rl, "pass_refraction_exclude", text="", icon='X')
179 class RENDER_PT_shading(RenderButtonsPanel):
181 COMPAT_ENGINES = {'BLENDER_RENDER'}
183 def draw(self, context):
186 rd = context.scene.render
187 wide_ui = context.region.width > narrowui
189 split = layout.split()
192 col.prop(rd, "render_textures", text="Textures")
193 col.prop(rd, "render_shadows", text="Shadows")
194 col.prop(rd, "render_sss", text="Subsurface Scattering")
195 col.prop(rd, "render_envmaps", text="Environment Map")
199 col.prop(rd, "render_raytracing", text="Ray Tracing")
200 col.prop(rd, "color_management")
201 col.prop(rd, "alpha_mode", text="Alpha")
204 class RENDER_PT_performance(RenderButtonsPanel):
205 bl_label = "Performance"
206 bl_default_closed = True
207 COMPAT_ENGINES = {'BLENDER_RENDER'}
209 def draw(self, context):
212 rd = context.scene.render
213 wide_ui = context.region.width > narrowui
215 split = layout.split()
218 col.label(text="Threads:")
219 col.row().prop(rd, "threads_mode", expand=True)
221 sub.enabled = rd.threads_mode == 'FIXED'
222 sub.prop(rd, "threads")
223 sub = col.column(align=True)
224 sub.label(text="Tiles:")
225 sub.prop(rd, "parts_x", text="X")
226 sub.prop(rd, "parts_y", text="Y")
230 col.label(text="Memory:")
232 sub.enabled = not (rd.use_border or rd.full_sample)
233 sub.prop(rd, "save_buffers")
235 sub.active = rd.use_compositing
236 sub.prop(rd, "free_image_textures")
238 sub.active = rd.render_raytracing
239 sub.label(text="Acceleration structure:")
240 sub.prop(rd, "raytrace_structure", text="")
241 if rd.raytrace_structure == 'OCTREE':
242 sub.prop(rd, "octree_resolution", text="Resolution")
244 sub.prop(rd, "use_instances", text="Instances")
245 sub.prop(rd, "use_local_coords", text="Local Coordinates")
248 class RENDER_PT_post_processing(RenderButtonsPanel):
249 bl_label = "Post Processing"
250 bl_default_closed = True
251 COMPAT_ENGINES = {'BLENDER_RENDER'}
253 def draw(self, context):
256 rd = context.scene.render
257 wide_ui = context.region.width > narrowui
259 split = layout.split()
262 col.prop(rd, "use_compositing")
263 col.prop(rd, "use_sequencer")
267 col.prop(rd, "dither_intensity", text="Dither", slider=True)
271 split = layout.split()
274 col.prop(rd, "fields", text="Fields")
276 sub.active = rd.fields
277 sub.row().prop(rd, "field_order", expand=True)
278 sub.prop(rd, "fields_still", text="Still")
288 sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
289 sub.prop(rd, "edge_color", text="")
292 class RENDER_PT_output(RenderButtonsPanel):
294 COMPAT_ENGINES = {'BLENDER_RENDER'}
296 def draw(self, context):
299 rd = context.scene.render
300 wide_ui = context.region.width > narrowui
302 layout.prop(rd, "output_path", text="")
304 split = layout.split()
306 col.prop(rd, "file_format", text="")
307 col.row().prop(rd, "color_mode", text="Color", expand=True)
311 col.prop(rd, "use_file_extension")
312 col.prop(rd, "use_overwrite")
313 col.prop(rd, "use_placeholder")
315 if rd.file_format in ('AVI_JPEG', 'JPEG'):
316 split = layout.split()
317 split.prop(rd, "file_quality", slider=True)
319 elif rd.file_format == 'OPEN_EXR':
320 split = layout.split()
323 col.label(text="Codec:")
324 col.prop(rd, "exr_codec", text="")
327 subsplit = split.split()
328 col = subsplit.column()
329 col.prop(rd, "exr_half")
330 col.prop(rd, "exr_zbuf")
333 col = subsplit.column()
334 col.prop(rd, "exr_preview")
336 elif rd.file_format == 'JPEG2000':
337 split = layout.split()
339 col.label(text="Depth:")
340 col.row().prop(rd, "jpeg2k_depth", expand=True)
344 col.prop(rd, "jpeg2k_preset", text="")
345 col.prop(rd, "jpeg2k_ycc")
347 elif rd.file_format in ('CINEON', 'DPX'):
348 split = layout.split()
350 col.prop(rd, "cineon_log", text="Convert to Log")
353 col = split.column(align=True)
354 col.active = rd.cineon_log
355 col.prop(rd, "cineon_black", text="Black")
356 col.prop(rd, "cineon_white", text="White")
357 col.prop(rd, "cineon_gamma", text="Gamma")
359 elif rd.file_format == 'TIFF':
360 split = layout.split()
361 split.prop(rd, "tiff_bit")
363 elif rd.file_format == 'QUICKTIME_CARBON':
364 split = layout.split()
365 split.operator("scene.render_set_quicktime_codec")
367 elif rd.file_format == 'QUICKTIME_QTKIT':
368 split = layout.split()
370 col.prop(rd, "quicktime_codec_type")
371 col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
374 class RENDER_PT_encoding(RenderButtonsPanel):
375 bl_label = "Encoding"
376 bl_default_closed = True
377 COMPAT_ENGINES = {'BLENDER_RENDER'}
379 def poll(self, context):
380 rd = context.scene.render
381 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
383 def draw(self, context):
386 rd = context.scene.render
387 wide_ui = context.region.width > narrowui
389 layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
391 split = layout.split()
394 col.prop(rd, "ffmpeg_format")
395 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
398 col.prop(rd, "ffmpeg_codec")
403 split = layout.split()
406 col.prop(rd, "ffmpeg_video_bitrate")
409 col.prop(rd, "ffmpeg_gopsize")
411 split = layout.split()
414 col.label(text="Rate:")
415 col.prop(rd, "ffmpeg_minrate", text="Minimum")
416 col.prop(rd, "ffmpeg_maxrate", text="Maximum")
417 col.prop(rd, "ffmpeg_buffersize", text="Buffer")
422 col.prop(rd, "ffmpeg_autosplit")
423 col.label(text="Mux:")
424 col.prop(rd, "ffmpeg_muxrate", text="Rate")
425 col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
428 sub = layout.column()
430 if rd.ffmpeg_format not in ('MP3'):
431 sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
438 col.prop(rd, "ffmpeg_audio_bitrate")
439 col.prop(rd, "ffmpeg_audio_mixrate")
443 col.prop(rd, "ffmpeg_audio_volume", slider=True)
446 class RENDER_PT_antialiasing(RenderButtonsPanel):
447 bl_label = "Anti-Aliasing"
448 COMPAT_ENGINES = {'BLENDER_RENDER'}
450 def draw_header(self, context):
451 rd = context.scene.render
453 self.layout.prop(rd, "antialiasing", text="")
455 def draw(self, context):
458 rd = context.scene.render
459 wide_ui = context.region.width > narrowui
460 layout.active = rd.antialiasing
462 split = layout.split()
465 col.row().prop(rd, "antialiasing_samples", expand=True)
467 sub.enabled = not rd.use_border
468 sub.prop(rd, "full_sample")
472 col.prop(rd, "pixel_filter", text="")
473 col.prop(rd, "filter_size", text="Size")
476 class RENDER_PT_motion_blur(RenderButtonsPanel):
477 bl_label = "Full Sample Motion Blur"
478 bl_default_closed = True
479 COMPAT_ENGINES = {'BLENDER_RENDER'}
481 def draw_header(self, context):
482 rd = context.scene.render
484 self.layout.prop(rd, "motion_blur", text="")
486 def draw(self, context):
489 rd = context.scene.render
490 layout.active = rd.motion_blur
493 row.prop(rd, "motion_blur_samples")
496 class RENDER_PT_dimensions(RenderButtonsPanel):
497 bl_label = "Dimensions"
498 COMPAT_ENGINES = {'BLENDER_RENDER'}
500 def draw(self, context):
503 scene = context.scene
505 wide_ui = context.region.width > narrowui
507 row = layout.row().split()
508 sub = row.row(align=True).split(percentage=0.75)
509 sub.menu("RENDER_MT_presets", text="Presets")
510 sub.operator("render.preset_add", text="Add")
512 split = layout.split()
515 sub = col.column(align=True)
516 sub.label(text="Resolution:")
517 sub.prop(rd, "resolution_x", text="X")
518 sub.prop(rd, "resolution_y", text="Y")
519 sub.prop(rd, "resolution_percentage", text="")
521 sub.label(text="Aspect Ratio:")
522 sub.prop(rd, "pixel_aspect_x", text="X")
523 sub.prop(rd, "pixel_aspect_y", text="Y")
526 row.prop(rd, "use_border", text="Border")
528 sub.active = rd.use_border
529 sub.prop(rd, "crop_to_border", text="Crop")
533 sub = col.column(align=True)
534 sub.label(text="Frame Range:")
535 sub.prop(scene, "start_frame", text="Start")
536 sub.prop(scene, "end_frame", text="End")
537 sub.prop(scene, "frame_step", text="Step")
539 sub.label(text="Frame Rate:")
541 sub.prop(rd, "fps_base", text="/")
544 class RENDER_PT_stamp(RenderButtonsPanel):
546 bl_default_closed = True
547 COMPAT_ENGINES = {'BLENDER_RENDER'}
549 def draw_header(self, context):
550 rd = context.scene.render
552 self.layout.prop(rd, "render_stamp", text="")
554 def draw(self, context):
557 rd = context.scene.render
558 wide_ui = context.region.width > narrowui
560 layout.active = rd.render_stamp
562 split = layout.split()
565 col.prop(rd, "stamp_time", text="Time")
566 col.prop(rd, "stamp_date", text="Date")
567 col.prop(rd, "stamp_render_time", text="RenderTime")
568 col.prop(rd, "stamp_frame", text="Frame")
569 col.prop(rd, "stamp_scene", text="Scene")
570 col.prop(rd, "stamp_camera", text="Camera")
571 col.prop(rd, "stamp_filename", text="Filename")
572 col.prop(rd, "stamp_marker", text="Marker")
573 col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
577 col.active = rd.render_stamp
578 col.prop(rd, "stamp_foreground", slider=True)
579 col.prop(rd, "stamp_background", slider=True)
581 col.prop(rd, "stamp_font_size", text="Font Size")
583 row = layout.split(percentage=0.2)
584 row.prop(rd, "stamp_note", text="Note")
586 sub.active = rd.stamp_note
587 sub.prop(rd, "stamp_note_text", text="")
590 class RENDER_PT_bake(RenderButtonsPanel):
592 bl_default_closed = True
593 COMPAT_ENGINES = {'BLENDER_RENDER'}
595 def draw(self, context):
598 rd = context.scene.render
599 wide_ui = context.region.width > narrowui
601 layout.operator("object.bake_image", icon='RENDER_STILL')
604 layout.prop(rd, "bake_type")
606 layout.prop(rd, "bake_type", text="")
608 if rd.bake_type == 'NORMALS':
610 layout.prop(rd, "bake_normal_space")
612 layout.prop(rd, "bake_normal_space", text="")
613 elif rd.bake_type in ('DISPLACEMENT', 'AO'):
614 layout.prop(rd, "bake_normalized")
616 # col.prop(rd, "bake_aa_mode")
617 # col.prop(rd, "bake_enable_aa")
621 split = layout.split()
624 col.prop(rd, "bake_clear")
625 col.prop(rd, "bake_margin")
626 col.prop(rd, "bake_quad_split", text="Split")
630 col.prop(rd, "bake_active")
632 sub.active = rd.bake_active
633 sub.prop(rd, "bake_distance")
634 sub.prop(rd, "bake_bias")
639 RENDER_MT_ffmpeg_presets,
642 RENDER_PT_dimensions,
643 RENDER_PT_antialiasing,
644 RENDER_PT_motion_blur,
648 RENDER_PT_performance,
649 RENDER_PT_post_processing,
655 register = bpy.types.register
661 unregister = bpy.types.unregister
665 if __name__ == "__main__":