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")
121 col.prop(rl, "freestyle")
124 split = layout.split()
125 split.label(text="Zmask Layers:")
126 split.column().prop(rl, "zmask_layers", text="")
130 split = layout.split()
133 col.label(text="Passes:")
134 col.prop(rl, "pass_combined")
135 col.prop(rl, "pass_z")
136 col.prop(rl, "pass_vector")
137 col.prop(rl, "pass_normal")
138 col.prop(rl, "pass_uv")
139 col.prop(rl, "pass_mist")
140 col.prop(rl, "pass_object_index")
141 col.prop(rl, "pass_color")
146 col.prop(rl, "pass_diffuse")
148 row.prop(rl, "pass_specular")
149 row.prop(rl, "pass_specular_exclude", text="", icon='X')
151 row.prop(rl, "pass_shadow")
152 row.prop(rl, "pass_shadow_exclude", text="", icon='X')
154 row.prop(rl, "pass_emit")
155 row.prop(rl, "pass_emit_exclude", text="", icon='X')
157 row.prop(rl, "pass_ao")
158 row.prop(rl, "pass_ao_exclude", text="", icon='X')
160 row.prop(rl, "pass_environment")
161 row.prop(rl, "pass_environment_exclude", text="", icon='X')
163 row.prop(rl, "pass_indirect")
164 row.prop(rl, "pass_indirect_exclude", text="", icon='X')
166 row.prop(rl, "pass_reflection")
167 row.prop(rl, "pass_reflection_exclude", text="", icon='X')
169 row.prop(rl, "pass_refraction")
170 row.prop(rl, "pass_refraction_exclude", text="", icon='X')
175 split = layout.split()
178 col.label(text="Freestyle:")
179 freestyle = rl.freestyle_settings
180 col.prop(freestyle, "sphere_radius", text="Sphere Radius")
181 col.prop(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
182 col.prop(freestyle, "suggestive_contours", text="Suggestive Contours")
183 col.prop(freestyle, "dkr_epsilon", text="Dkr Epsilon")
185 col.operator("scene.freestyle_module_add", text="Add Style Module")
187 for i, module in enumerate(freestyle.modules):
189 box.set_context_pointer("freestyle_module", module)
190 row = box.row(align=True)
191 row.prop(module, "is_displayed", text="")
192 row.prop(module, "module_path", text="")
193 row.operator("scene.freestyle_module_remove", icon='X', text="")
194 props = row.operator("scene.freestyle_module_move_up", icon='MOVE_UP_VEC', text="")
195 props.active = (i > 0)
196 props = row.operator("scene.freestyle_module_move_down", icon='MOVE_DOWN_VEC', text="")
197 props.active = (i < len(freestyle.modules) - 1)
200 class RENDER_PT_shading(RenderButtonsPanel):
202 COMPAT_ENGINES = {'BLENDER_RENDER'}
204 def draw(self, context):
207 rd = context.scene.render_data
208 wide_ui = context.region.width > narrowui
210 split = layout.split()
213 col.prop(rd, "render_textures", text="Textures")
214 col.prop(rd, "render_shadows", text="Shadows")
215 col.prop(rd, "render_sss", text="Subsurface Scattering")
216 col.prop(rd, "render_envmaps", text="Environment Map")
220 col.prop(rd, "render_raytracing", text="Ray Tracing")
221 col.prop(rd, "color_management")
222 col.prop(rd, "alpha_mode", text="Alpha")
225 class RENDER_PT_performance(RenderButtonsPanel):
226 bl_label = "Performance"
227 bl_default_closed = True
228 COMPAT_ENGINES = {'BLENDER_RENDER'}
230 def draw(self, context):
233 rd = context.scene.render_data
234 wide_ui = context.region.width > narrowui
236 split = layout.split()
239 col.label(text="Threads:")
240 col.row().prop(rd, "threads_mode", expand=True)
242 sub.enabled = rd.threads_mode == 'THREADS_FIXED'
243 sub.prop(rd, "threads")
244 sub = col.column(align=True)
245 sub.label(text="Tiles:")
246 sub.prop(rd, "parts_x", text="X")
247 sub.prop(rd, "parts_y", text="Y")
251 col.label(text="Memory:")
253 sub.enabled = not (rd.use_border or rd.full_sample)
254 sub.prop(rd, "save_buffers")
256 sub.active = rd.use_compositing
257 sub.prop(rd, "free_image_textures")
259 sub.active = rd.render_raytracing
260 sub.label(text="Acceleration structure:")
261 sub.prop(rd, "raytrace_structure", text="")
262 if rd.raytrace_structure == 'OCTREE':
263 sub.prop(rd, "octree_resolution", text="Resolution")
265 sub.prop(rd, "use_instances", text="Instances")
266 sub.prop(rd, "use_local_coords", text="Local Coordinates")
269 class RENDER_PT_post_processing(RenderButtonsPanel):
270 bl_label = "Post Processing"
271 bl_default_closed = True
272 COMPAT_ENGINES = {'BLENDER_RENDER'}
274 def draw(self, context):
277 rd = context.scene.render_data
278 wide_ui = context.region.width > narrowui
280 split = layout.split()
283 col.prop(rd, "use_compositing")
284 col.prop(rd, "use_sequencer")
288 col.prop(rd, "dither_intensity", text="Dither", slider=True)
292 split = layout.split()
295 col.prop(rd, "fields", text="Fields")
297 sub.active = rd.fields
298 sub.row().prop(rd, "field_order", expand=True)
299 sub.prop(rd, "fields_still", text="Still")
309 sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
310 sub.prop(rd, "edge_color", text="")
314 split = layout.split()
316 col.prop(rd, "freestyle", text="Freestyle")
319 class RENDER_PT_output(RenderButtonsPanel):
321 COMPAT_ENGINES = {'BLENDER_RENDER'}
323 def draw(self, context):
326 rd = context.scene.render_data
327 wide_ui = context.region.width > narrowui
329 layout.prop(rd, "output_path", text="")
331 split = layout.split()
333 col.prop(rd, "file_format", text="")
334 col.row().prop(rd, "color_mode", text="Color", expand=True)
338 col.prop(rd, "use_file_extension")
339 col.prop(rd, "use_overwrite")
340 col.prop(rd, "use_placeholder")
342 if rd.file_format in ('AVIJPEG', 'JPEG'):
343 split = layout.split()
344 split.prop(rd, "quality", slider=True)
346 elif rd.file_format == 'OPENEXR':
347 split = layout.split()
350 col.label(text="Codec:")
351 col.prop(rd, "exr_codec", text="")
354 subsplit = split.split()
355 col = subsplit.column()
356 col.prop(rd, "exr_half")
357 col.prop(rd, "exr_zbuf")
360 col = subsplit.column()
361 col.prop(rd, "exr_preview")
363 elif rd.file_format == 'JPEG2000':
364 split = layout.split()
366 col.label(text="Depth:")
367 col.row().prop(rd, "jpeg2k_depth", expand=True)
371 col.prop(rd, "jpeg2k_preset", text="")
372 col.prop(rd, "jpeg2k_ycc")
374 elif rd.file_format in ('CINEON', 'DPX'):
375 split = layout.split()
377 col.prop(rd, "cineon_log", text="Convert to Log")
380 col = split.column(align=True)
381 col.active = rd.cineon_log
382 col.prop(rd, "cineon_black", text="Black")
383 col.prop(rd, "cineon_white", text="White")
384 col.prop(rd, "cineon_gamma", text="Gamma")
386 elif rd.file_format == 'TIFF':
387 split = layout.split()
388 split.prop(rd, "tiff_bit")
390 elif rd.file_format == 'QUICKTIME_CARBON':
391 split = layout.split()
392 split.operator("scene.render_data_set_quicktime_codec")
394 elif rd.file_format == 'QUICKTIME_QTKIT':
395 split = layout.split()
397 col.prop(rd, "quicktime_codec_type")
398 col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
401 class RENDER_PT_encoding(RenderButtonsPanel):
402 bl_label = "Encoding"
403 bl_default_closed = True
404 COMPAT_ENGINES = {'BLENDER_RENDER'}
406 def poll(self, context):
407 rd = context.scene.render_data
408 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
410 def draw(self, context):
413 rd = context.scene.render_data
414 wide_ui = context.region.width > narrowui
416 split = layout.split()
419 col.prop(rd, "ffmpeg_format")
420 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
423 col.prop(rd, "ffmpeg_codec")
428 split = layout.split()
431 col.prop(rd, "ffmpeg_video_bitrate")
434 col.prop(rd, "ffmpeg_gopsize")
436 split = layout.split()
439 col.label(text="Rate:")
440 col.prop(rd, "ffmpeg_minrate", text="Minimum")
441 col.prop(rd, "ffmpeg_maxrate", text="Maximum")
442 col.prop(rd, "ffmpeg_buffersize", text="Buffer")
447 col.prop(rd, "ffmpeg_autosplit")
448 col.label(text="Mux:")
449 col.prop(rd, "ffmpeg_muxrate", text="Rate")
450 col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
453 sub = layout.column()
455 if rd.ffmpeg_format not in ('MP3'):
456 sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
463 col.prop(rd, "ffmpeg_audio_bitrate")
464 col.prop(rd, "ffmpeg_audio_mixrate")
468 col.prop(rd, "ffmpeg_audio_volume", slider=True)
471 class RENDER_PT_antialiasing(RenderButtonsPanel):
472 bl_label = "Anti-Aliasing"
473 COMPAT_ENGINES = {'BLENDER_RENDER'}
475 def draw_header(self, context):
476 rd = context.scene.render_data
478 self.layout.prop(rd, "antialiasing", text="")
480 def draw(self, context):
483 rd = context.scene.render_data
484 wide_ui = context.region.width > narrowui
485 layout.active = rd.antialiasing
487 split = layout.split()
490 col.row().prop(rd, "antialiasing_samples", expand=True)
492 sub.enabled = not rd.use_border
493 sub.prop(rd, "full_sample")
497 col.prop(rd, "pixel_filter", text="")
498 col.prop(rd, "filter_size", text="Size")
501 class RENDER_PT_motion_blur(RenderButtonsPanel):
502 bl_label = "Full Sample Motion Blur"
503 bl_default_closed = True
504 COMPAT_ENGINES = {'BLENDER_RENDER'}
506 def draw_header(self, context):
507 rd = context.scene.render_data
509 self.layout.prop(rd, "motion_blur", text="")
511 def draw(self, context):
514 rd = context.scene.render_data
515 layout.active = rd.motion_blur
518 row.prop(rd, "motion_blur_samples")
520 class RENDER_PT_dimensions(RenderButtonsPanel):
521 bl_label = "Dimensions"
522 COMPAT_ENGINES = {'BLENDER_RENDER'}
524 def draw(self, context):
527 scene = context.scene
528 rd = scene.render_data
529 wide_ui = context.region.width > narrowui
531 row = layout.row().split()
532 sub = row.row(align=True).split(percentage=0.75)
533 sub.menu("RENDER_MT_presets", text="Presets")
534 sub.operator("render.preset_add", text="Add")
536 split = layout.split()
539 sub = col.column(align=True)
540 sub.label(text="Resolution:")
541 sub.prop(rd, "resolution_x", text="X")
542 sub.prop(rd, "resolution_y", text="Y")
543 sub.prop(rd, "resolution_percentage", text="")
545 sub.label(text="Aspect Ratio:")
546 sub.prop(rd, "pixel_aspect_x", text="X")
547 sub.prop(rd, "pixel_aspect_y", text="Y")
550 row.prop(rd, "use_border", text="Border")
552 sub.active = rd.use_border
553 sub.prop(rd, "crop_to_border", text="Crop")
557 sub = col.column(align=True)
558 sub.label(text="Frame Range:")
559 sub.prop(scene, "start_frame", text="Start")
560 sub.prop(scene, "end_frame", text="End")
561 sub.prop(scene, "frame_step", text="Step")
563 sub.label(text="Frame Rate:")
565 sub.prop(rd, "fps_base", text="/")
568 class RENDER_PT_stamp(RenderButtonsPanel):
570 bl_default_closed = True
571 COMPAT_ENGINES = {'BLENDER_RENDER'}
573 def draw_header(self, context):
574 rd = context.scene.render_data
576 self.layout.prop(rd, "render_stamp", text="")
578 def draw(self, context):
581 rd = context.scene.render_data
582 wide_ui = context.region.width > narrowui
584 layout.active = rd.render_stamp
586 split = layout.split()
589 col.prop(rd, "stamp_time", text="Time")
590 col.prop(rd, "stamp_date", text="Date")
591 col.prop(rd, "stamp_render_time", text="RenderTime")
592 col.prop(rd, "stamp_frame", text="Frame")
593 col.prop(rd, "stamp_scene", text="Scene")
594 col.prop(rd, "stamp_camera", text="Camera")
595 col.prop(rd, "stamp_filename", text="Filename")
596 col.prop(rd, "stamp_marker", text="Marker")
597 col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
601 col.active = rd.render_stamp
602 col.prop(rd, "stamp_foreground", slider=True)
603 col.prop(rd, "stamp_background", slider=True)
605 col.prop(rd, "stamp_font_size", text="Font Size")
607 row = layout.split(percentage=0.2)
608 row.prop(rd, "stamp_note", text="Note")
610 sub.active = rd.stamp_note
611 sub.prop(rd, "stamp_note_text", text="")
614 class RENDER_PT_bake(RenderButtonsPanel):
616 bl_default_closed = True
617 COMPAT_ENGINES = {'BLENDER_RENDER'}
619 def draw(self, context):
622 rd = context.scene.render_data
623 wide_ui = context.region.width > narrowui
625 layout.operator("object.bake_image", icon='RENDER_STILL')
628 layout.prop(rd, "bake_type")
630 layout.prop(rd, "bake_type", text="")
632 if rd.bake_type == 'NORMALS':
634 layout.prop(rd, "bake_normal_space")
636 layout.prop(rd, "bake_normal_space", text="")
637 elif rd.bake_type in ('DISPLACEMENT', 'AO'):
638 layout.prop(rd, "bake_normalized")
640 # col.prop(rd, "bake_aa_mode")
641 # col.prop(rd, "bake_enable_aa")
645 split = layout.split()
648 col.prop(rd, "bake_clear")
649 col.prop(rd, "bake_margin")
650 col.prop(rd, "bake_quad_split", text="Split")
654 col.prop(rd, "bake_active")
656 sub.active = rd.bake_active
657 sub.prop(rd, "bake_distance")
658 sub.prop(rd, "bake_bias")
661 bpy.types.register(RENDER_MT_presets)
662 bpy.types.register(RENDER_PT_render)
663 bpy.types.register(RENDER_PT_layers)
664 bpy.types.register(RENDER_PT_dimensions)
665 bpy.types.register(RENDER_PT_antialiasing)
666 bpy.types.register(RENDER_PT_motion_blur)
667 bpy.types.register(RENDER_PT_shading)
668 bpy.types.register(RENDER_PT_output)
669 bpy.types.register(RENDER_PT_encoding)
670 bpy.types.register(RENDER_PT_performance)
671 bpy.types.register(RENDER_PT_post_processing)
672 bpy.types.register(RENDER_PT_stamp)
673 bpy.types.register(RENDER_PT_bake)