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")
128 col.prop(rl, "freestyle")
131 split = layout.split()
132 split.label(text="Zmask Layers:")
133 split.column().prop(rl, "zmask_layers", text="")
137 split = layout.split()
140 col.label(text="Passes:")
141 col.prop(rl, "pass_combined")
142 col.prop(rl, "pass_z")
143 col.prop(rl, "pass_vector")
144 col.prop(rl, "pass_normal")
145 col.prop(rl, "pass_uv")
146 col.prop(rl, "pass_mist")
147 col.prop(rl, "pass_object_index")
148 col.prop(rl, "pass_color")
153 col.prop(rl, "pass_diffuse")
155 row.prop(rl, "pass_specular")
156 row.prop(rl, "pass_specular_exclude", text="", icon='X')
158 row.prop(rl, "pass_shadow")
159 row.prop(rl, "pass_shadow_exclude", text="", icon='X')
161 row.prop(rl, "pass_emit")
162 row.prop(rl, "pass_emit_exclude", text="", icon='X')
164 row.prop(rl, "pass_ao")
165 row.prop(rl, "pass_ao_exclude", text="", icon='X')
167 row.prop(rl, "pass_environment")
168 row.prop(rl, "pass_environment_exclude", text="", icon='X')
170 row.prop(rl, "pass_indirect")
171 row.prop(rl, "pass_indirect_exclude", text="", icon='X')
173 row.prop(rl, "pass_reflection")
174 row.prop(rl, "pass_reflection_exclude", text="", icon='X')
176 row.prop(rl, "pass_refraction")
177 row.prop(rl, "pass_refraction_exclude", text="", icon='X')
182 split = layout.split()
185 col.label(text="Freestyle:")
186 freestyle = rl.freestyle_settings
187 col.prop(freestyle, "sphere_radius", text="Sphere Radius")
188 col.prop(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
189 col.prop(freestyle, "suggestive_contours", text="Suggestive Contours")
190 col.prop(freestyle, "dkr_epsilon", text="Dkr Epsilon")
192 col.operator("scene.freestyle_module_add", text="Add Style Module")
194 for i, module in enumerate(freestyle.modules):
196 box.set_context_pointer("freestyle_module", module)
197 row = box.row(align=True)
198 row.prop(module, "is_displayed", text="")
199 row.prop(module, "module_path", text="")
200 row.operator("scene.freestyle_module_remove", icon='X', text="")
201 props = row.operator("scene.freestyle_module_move_up", icon='MOVE_UP_VEC', text="")
202 props.active = (i > 0)
203 props = row.operator("scene.freestyle_module_move_down", icon='MOVE_DOWN_VEC', text="")
204 props.active = (i < len(freestyle.modules) - 1)
207 class RENDER_PT_shading(RenderButtonsPanel):
209 COMPAT_ENGINES = {'BLENDER_RENDER'}
211 def draw(self, context):
214 rd = context.scene.render
215 wide_ui = context.region.width > narrowui
217 split = layout.split()
220 col.prop(rd, "render_textures", text="Textures")
221 col.prop(rd, "render_shadows", text="Shadows")
222 col.prop(rd, "render_sss", text="Subsurface Scattering")
223 col.prop(rd, "render_envmaps", text="Environment Map")
227 col.prop(rd, "render_raytracing", text="Ray Tracing")
228 col.prop(rd, "color_management")
229 col.prop(rd, "alpha_mode", text="Alpha")
232 class RENDER_PT_performance(RenderButtonsPanel):
233 bl_label = "Performance"
234 bl_default_closed = True
235 COMPAT_ENGINES = {'BLENDER_RENDER'}
237 def draw(self, context):
240 rd = context.scene.render
241 wide_ui = context.region.width > narrowui
243 split = layout.split()
246 col.label(text="Threads:")
247 col.row().prop(rd, "threads_mode", expand=True)
249 sub.enabled = rd.threads_mode == 'FIXED'
250 sub.prop(rd, "threads")
251 sub = col.column(align=True)
252 sub.label(text="Tiles:")
253 sub.prop(rd, "parts_x", text="X")
254 sub.prop(rd, "parts_y", text="Y")
258 col.label(text="Memory:")
260 sub.enabled = not (rd.use_border or rd.full_sample)
261 sub.prop(rd, "save_buffers")
263 sub.active = rd.use_compositing
264 sub.prop(rd, "free_image_textures")
266 sub.active = rd.render_raytracing
267 sub.label(text="Acceleration structure:")
268 sub.prop(rd, "raytrace_structure", text="")
269 if rd.raytrace_structure == 'OCTREE':
270 sub.prop(rd, "octree_resolution", text="Resolution")
272 sub.prop(rd, "use_instances", text="Instances")
273 sub.prop(rd, "use_local_coords", text="Local Coordinates")
276 class RENDER_PT_post_processing(RenderButtonsPanel):
277 bl_label = "Post Processing"
278 bl_default_closed = True
279 COMPAT_ENGINES = {'BLENDER_RENDER'}
281 def draw(self, context):
284 rd = context.scene.render
285 wide_ui = context.region.width > narrowui
287 split = layout.split()
290 col.prop(rd, "use_compositing")
291 col.prop(rd, "use_sequencer")
295 col.prop(rd, "dither_intensity", text="Dither", slider=True)
299 split = layout.split()
302 col.prop(rd, "fields", text="Fields")
304 sub.active = rd.fields
305 sub.row().prop(rd, "field_order", expand=True)
306 sub.prop(rd, "fields_still", text="Still")
316 sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
317 sub.prop(rd, "edge_color", text="")
321 split = layout.split()
323 col.prop(rd, "freestyle", text="Freestyle")
326 class RENDER_PT_output(RenderButtonsPanel):
328 COMPAT_ENGINES = {'BLENDER_RENDER'}
330 def draw(self, context):
333 rd = context.scene.render
334 wide_ui = context.region.width > narrowui
336 layout.prop(rd, "output_path", text="")
338 split = layout.split()
340 col.prop(rd, "file_format", text="")
341 col.row().prop(rd, "color_mode", text="Color", expand=True)
345 col.prop(rd, "use_file_extension")
346 col.prop(rd, "use_overwrite")
347 col.prop(rd, "use_placeholder")
349 if rd.file_format in ('AVI_JPEG', 'JPEG'):
350 split = layout.split()
351 split.prop(rd, "file_quality", slider=True)
353 elif rd.file_format == 'OPEN_EXR':
354 split = layout.split()
357 col.label(text="Codec:")
358 col.prop(rd, "exr_codec", text="")
361 subsplit = split.split()
362 col = subsplit.column()
363 col.prop(rd, "exr_half")
364 col.prop(rd, "exr_zbuf")
367 col = subsplit.column()
368 col.prop(rd, "exr_preview")
370 elif rd.file_format == 'JPEG2000':
371 split = layout.split()
373 col.label(text="Depth:")
374 col.row().prop(rd, "jpeg2k_depth", expand=True)
378 col.prop(rd, "jpeg2k_preset", text="")
379 col.prop(rd, "jpeg2k_ycc")
381 elif rd.file_format in ('CINEON', 'DPX'):
382 split = layout.split()
384 col.prop(rd, "cineon_log", text="Convert to Log")
387 col = split.column(align=True)
388 col.active = rd.cineon_log
389 col.prop(rd, "cineon_black", text="Black")
390 col.prop(rd, "cineon_white", text="White")
391 col.prop(rd, "cineon_gamma", text="Gamma")
393 elif rd.file_format == 'TIFF':
394 split = layout.split()
395 split.prop(rd, "tiff_bit")
397 elif rd.file_format == 'QUICKTIME_CARBON':
398 split = layout.split()
399 split.operator("scene.render_set_quicktime_codec")
401 elif rd.file_format == 'QUICKTIME_QTKIT':
402 split = layout.split()
404 col.prop(rd, "quicktime_codec_type")
405 col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
408 class RENDER_PT_encoding(RenderButtonsPanel):
409 bl_label = "Encoding"
410 bl_default_closed = True
411 COMPAT_ENGINES = {'BLENDER_RENDER'}
413 def poll(self, context):
414 rd = context.scene.render
415 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
417 def draw(self, context):
420 rd = context.scene.render
421 wide_ui = context.region.width > narrowui
423 layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
425 split = layout.split()
428 col.prop(rd, "ffmpeg_format")
429 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
432 col.prop(rd, "ffmpeg_codec")
437 split = layout.split()
440 col.prop(rd, "ffmpeg_video_bitrate")
443 col.prop(rd, "ffmpeg_gopsize")
445 split = layout.split()
448 col.label(text="Rate:")
449 col.prop(rd, "ffmpeg_minrate", text="Minimum")
450 col.prop(rd, "ffmpeg_maxrate", text="Maximum")
451 col.prop(rd, "ffmpeg_buffersize", text="Buffer")
456 col.prop(rd, "ffmpeg_autosplit")
457 col.label(text="Mux:")
458 col.prop(rd, "ffmpeg_muxrate", text="Rate")
459 col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
462 sub = layout.column()
464 if rd.ffmpeg_format not in ('MP3'):
465 sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
472 col.prop(rd, "ffmpeg_audio_bitrate")
473 col.prop(rd, "ffmpeg_audio_mixrate")
477 col.prop(rd, "ffmpeg_audio_volume", slider=True)
480 class RENDER_PT_antialiasing(RenderButtonsPanel):
481 bl_label = "Anti-Aliasing"
482 COMPAT_ENGINES = {'BLENDER_RENDER'}
484 def draw_header(self, context):
485 rd = context.scene.render
487 self.layout.prop(rd, "antialiasing", text="")
489 def draw(self, context):
492 rd = context.scene.render
493 wide_ui = context.region.width > narrowui
494 layout.active = rd.antialiasing
496 split = layout.split()
499 col.row().prop(rd, "antialiasing_samples", expand=True)
501 sub.enabled = not rd.use_border
502 sub.prop(rd, "full_sample")
506 col.prop(rd, "pixel_filter", text="")
507 col.prop(rd, "filter_size", text="Size")
510 class RENDER_PT_motion_blur(RenderButtonsPanel):
511 bl_label = "Full Sample Motion Blur"
512 bl_default_closed = True
513 COMPAT_ENGINES = {'BLENDER_RENDER'}
515 def draw_header(self, context):
516 rd = context.scene.render
518 self.layout.prop(rd, "motion_blur", text="")
520 def draw(self, context):
523 rd = context.scene.render
524 layout.active = rd.motion_blur
527 row.prop(rd, "motion_blur_samples")
530 class RENDER_PT_dimensions(RenderButtonsPanel):
531 bl_label = "Dimensions"
532 COMPAT_ENGINES = {'BLENDER_RENDER'}
534 def draw(self, context):
537 scene = context.scene
539 wide_ui = context.region.width > narrowui
541 row = layout.row().split()
542 sub = row.row(align=True).split(percentage=0.75)
543 sub.menu("RENDER_MT_presets", text="Presets")
544 sub.operator("render.preset_add", text="Add")
546 split = layout.split()
549 sub = col.column(align=True)
550 sub.label(text="Resolution:")
551 sub.prop(rd, "resolution_x", text="X")
552 sub.prop(rd, "resolution_y", text="Y")
553 sub.prop(rd, "resolution_percentage", text="")
555 sub.label(text="Aspect Ratio:")
556 sub.prop(rd, "pixel_aspect_x", text="X")
557 sub.prop(rd, "pixel_aspect_y", text="Y")
560 row.prop(rd, "use_border", text="Border")
562 sub.active = rd.use_border
563 sub.prop(rd, "crop_to_border", text="Crop")
567 sub = col.column(align=True)
568 sub.label(text="Frame Range:")
569 sub.prop(scene, "start_frame", text="Start")
570 sub.prop(scene, "end_frame", text="End")
571 sub.prop(scene, "frame_step", text="Step")
573 sub.label(text="Frame Rate:")
575 sub.prop(rd, "fps_base", text="/")
578 class RENDER_PT_stamp(RenderButtonsPanel):
580 bl_default_closed = True
581 COMPAT_ENGINES = {'BLENDER_RENDER'}
583 def draw_header(self, context):
584 rd = context.scene.render
586 self.layout.prop(rd, "render_stamp", text="")
588 def draw(self, context):
591 rd = context.scene.render
592 wide_ui = context.region.width > narrowui
594 layout.active = rd.render_stamp
596 split = layout.split()
599 col.prop(rd, "stamp_time", text="Time")
600 col.prop(rd, "stamp_date", text="Date")
601 col.prop(rd, "stamp_render_time", text="RenderTime")
602 col.prop(rd, "stamp_frame", text="Frame")
603 col.prop(rd, "stamp_scene", text="Scene")
604 col.prop(rd, "stamp_camera", text="Camera")
605 col.prop(rd, "stamp_filename", text="Filename")
606 col.prop(rd, "stamp_marker", text="Marker")
607 col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
611 col.active = rd.render_stamp
612 col.prop(rd, "stamp_foreground", slider=True)
613 col.prop(rd, "stamp_background", slider=True)
615 col.prop(rd, "stamp_font_size", text="Font Size")
617 row = layout.split(percentage=0.2)
618 row.prop(rd, "stamp_note", text="Note")
620 sub.active = rd.stamp_note
621 sub.prop(rd, "stamp_note_text", text="")
624 class RENDER_PT_bake(RenderButtonsPanel):
626 bl_default_closed = True
627 COMPAT_ENGINES = {'BLENDER_RENDER'}
629 def draw(self, context):
632 rd = context.scene.render
633 wide_ui = context.region.width > narrowui
635 layout.operator("object.bake_image", icon='RENDER_STILL')
638 layout.prop(rd, "bake_type")
640 layout.prop(rd, "bake_type", text="")
642 if rd.bake_type == 'NORMALS':
644 layout.prop(rd, "bake_normal_space")
646 layout.prop(rd, "bake_normal_space", text="")
647 elif rd.bake_type in ('DISPLACEMENT', 'AO'):
648 layout.prop(rd, "bake_normalized")
650 # col.prop(rd, "bake_aa_mode")
651 # col.prop(rd, "bake_enable_aa")
655 split = layout.split()
658 col.prop(rd, "bake_clear")
659 col.prop(rd, "bake_margin")
660 col.prop(rd, "bake_quad_split", text="Split")
664 col.prop(rd, "bake_active")
666 sub.active = rd.bake_active
667 sub.prop(rd, "bake_distance")
668 sub.prop(rd, "bake_bias")
673 RENDER_MT_ffmpeg_presets,
676 RENDER_PT_dimensions,
677 RENDER_PT_antialiasing,
678 RENDER_PT_motion_blur,
682 RENDER_PT_performance,
683 RENDER_PT_post_processing,
689 register = bpy.types.register
695 unregister = bpy.types.unregister
699 if __name__ == "__main__":