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.execute_preset"
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, "layers", text="Scene")
101 col.prop(rl, "light_override", text="Light")
102 col.prop(rl, "material_override", text="Material")
105 col.prop(rl, "visible_layers", text="Layer")
106 col.label(text="Mask Layers:")
107 col.prop(rl, "zmask_layers", text="")
112 layout.label(text="Include:")
114 split = layout.split()
117 col.prop(rl, "zmask")
119 row.prop(rl, "zmask_negate", text="Negate")
120 row.active = rl.zmask
121 col.prop(rl, "all_z")
124 col.prop(rl, "solid")
126 col.prop(rl, "ztransp")
131 col.prop(rl, "strand")
135 split = layout.split()
138 col.label(text="Passes:")
139 col.prop(rl, "pass_combined")
140 col.prop(rl, "pass_z")
141 col.prop(rl, "pass_vector")
142 col.prop(rl, "pass_normal")
143 col.prop(rl, "pass_uv")
144 col.prop(rl, "pass_mist")
145 col.prop(rl, "pass_object_index")
146 col.prop(rl, "pass_color")
151 col.prop(rl, "pass_diffuse")
153 row.prop(rl, "pass_specular")
154 row.prop(rl, "pass_specular_exclude", text="")
156 row.prop(rl, "pass_shadow")
157 row.prop(rl, "pass_shadow_exclude", text="")
159 row.prop(rl, "pass_emit")
160 row.prop(rl, "pass_emit_exclude", text="")
162 row.prop(rl, "pass_ao")
163 row.prop(rl, "pass_ao_exclude", text="")
165 row.prop(rl, "pass_environment")
166 row.prop(rl, "pass_environment_exclude", text="")
168 row.prop(rl, "pass_indirect")
169 row.prop(rl, "pass_indirect_exclude", text="")
171 row.prop(rl, "pass_reflection")
172 row.prop(rl, "pass_reflection_exclude", text="")
174 row.prop(rl, "pass_refraction")
175 row.prop(rl, "pass_refraction_exclude", text="")
178 class RENDER_PT_shading(RenderButtonsPanel):
180 COMPAT_ENGINES = {'BLENDER_RENDER'}
182 def draw(self, context):
185 rd = context.scene.render
186 wide_ui = context.region.width > narrowui
188 split = layout.split()
191 col.prop(rd, "render_textures", text="Textures")
192 col.prop(rd, "render_shadows", text="Shadows")
193 col.prop(rd, "render_sss", text="Subsurface Scattering")
194 col.prop(rd, "render_envmaps", text="Environment Map")
198 col.prop(rd, "render_raytracing", text="Ray Tracing")
199 col.prop(rd, "color_management")
200 col.prop(rd, "alpha_mode", text="Alpha")
203 class RENDER_PT_performance(RenderButtonsPanel):
204 bl_label = "Performance"
205 bl_default_closed = True
206 COMPAT_ENGINES = {'BLENDER_RENDER'}
208 def draw(self, context):
211 rd = context.scene.render
212 wide_ui = context.region.width > narrowui
214 split = layout.split()
217 col.label(text="Threads:")
218 col.row().prop(rd, "threads_mode", expand=True)
220 sub.enabled = rd.threads_mode == 'FIXED'
221 sub.prop(rd, "threads")
222 sub = col.column(align=True)
223 sub.label(text="Tiles:")
224 sub.prop(rd, "parts_x", text="X")
225 sub.prop(rd, "parts_y", text="Y")
229 col.label(text="Memory:")
231 sub.enabled = not (rd.use_border or rd.full_sample)
232 sub.prop(rd, "save_buffers")
234 sub.active = rd.use_compositing
235 sub.prop(rd, "free_image_textures")
237 sub.active = rd.render_raytracing
238 sub.label(text="Acceleration structure:")
239 sub.prop(rd, "raytrace_structure", text="")
240 if rd.raytrace_structure == 'OCTREE':
241 sub.prop(rd, "octree_resolution", text="Resolution")
243 sub.prop(rd, "use_instances", text="Instances")
244 sub.prop(rd, "use_local_coords", text="Local Coordinates")
247 class RENDER_PT_post_processing(RenderButtonsPanel):
248 bl_label = "Post Processing"
249 bl_default_closed = True
250 COMPAT_ENGINES = {'BLENDER_RENDER'}
252 def draw(self, context):
255 rd = context.scene.render
256 wide_ui = context.region.width > narrowui
258 split = layout.split()
261 col.prop(rd, "use_compositing")
262 col.prop(rd, "use_sequencer")
266 col.prop(rd, "dither_intensity", text="Dither", slider=True)
270 split = layout.split()
273 col.prop(rd, "fields", text="Fields")
275 sub.active = rd.fields
276 sub.row().prop(rd, "field_order", expand=True)
277 sub.prop(rd, "fields_still", text="Still")
287 sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
288 sub.prop(rd, "edge_color", text="")
291 class RENDER_PT_output(RenderButtonsPanel):
293 COMPAT_ENGINES = {'BLENDER_RENDER'}
295 def draw(self, context):
298 rd = context.scene.render
299 wide_ui = context.region.width > narrowui
301 layout.prop(rd, "output_path", text="")
303 split = layout.split()
305 col.prop(rd, "file_format", text="")
306 col.row().prop(rd, "color_mode", text="Color", expand=True)
310 col.prop(rd, "use_file_extension")
311 col.prop(rd, "use_overwrite")
312 col.prop(rd, "use_placeholder")
314 if rd.file_format in ('AVI_JPEG', 'JPEG'):
315 split = layout.split()
316 split.prop(rd, "file_quality", slider=True)
318 elif rd.file_format == 'OPEN_EXR':
319 split = layout.split()
322 col.label(text="Codec:")
323 col.prop(rd, "exr_codec", text="")
326 subsplit = split.split()
327 col = subsplit.column()
328 col.prop(rd, "exr_half")
329 col.prop(rd, "exr_zbuf")
332 col = subsplit.column()
333 col.prop(rd, "exr_preview")
335 elif rd.file_format == 'JPEG2000':
336 split = layout.split()
338 col.label(text="Depth:")
339 col.row().prop(rd, "jpeg2k_depth", expand=True)
343 col.prop(rd, "jpeg2k_preset", text="")
344 col.prop(rd, "jpeg2k_ycc")
346 elif rd.file_format in ('CINEON', 'DPX'):
347 split = layout.split()
349 col.prop(rd, "cineon_log", text="Convert to Log")
352 col = split.column(align=True)
353 col.active = rd.cineon_log
354 col.prop(rd, "cineon_black", text="Black")
355 col.prop(rd, "cineon_white", text="White")
356 col.prop(rd, "cineon_gamma", text="Gamma")
358 elif rd.file_format == 'TIFF':
359 split = layout.split()
360 split.prop(rd, "tiff_bit")
362 elif rd.file_format == 'QUICKTIME_CARBON':
363 split = layout.split()
364 split.operator("scene.render_data_set_quicktime_codec")
366 elif rd.file_format == 'QUICKTIME_QTKIT':
367 split = layout.split()
369 col.prop(rd, "quicktime_codec_type", text="Video Codec")
370 col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
373 col.prop(rd, "quicktime_audiocodec_type", text="Audio Codec")
374 if rd.quicktime_audiocodec_type != 'No audio':
375 split = layout.split()
377 if rd.quicktime_audiocodec_type == 'LPCM':
378 col.prop(rd, "quicktime_audio_bitdepth", text="")
381 col.prop(rd, "quicktime_audio_samplerate", text="")
383 split = layout.split()
385 if rd.quicktime_audiocodec_type == 'AAC':
386 col.prop(rd, "quicktime_audio_bitrate")
388 subsplit = split.split()
389 col = subsplit.column()
390 if rd.quicktime_audiocodec_type == 'AAC':
391 col.prop(rd, "quicktime_audio_codec_isvbr")
393 col = subsplit.column()
394 col.prop(rd, "quicktime_audio_resampling_hq")
397 class RENDER_PT_encoding(RenderButtonsPanel):
398 bl_label = "Encoding"
399 bl_default_closed = True
400 COMPAT_ENGINES = {'BLENDER_RENDER'}
402 def poll(self, context):
403 rd = context.scene.render
404 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
406 def draw(self, context):
409 rd = context.scene.render
410 wide_ui = context.region.width > narrowui
412 layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
414 split = layout.split()
417 col.prop(rd, "ffmpeg_format")
418 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
421 col.prop(rd, "ffmpeg_codec")
426 split = layout.split()
429 col.prop(rd, "ffmpeg_video_bitrate")
432 col.prop(rd, "ffmpeg_gopsize")
434 split = layout.split()
437 col.label(text="Rate:")
438 col.prop(rd, "ffmpeg_minrate", text="Minimum")
439 col.prop(rd, "ffmpeg_maxrate", text="Maximum")
440 col.prop(rd, "ffmpeg_buffersize", text="Buffer")
445 col.prop(rd, "ffmpeg_autosplit")
446 col.label(text="Mux:")
447 col.prop(rd, "ffmpeg_muxrate", text="Rate")
448 col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
451 sub = layout.column()
453 if rd.ffmpeg_format not in ('MP3'):
454 sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
461 col.prop(rd, "ffmpeg_audio_bitrate")
462 col.prop(rd, "ffmpeg_audio_mixrate")
466 col.prop(rd, "ffmpeg_audio_volume", slider=True)
469 class RENDER_PT_antialiasing(RenderButtonsPanel):
470 bl_label = "Anti-Aliasing"
471 COMPAT_ENGINES = {'BLENDER_RENDER'}
473 def draw_header(self, context):
474 rd = context.scene.render
476 self.layout.prop(rd, "antialiasing", text="")
478 def draw(self, context):
481 rd = context.scene.render
482 wide_ui = context.region.width > narrowui
483 layout.active = rd.antialiasing
485 split = layout.split()
488 col.row().prop(rd, "antialiasing_samples", expand=True)
490 sub.enabled = not rd.use_border
491 sub.prop(rd, "full_sample")
495 col.prop(rd, "pixel_filter", text="")
496 col.prop(rd, "filter_size", text="Size")
499 class RENDER_PT_motion_blur(RenderButtonsPanel):
500 bl_label = "Full Sample Motion Blur"
501 bl_default_closed = True
502 COMPAT_ENGINES = {'BLENDER_RENDER'}
504 def draw_header(self, context):
505 rd = context.scene.render
507 self.layout.prop(rd, "motion_blur", text="")
509 def draw(self, context):
512 rd = context.scene.render
513 layout.active = rd.motion_blur
516 row.prop(rd, "motion_blur_samples")
519 class RENDER_PT_dimensions(RenderButtonsPanel):
520 bl_label = "Dimensions"
521 COMPAT_ENGINES = {'BLENDER_RENDER'}
523 def draw(self, context):
526 scene = context.scene
528 wide_ui = context.region.width > narrowui
530 row = layout.row().split()
531 sub = row.row(align=True).split(percentage=0.75)
532 sub.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
533 sub.operator("render.preset_add", text="", icon="ZOOMIN")
535 split = layout.split()
538 sub = col.column(align=True)
539 sub.label(text="Resolution:")
540 sub.prop(rd, "resolution_x", text="X")
541 sub.prop(rd, "resolution_y", text="Y")
542 sub.prop(rd, "resolution_percentage", text="")
544 sub.label(text="Aspect Ratio:")
545 sub.prop(rd, "pixel_aspect_x", text="X")
546 sub.prop(rd, "pixel_aspect_y", text="Y")
549 row.prop(rd, "use_border", text="Border")
551 sub.active = rd.use_border
552 sub.prop(rd, "crop_to_border", text="Crop")
556 sub = col.column(align=True)
557 sub.label(text="Frame Range:")
558 sub.prop(scene, "frame_start", text="Start")
559 sub.prop(scene, "frame_end", text="End")
560 sub.prop(scene, "frame_step", text="Step")
562 sub.label(text="Frame Rate:")
564 sub.prop(rd, "fps_base", text="/")
567 class RENDER_PT_stamp(RenderButtonsPanel):
569 bl_default_closed = True
570 COMPAT_ENGINES = {'BLENDER_RENDER'}
572 def draw_header(self, context):
573 rd = context.scene.render
575 self.layout.prop(rd, "render_stamp", text="")
577 def draw(self, context):
580 rd = context.scene.render
581 wide_ui = context.region.width > narrowui
583 layout.active = rd.render_stamp
585 split = layout.split()
588 col.prop(rd, "stamp_time", text="Time")
589 col.prop(rd, "stamp_date", text="Date")
590 col.prop(rd, "stamp_render_time", text="RenderTime")
591 col.prop(rd, "stamp_frame", text="Frame")
592 col.prop(rd, "stamp_scene", text="Scene")
593 col.prop(rd, "stamp_camera", text="Camera")
594 col.prop(rd, "stamp_filename", text="Filename")
595 col.prop(rd, "stamp_marker", text="Marker")
596 col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
600 col.active = rd.render_stamp
601 col.prop(rd, "stamp_foreground", slider=True)
602 col.prop(rd, "stamp_background", slider=True)
604 col.prop(rd, "stamp_font_size", text="Font Size")
606 row = layout.split(percentage=0.2)
607 row.prop(rd, "stamp_note", text="Note")
609 sub.active = rd.stamp_note
610 sub.prop(rd, "stamp_note_text", text="")
613 class RENDER_PT_bake(RenderButtonsPanel):
615 bl_default_closed = True
616 COMPAT_ENGINES = {'BLENDER_RENDER'}
618 def draw(self, context):
621 rd = context.scene.render
622 wide_ui = context.region.width > narrowui
624 layout.operator("object.bake_image", icon='RENDER_STILL')
627 layout.prop(rd, "bake_type")
629 layout.prop(rd, "bake_type", text="")
631 if rd.bake_type == 'NORMALS':
633 layout.prop(rd, "bake_normal_space")
635 layout.prop(rd, "bake_normal_space", text="")
636 elif rd.bake_type in ('DISPLACEMENT', 'AO'):
637 layout.prop(rd, "bake_normalized")
639 # col.prop(rd, "bake_aa_mode")
640 # col.prop(rd, "bake_enable_aa")
644 split = layout.split()
647 col.prop(rd, "bake_clear")
648 col.prop(rd, "bake_margin")
649 col.prop(rd, "bake_quad_split", text="Split")
653 col.prop(rd, "bake_active")
655 sub.active = rd.bake_active
656 sub.prop(rd, "bake_distance")
657 sub.prop(rd, "bake_bias")
662 RENDER_MT_ffmpeg_presets,
665 RENDER_PT_dimensions,
666 RENDER_PT_antialiasing,
667 RENDER_PT_motion_blur,
671 RENDER_PT_performance,
672 RENDER_PT_post_processing,
678 register = bpy.types.register
684 unregister = bpy.types.unregister
688 if __name__ == "__main__":