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 RenderButtonsPanel(bpy.types.Panel):
33 bl_space_type = 'PROPERTIES'
34 bl_region_type = 'WINDOW'
36 # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
38 def poll(self, context):
39 rd = context.scene.render_data
40 return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
43 class RENDER_PT_render(RenderButtonsPanel):
45 COMPAT_ENGINES = {'BLENDER_RENDER'}
47 def draw(self, context):
50 rd = context.scene.render_data
51 wide_ui = context.region.width > narrowui
53 split = layout.split()
56 col.operator("screen.render", text="Image", icon='RENDER_STILL')
60 col.operator("screen.render", text="Animation", icon='RENDER_ANIMATION').animation = True
62 layout.prop(rd, "display_mode", text="Display")
65 class RENDER_PT_layers(RenderButtonsPanel):
67 bl_default_closed = True
68 COMPAT_ENGINES = {'BLENDER_RENDER'}
70 def draw(self, context):
74 rd = scene.render_data
75 wide_ui = context.region.width > narrowui
78 row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
80 col = row.column(align=True)
81 col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
82 col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
84 rl = rd.layers[rd.active_layer_index]
87 layout.prop(rl, "name")
89 split = layout.split()
92 col.prop(scene, "visible_layers", text="Scene")
95 col.prop(rl, "visible_layers", text="Layer")
97 layout.prop(rl, "light_override", text="Light")
98 layout.prop(rl, "material_override", text="Material")
101 layout.label(text="Include:")
103 split = layout.split()
106 col.prop(rl, "zmask")
108 row.prop(rl, "zmask_negate", text="Negate")
109 row.active = rl.zmask
110 col.prop(rl, "all_z")
113 col.prop(rl, "solid")
115 col.prop(rl, "ztransp")
120 col.prop(rl, "strand")
123 split = layout.split()
124 split.label(text="Zmask Layers:")
125 split.column().prop(rl, "zmask_layers", text="")
129 split = layout.split()
132 col.label(text="Passes:")
133 col.prop(rl, "pass_combined")
134 col.prop(rl, "pass_z")
135 col.prop(rl, "pass_vector")
136 col.prop(rl, "pass_normal")
137 col.prop(rl, "pass_uv")
138 col.prop(rl, "pass_mist")
139 col.prop(rl, "pass_object_index")
140 col.prop(rl, "pass_color")
145 col.prop(rl, "pass_diffuse")
147 row.prop(rl, "pass_specular")
148 row.prop(rl, "pass_specular_exclude", text="", icon='X')
150 row.prop(rl, "pass_shadow")
151 row.prop(rl, "pass_shadow_exclude", text="", icon='X')
153 row.prop(rl, "pass_emit")
154 row.prop(rl, "pass_emit_exclude", text="", icon='X')
156 row.prop(rl, "pass_ao")
157 row.prop(rl, "pass_ao_exclude", text="", icon='X')
159 row.prop(rl, "pass_environment")
160 row.prop(rl, "pass_environment_exclude", text="", icon='X')
162 row.prop(rl, "pass_indirect")
163 row.prop(rl, "pass_indirect_exclude", text="", icon='X')
165 row.prop(rl, "pass_reflection")
166 row.prop(rl, "pass_reflection_exclude", text="", icon='X')
168 row.prop(rl, "pass_refraction")
169 row.prop(rl, "pass_refraction_exclude", text="", icon='X')
172 class RENDER_PT_shading(RenderButtonsPanel):
174 COMPAT_ENGINES = {'BLENDER_RENDER'}
176 def draw(self, context):
179 rd = context.scene.render_data
180 wide_ui = context.region.width > narrowui
182 split = layout.split()
185 col.prop(rd, "render_textures", text="Textures")
186 col.prop(rd, "render_shadows", text="Shadows")
187 col.prop(rd, "render_sss", text="Subsurface Scattering")
188 col.prop(rd, "render_envmaps", text="Environment Map")
192 col.prop(rd, "render_raytracing", text="Ray Tracing")
193 col.prop(rd, "color_management")
194 col.prop(rd, "alpha_mode", text="Alpha")
197 class RENDER_PT_performance(RenderButtonsPanel):
198 bl_label = "Performance"
199 bl_default_closed = True
200 COMPAT_ENGINES = {'BLENDER_RENDER'}
202 def draw(self, context):
205 rd = context.scene.render_data
206 wide_ui = context.region.width > narrowui
208 split = layout.split()
211 col.label(text="Threads:")
212 col.row().prop(rd, "threads_mode", expand=True)
214 sub.enabled = rd.threads_mode == 'THREADS_FIXED'
215 sub.prop(rd, "threads")
216 sub = col.column(align=True)
217 sub.label(text="Tiles:")
218 sub.prop(rd, "parts_x", text="X")
219 sub.prop(rd, "parts_y", text="Y")
223 col.label(text="Memory:")
225 sub.enabled = not (rd.use_border or rd.full_sample)
226 sub.prop(rd, "save_buffers")
228 sub.active = rd.use_compositing
229 sub.prop(rd, "free_image_textures")
231 sub.active = rd.render_raytracing
232 sub.label(text="Acceleration structure:")
233 sub.prop(rd, "raytrace_structure", text="")
234 if rd.raytrace_structure == 'OCTREE':
235 sub.prop(rd, "octree_resolution", text="Resolution")
237 sub.prop(rd, "use_instances", text="Instances")
238 sub.prop(rd, "use_local_coords", text="Local Coordinates")
241 class RENDER_PT_post_processing(RenderButtonsPanel):
242 bl_label = "Post Processing"
243 bl_default_closed = True
244 COMPAT_ENGINES = {'BLENDER_RENDER'}
246 def draw(self, context):
249 rd = context.scene.render_data
250 wide_ui = context.region.width > narrowui
252 split = layout.split()
255 col.prop(rd, "use_compositing")
256 col.prop(rd, "use_sequencer")
260 col.prop(rd, "dither_intensity", text="Dither", slider=True)
264 split = layout.split()
267 col.prop(rd, "fields", text="Fields")
269 sub.active = rd.fields
270 sub.row().prop(rd, "field_order", expand=True)
271 sub.prop(rd, "fields_still", text="Still")
281 sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
282 sub.prop(rd, "edge_color", text="")
285 class RENDER_PT_output(RenderButtonsPanel):
287 COMPAT_ENGINES = {'BLENDER_RENDER'}
289 def draw(self, context):
292 rd = context.scene.render_data
293 wide_ui = context.region.width > narrowui
295 layout.prop(rd, "output_path", text="")
297 split = layout.split()
299 col.prop(rd, "file_format", text="")
300 col.row().prop(rd, "color_mode", text="Color", expand=True)
304 col.prop(rd, "use_file_extension")
305 col.prop(rd, "use_overwrite")
306 col.prop(rd, "use_placeholder")
308 if rd.file_format in ('AVIJPEG', 'JPEG'):
309 split = layout.split()
310 split.prop(rd, "quality", slider=True)
312 elif rd.file_format == 'OPENEXR':
313 split = layout.split()
316 col.label(text="Codec:")
317 col.prop(rd, "exr_codec", text="")
320 subsplit = split.split()
321 col = subsplit.column()
322 col.prop(rd, "exr_half")
323 col.prop(rd, "exr_zbuf")
326 col = subsplit.column()
327 col.prop(rd, "exr_preview")
329 elif rd.file_format == 'JPEG2000':
330 split = layout.split()
332 col.label(text="Depth:")
333 col.row().prop(rd, "jpeg2k_depth", expand=True)
337 col.prop(rd, "jpeg2k_preset", text="")
338 col.prop(rd, "jpeg2k_ycc")
340 elif rd.file_format in ('CINEON', 'DPX'):
341 split = layout.split()
343 col.prop(rd, "cineon_log", text="Convert to Log")
346 col = split.column(align=True)
347 col.active = rd.cineon_log
348 col.prop(rd, "cineon_black", text="Black")
349 col.prop(rd, "cineon_white", text="White")
350 col.prop(rd, "cineon_gamma", text="Gamma")
352 elif rd.file_format == 'TIFF':
353 split = layout.split()
354 split.prop(rd, "tiff_bit")
356 elif rd.file_format == 'QUICKTIME_CARBON':
357 split = layout.split()
358 split.operator("scene.render_data_set_quicktime_codec")
360 elif rd.file_format == 'QUICKTIME_QTKIT':
361 split = layout.split()
363 col.prop(rd, "quicktime_codec_type")
364 col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
367 class RENDER_PT_encoding(RenderButtonsPanel):
368 bl_label = "Encoding"
369 bl_default_closed = True
370 COMPAT_ENGINES = {'BLENDER_RENDER'}
372 def poll(self, context):
373 rd = context.scene.render_data
374 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
376 def draw(self, context):
379 rd = context.scene.render_data
380 wide_ui = context.region.width > narrowui
382 split = layout.split()
385 col.prop(rd, "ffmpeg_format")
386 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
389 col.prop(rd, "ffmpeg_codec")
394 split = layout.split()
397 col.prop(rd, "ffmpeg_video_bitrate")
400 col.prop(rd, "ffmpeg_gopsize")
402 split = layout.split()
405 col.label(text="Rate:")
406 col.prop(rd, "ffmpeg_minrate", text="Minimum")
407 col.prop(rd, "ffmpeg_maxrate", text="Maximum")
408 col.prop(rd, "ffmpeg_buffersize", text="Buffer")
413 col.prop(rd, "ffmpeg_autosplit")
414 col.label(text="Mux:")
415 col.prop(rd, "ffmpeg_muxrate", text="Rate")
416 col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
419 sub = layout.column()
421 if rd.ffmpeg_format not in ('MP3'):
422 sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
429 col.prop(rd, "ffmpeg_audio_bitrate")
430 col.prop(rd, "ffmpeg_audio_mixrate")
434 col.prop(rd, "ffmpeg_audio_volume", slider=True)
437 class RENDER_PT_antialiasing(RenderButtonsPanel):
438 bl_label = "Anti-Aliasing"
439 COMPAT_ENGINES = {'BLENDER_RENDER'}
441 def draw_header(self, context):
442 rd = context.scene.render_data
444 self.layout.prop(rd, "antialiasing", text="")
446 def draw(self, context):
449 rd = context.scene.render_data
450 wide_ui = context.region.width > narrowui
451 layout.active = rd.antialiasing
453 split = layout.split()
456 col.row().prop(rd, "antialiasing_samples", expand=True)
458 sub.enabled = not rd.use_border
459 sub.prop(rd, "full_sample")
463 col.prop(rd, "pixel_filter", text="")
464 col.prop(rd, "filter_size", text="Size")
467 class RENDER_PT_motion_blur(RenderButtonsPanel):
468 bl_label = "Full Sample Motion Blur"
469 bl_default_closed = True
470 COMPAT_ENGINES = {'BLENDER_RENDER'}
472 def draw_header(self, context):
473 rd = context.scene.render_data
475 self.layout.prop(rd, "motion_blur", text="")
477 def draw(self, context):
480 rd = context.scene.render_data
481 layout.active = rd.motion_blur
484 row.prop(rd, "motion_blur_samples")
486 class RENDER_PT_dimensions(RenderButtonsPanel):
487 bl_label = "Dimensions"
488 COMPAT_ENGINES = {'BLENDER_RENDER'}
490 def draw(self, context):
493 scene = context.scene
494 rd = scene.render_data
495 wide_ui = context.region.width > narrowui
497 row = layout.row().split()
498 sub = row.row(align=True).split(percentage=0.75)
499 sub.menu("RENDER_MT_presets", text="Presets")
500 sub.operator("render.preset_add", text="Add")
502 split = layout.split()
505 sub = col.column(align=True)
506 sub.label(text="Resolution:")
507 sub.prop(rd, "resolution_x", text="X")
508 sub.prop(rd, "resolution_y", text="Y")
509 sub.prop(rd, "resolution_percentage", text="")
511 sub.label(text="Aspect Ratio:")
512 sub.prop(rd, "pixel_aspect_x", text="X")
513 sub.prop(rd, "pixel_aspect_y", text="Y")
516 row.prop(rd, "use_border", text="Border")
518 sub.active = rd.use_border
519 sub.prop(rd, "crop_to_border", text="Crop")
523 sub = col.column(align=True)
524 sub.label(text="Frame Range:")
525 sub.prop(scene, "start_frame", text="Start")
526 sub.prop(scene, "end_frame", text="End")
527 sub.prop(scene, "frame_step", text="Step")
529 sub.label(text="Frame Rate:")
531 sub.prop(rd, "fps_base", text="/")
534 class RENDER_PT_stamp(RenderButtonsPanel):
536 bl_default_closed = True
537 COMPAT_ENGINES = {'BLENDER_RENDER'}
539 def draw_header(self, context):
540 rd = context.scene.render_data
542 self.layout.prop(rd, "render_stamp", text="")
544 def draw(self, context):
547 rd = context.scene.render_data
548 wide_ui = context.region.width > narrowui
550 layout.active = rd.render_stamp
552 split = layout.split()
555 col.prop(rd, "stamp_time", text="Time")
556 col.prop(rd, "stamp_date", text="Date")
557 col.prop(rd, "stamp_render_time", text="RenderTime")
558 col.prop(rd, "stamp_frame", text="Frame")
559 col.prop(rd, "stamp_scene", text="Scene")
560 col.prop(rd, "stamp_camera", text="Camera")
561 col.prop(rd, "stamp_filename", text="Filename")
562 col.prop(rd, "stamp_marker", text="Marker")
563 col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
567 col.active = rd.render_stamp
568 col.prop(rd, "stamp_foreground", slider=True)
569 col.prop(rd, "stamp_background", slider=True)
571 col.prop(rd, "stamp_font_size", text="Font Size")
573 row = layout.split(percentage=0.2)
574 row.prop(rd, "stamp_note", text="Note")
576 sub.active = rd.stamp_note
577 sub.prop(rd, "stamp_note_text", text="")
580 class RENDER_PT_bake(RenderButtonsPanel):
582 bl_default_closed = True
583 COMPAT_ENGINES = {'BLENDER_RENDER'}
585 def draw(self, context):
588 rd = context.scene.render_data
589 wide_ui = context.region.width > narrowui
591 layout.operator("object.bake_image", icon='RENDER_STILL')
594 layout.prop(rd, "bake_type")
596 layout.prop(rd, "bake_type", text="")
598 if rd.bake_type == 'NORMALS':
600 layout.prop(rd, "bake_normal_space")
602 layout.prop(rd, "bake_normal_space", text="")
603 elif rd.bake_type in ('DISPLACEMENT', 'AO'):
604 layout.prop(rd, "bake_normalized")
606 # col.prop(rd, "bake_aa_mode")
607 # col.prop(rd, "bake_enable_aa")
611 split = layout.split()
614 col.prop(rd, "bake_clear")
615 col.prop(rd, "bake_margin")
616 col.prop(rd, "bake_quad_split", text="Split")
620 col.prop(rd, "bake_active")
622 sub.active = rd.bake_active
623 sub.prop(rd, "bake_distance")
624 sub.prop(rd, "bake_bias")
631 RENDER_PT_dimensions,
632 RENDER_PT_antialiasing,
633 RENDER_PT_motion_blur,
637 RENDER_PT_performance,
638 RENDER_PT_post_processing,
644 register = bpy.types.register
649 unregister = bpy.types.unregister
653 if __name__ == "__main__":