Merged changes in the trunk up to revision 39368.
[blender.git] / release / scripts / startup / bl_ui / properties_render.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
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.
7 #
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.
12 #
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.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Menu, Panel
22
23
24 class RENDER_MT_presets(Menu):
25     bl_label = "Render Presets"
26     preset_subdir = "render"
27     preset_operator = "script.execute_preset"
28     draw = Menu.draw_preset
29
30
31 class RENDER_MT_ffmpeg_presets(Menu):
32     bl_label = "FFMPEG Presets"
33     preset_subdir = "ffmpeg"
34     preset_operator = "script.python_file_run"
35     draw = Menu.draw_preset
36
37
38 class RENDER_MT_framerate_presets(Menu):
39     bl_label = "Frame Rate Presets"
40     preset_subdir = "framerate"
41     preset_operator = "script.execute_preset"
42     draw = Menu.draw_preset
43
44
45 class RenderButtonsPanel():
46     bl_space_type = 'PROPERTIES'
47     bl_region_type = 'WINDOW'
48     bl_context = "render"
49     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
50
51     @classmethod
52     def poll(cls, context):
53         rd = context.scene.render
54         return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
55
56
57 class RENDER_PT_render(RenderButtonsPanel, Panel):
58     bl_label = "Render"
59     COMPAT_ENGINES = {'BLENDER_RENDER'}
60
61     def draw(self, context):
62         layout = self.layout
63
64         rd = context.scene.render
65
66         row = layout.row()
67         row.operator("render.render", text="Image", icon='RENDER_STILL')
68         row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
69
70         layout.prop(rd, "display_mode", text="Display")
71
72
73 class RENDER_PT_layers(RenderButtonsPanel, Panel):
74     bl_label = "Layers"
75     bl_options = {'DEFAULT_CLOSED'}
76     COMPAT_ENGINES = {'BLENDER_RENDER'}
77
78     def draw(self, context):
79         layout = self.layout
80
81         scene = context.scene
82         rd = scene.render
83
84         row = layout.row()
85         row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
86
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="")
90
91         row = layout.row()
92         rl = rd.layers.active
93         if rl:
94             row.prop(rl, "name")
95         row.prop(rd, "use_single_layer", text="", icon_only=True)
96
97         split = layout.split()
98
99         col = split.column()
100         col.prop(scene, "layers", text="Scene")
101         col.label(text="")
102         col.prop(rl, "light_override", text="Light")
103         col.prop(rl, "material_override", text="Material")
104
105         col = split.column()
106         col.prop(rl, "layers", text="Layer")
107         col.label(text="Mask Layers:")
108         col.prop(rl, "layers_zmask", text="")
109
110         layout.separator()
111         layout.label(text="Include:")
112
113         split = layout.split()
114
115         col = split.column()
116         col.prop(rl, "use_zmask")
117         row = col.row()
118         row.prop(rl, "invert_zmask", text="Negate")
119         row.active = rl.use_zmask
120         col.prop(rl, "use_all_z")
121
122         col = split.column()
123         col.prop(rl, "use_solid")
124         col.prop(rl, "use_halo")
125         col.prop(rl, "use_ztransp")
126         col.prop(rl, "use_sky")
127
128         col = split.column()
129         col.prop(rl, "use_edge_enhance")
130         col.prop(rl, "use_strand")
131         col.prop(rl, "use_freestyle")
132
133         layout.separator()
134
135         split = layout.split()
136
137         col = split.column()
138         col.label(text="Passes:")
139         col.prop(rl, "use_pass_combined")
140         col.prop(rl, "use_pass_z")
141         col.prop(rl, "use_pass_vector")
142         col.prop(rl, "use_pass_normal")
143         col.prop(rl, "use_pass_uv")
144         col.prop(rl, "use_pass_mist")
145         col.prop(rl, "use_pass_object_index")
146         col.prop(rl, "use_pass_material_index")
147         col.prop(rl, "use_pass_color")
148
149         col = split.column()
150         col.label()
151         col.prop(rl, "use_pass_diffuse")
152         row = col.row()
153         row.prop(rl, "use_pass_specular")
154         row.prop(rl, "exclude_specular", text="")
155         row = col.row()
156         row.prop(rl, "use_pass_shadow")
157         row.prop(rl, "exclude_shadow", text="")
158         row = col.row()
159         row.prop(rl, "use_pass_emit")
160         row.prop(rl, "exclude_emit", text="")
161         row = col.row()
162         row.prop(rl, "use_pass_ambient_occlusion")
163         row.prop(rl, "exclude_ambient_occlusion", text="")
164         row = col.row()
165         row.prop(rl, "use_pass_environment")
166         row.prop(rl, "exclude_environment", text="")
167         row = col.row()
168         row.prop(rl, "use_pass_indirect")
169         row.prop(rl, "exclude_indirect", text="")
170         row = col.row()
171         row.prop(rl, "use_pass_reflection")
172         row.prop(rl, "exclude_reflection", text="")
173         row = col.row()
174         row.prop(rl, "use_pass_refraction")
175         row.prop(rl, "exclude_refraction", text="")
176
177
178 class RENDER_PT_freestyle(RenderButtonsPanel, Panel):
179     bl_label = "Freestyle"
180     COMPAT_ENGINES = {'BLENDER_RENDER'}
181
182     @classmethod
183     def poll(cls, context):
184         rd = context.scene.render
185         rl = rd.layers.active
186         return rl and rl.use_freestyle
187
188     def draw(self, context):
189         layout = self.layout
190
191         rd = context.scene.render
192         rl = rd.layers.active
193         freestyle = rl.freestyle_settings
194
195         split = layout.split()
196
197         col = split.column()
198         col.prop(freestyle, "raycasting_algorithm", text="Raycasting Algorithm")
199         col.prop(freestyle, "mode", text="Control Mode")
200
201         if freestyle.mode == "EDITOR":
202             col.label(text="Edge Detection Options:")
203             col.prop(freestyle, "use_smoothness")
204             col.prop(freestyle, "crease_angle")
205             col.prop(freestyle, "sphere_radius")
206             col.prop(freestyle, "kr_derivative_epsilon")
207
208             lineset = freestyle.linesets.active
209
210             col.label(text="Line Sets:")
211             row = col.row()
212             rows = 2
213             if lineset:
214                 rows = 5
215             row.template_list(freestyle, "linesets", freestyle.linesets, "active_index", rows=rows)
216
217             sub = row.column()
218             subsub = sub.column(align=True)
219             subsub.operator("scene.freestyle_lineset_add", icon='ZOOMIN', text="")
220             subsub.operator("scene.freestyle_lineset_remove", icon='ZOOMOUT', text="")
221             if lineset:
222                 sub.separator()
223                 subsub = sub.column(align=True)
224                 subsub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
225                 subsub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
226
227             if lineset:
228                 col.prop(lineset, "name")
229
230                 col.prop(lineset, "select_by_visibility")
231                 if lineset.select_by_visibility:
232                     sub = col.row(align=True)
233                     sub.prop(lineset, "visibility", expand=True)
234                     if lineset.visibility == "RANGE":
235                         sub = col.row(align=True)
236                         sub.prop(lineset, "qi_start")
237                         sub.prop(lineset, "qi_end")
238                     col.separator() # XXX
239
240                 col.prop(lineset, "select_by_edge_types")
241                 if lineset.select_by_edge_types:
242                     row = col.row()
243                     row.prop(lineset, "edge_type_negation", expand=True)
244                     row = col.row()
245                     row.prop(lineset, "edge_type_combination", expand=True)
246
247                     row = col.row()
248                     sub = row.column()
249                     sub.prop(lineset, "select_silhouette")
250                     sub.prop(lineset, "select_border")
251                     sub.prop(lineset, "select_crease")
252                     sub.prop(lineset, "select_ridge")
253                     sub.prop(lineset, "select_valley")
254                     sub.prop(lineset, "select_suggestive_contour")
255                     sub.prop(lineset, "select_material_boundary")
256                     sub = row.column()
257                     sub.prop(lineset, "select_contour")
258                     sub.prop(lineset, "select_external_contour")
259                     col.separator() # XXX
260
261                 col.prop(lineset, "select_by_group")
262                 if lineset.select_by_group:
263                     col.prop(lineset, "group")
264                     row = col.row()
265                     row.prop(lineset, "group_negation", expand=True)
266                     col.separator() # XXX
267
268                 col.prop(lineset, "select_by_image_border")
269
270         else: # freestyle.mode == "SCRIPT"
271
272             col.prop(freestyle, "use_smoothness")
273             col.prop(freestyle, "crease_angle")
274             col.prop(freestyle, "sphere_radius")
275             col.prop(freestyle, "use_ridges_and_valleys")
276             col.prop(freestyle, "use_suggestive_contours")
277             sub = col.row()
278             sub.prop(freestyle, "kr_derivative_epsilon")
279             sub.active = freestyle.use_suggestive_contours
280             col.prop(freestyle, "use_material_boundaries")
281             col.operator("scene.freestyle_module_add")
282
283             for i, module in enumerate(freestyle.modules):
284                 box = layout.box()
285                 box.context_pointer_set("freestyle_module", module)
286                 row = box.row(align=True)
287                 row.prop(module, "use", text="")
288                 row.prop(module, "module_path", text="")
289                 row.operator("scene.freestyle_module_remove", icon='X', text="")
290                 row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
291                 row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
292
293
294 class RENDER_PT_freestyle_linestyle(RenderButtonsPanel, Panel):
295     bl_label = "Freestyle: Line Style"
296     COMPAT_ENGINES = {'BLENDER_RENDER'}
297
298     @classmethod
299     def poll(cls, context):
300         rd = context.scene.render
301         rl = rd.layers.active
302         if rl and rl.use_freestyle:
303             freestyle = rl.freestyle_settings
304             return freestyle.mode == "EDITOR" and freestyle.linesets.active
305         return False
306
307     def draw_modifier_box_header(self, box, modifier):
308         row = box.row()
309         row.context_pointer_set("modifier", modifier)
310         if modifier.expanded:
311             icon = "TRIA_DOWN"
312         else:
313             icon = "TRIA_RIGHT"
314         row.prop(modifier, "expanded", text="", icon=icon, emboss=False)
315         row.label(text=modifier.rna_type.name)
316         row.prop(modifier, "name", text="")
317         row.prop(modifier, "use", text="")
318         sub = row.row(align=True)
319         sub.operator("scene.freestyle_modifier_move", icon='TRIA_UP', text="").direction = 'UP'
320         sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
321         row.operator("scene.freestyle_modifier_remove", icon='X', text="")
322
323     def draw_modifier_common(self, box, modifier):
324         row = box.row()
325         row.prop(modifier, "blend", text="")
326         row.prop(modifier, "influence")
327
328     def draw_modifier_color_ramp_common(self, box, modifier, has_range):
329         box.template_color_ramp(modifier, "color_ramp", expand=True)
330         if has_range:
331             row = box.row(align=True)
332             row.prop(modifier, "range_min")
333             row.prop(modifier, "range_max")
334
335     def draw_modifier_curve_common(self, box, modifier, has_range, has_value):
336         row = box.row()
337         row.prop(modifier, "mapping", text="")
338         sub = row.column()
339         sub.prop(modifier, "invert")
340         if modifier.mapping == "CURVE":
341             sub.enabled = False
342             box.template_curve_mapping(modifier, "curve")
343         if has_range:
344             row = box.row(align=True)
345             row.prop(modifier, "range_min")
346             row.prop(modifier, "range_max")
347         if has_value:
348             row = box.row(align=True)
349             row.prop(modifier, "value_min")
350             row.prop(modifier, "value_max")
351
352     def draw_color_modifier(self, context, modifier):
353         layout = self.layout
354
355         col = layout.column(align=True)
356         self.draw_modifier_box_header(col.box(), modifier)
357         if modifier.expanded:
358             box = col.box()
359             self.draw_modifier_common(box, modifier)
360
361             if modifier.type == "ALONG_STROKE":
362                 self.draw_modifier_color_ramp_common(box, modifier, False)
363
364             elif modifier.type == "DISTANCE_FROM_OBJECT":
365                 box.prop(modifier, "target")
366                 self.draw_modifier_color_ramp_common(box, modifier, True)
367
368             elif modifier.type == "DISTANCE_FROM_CAMERA":
369                 self.draw_modifier_color_ramp_common(box, modifier, True)
370                 prop = box.operator("scene.freestyle_fill_range_by_selection")
371                 prop.type = 'COLOR'
372                 prop.name = modifier.name
373
374             elif modifier.type == "MATERIAL":
375                 row = box.row()
376                 row.prop(modifier, "material_attr", text="")
377                 sub = row.column()
378                 sub.prop(modifier, "use_ramp")
379                 if modifier.material_attr in ["DIFF", "SPEC"]:
380                     sub.enabled = True
381                     show_ramp = modifier.use_ramp
382                 else:
383                     sub.enabled = False
384                     show_ramp = True
385                 if show_ramp:
386                     self.draw_modifier_color_ramp_common(box, modifier, False)
387
388     def draw_alpha_modifier(self, context, modifier):
389         layout = self.layout
390
391         col = layout.column(align=True)
392         self.draw_modifier_box_header(col.box(), modifier)
393         if modifier.expanded:
394             box = col.box()
395             self.draw_modifier_common(box, modifier)
396
397             if modifier.type == "ALONG_STROKE":
398                 self.draw_modifier_curve_common(box, modifier, False, False)
399
400             elif modifier.type == "DISTANCE_FROM_OBJECT":
401                 box.prop(modifier, "target")
402                 self.draw_modifier_curve_common(box, modifier, True, False)
403
404             elif modifier.type == "DISTANCE_FROM_CAMERA":
405                 self.draw_modifier_curve_common(box, modifier, True, False)
406                 prop = box.operator("scene.freestyle_fill_range_by_selection")
407                 prop.type = 'ALPHA'
408                 prop.name = modifier.name
409
410             elif modifier.type == "MATERIAL":
411                 box.prop(modifier, "material_attr", text="")
412                 self.draw_modifier_curve_common(box, modifier, False, False)
413
414     def draw_thickness_modifier(self, context, modifier):
415         layout = self.layout
416
417         col = layout.column(align=True)
418         self.draw_modifier_box_header(col.box(), modifier)
419         if modifier.expanded:
420             box = col.box()
421             self.draw_modifier_common(box, modifier)
422
423             if modifier.type == "ALONG_STROKE":
424                 self.draw_modifier_curve_common(box, modifier, False, True)
425
426             elif modifier.type == "DISTANCE_FROM_OBJECT":
427                 box.prop(modifier, "target")
428                 self.draw_modifier_curve_common(box, modifier, True, True)
429
430             elif modifier.type == "DISTANCE_FROM_CAMERA":
431                 self.draw_modifier_curve_common(box, modifier, True, True)
432                 prop = box.operator("scene.freestyle_fill_range_by_selection")
433                 prop.type = 'THICKNESS'
434                 prop.name = modifier.name
435
436             elif modifier.type == "MATERIAL":
437                 box.prop(modifier, "material_attr", text="")
438                 self.draw_modifier_curve_common(box, modifier, False, True)
439
440     def draw(self, context):
441         layout = self.layout
442
443         rd = context.scene.render
444         rl = rd.layers.active
445         lineset = rl.freestyle_settings.linesets.active
446         linestyle = lineset.linestyle
447
448         split = layout.split()
449         col = split.column()
450         col.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
451
452         col.separator()
453         sub = col.row(align=True)
454         sub.prop(linestyle, "panel", expand=True)
455
456         if linestyle.panel == "COLOR":
457             col.label(text="Base Color:")
458             col.prop(linestyle, "color", text="")
459             col.label(text="Modifiers:")
460             layout.operator_menu_enum("scene.freestyle_color_modifier_add", "type", text="Add Modifier")
461             for modifier in linestyle.color_modifiers:
462                 self.draw_color_modifier(context, modifier)
463         elif linestyle.panel == "ALPHA":
464             col.label(text="Base Transparency:")
465             col.prop(linestyle, "alpha")
466             col.label(text="Modifiers:")
467             layout.operator_menu_enum("scene.freestyle_alpha_modifier_add", "type", text="Add Modifier")
468             for modifier in linestyle.alpha_modifiers:
469                 self.draw_alpha_modifier(context, modifier)
470         elif linestyle.panel == "THICKNESS":
471             col.label(text="Base Thickness:")
472             col.prop(linestyle, "thickness")
473             col.label(text="Modifiers:")
474             layout.operator_menu_enum("scene.freestyle_thickness_modifier_add", "type", text="Add Modifier")
475             for modifier in linestyle.thickness_modifiers:
476                 self.draw_thickness_modifier(context, modifier)
477         elif linestyle.panel == "STROKES":
478             col.label(text="Chaining:")
479             col.prop(linestyle, "same_object")
480             col.separator()
481             col.label(text="Splitting:")
482             sub = col.row(align=True)
483             sub.prop(linestyle, "material_boundary")
484             col.separator()
485             col.label(text="Caps:")
486             sub = col.row(align=True)
487             sub.prop(linestyle, "caps", expand=True)
488             col.separator()
489             col.prop(linestyle, "use_dashed_line")
490             sub = col.row()
491             sub.enabled = linestyle.use_dashed_line
492             subsub = sub.column()
493             subsub.label(text="Dash")
494             subsub.prop(linestyle, "dash1", text="")
495             subsub = sub.column()
496             subsub.label(text="Gap")
497             subsub.prop(linestyle, "gap1", text="")
498             subsub = sub.column()
499             subsub.label(text="Dash")
500             subsub.prop(linestyle, "dash2", text="")
501             subsub = sub.column()
502             subsub.label(text="Gap")
503             subsub.prop(linestyle, "gap2", text="")
504             subsub = sub.column()
505             subsub.label(text="Dash")
506             subsub.prop(linestyle, "dash3", text="")
507             subsub = sub.column()
508             subsub.label(text="Gap")
509             subsub.prop(linestyle, "gap3", text="")
510         elif linestyle.panel == "DISTORT":
511             pass
512         elif linestyle.panel == "MISC":
513             pass
514
515
516 class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
517     bl_label = "Dimensions"
518     COMPAT_ENGINES = {'BLENDER_RENDER'}
519
520     def draw(self, context):
521         layout = self.layout
522
523         scene = context.scene
524         rd = scene.render
525
526         row = layout.row(align=True)
527         row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
528         row.operator("render.preset_add", text="", icon="ZOOMIN")
529         row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
530
531         split = layout.split()
532
533         col = split.column()
534         sub = col.column(align=True)
535         sub.label(text="Resolution:")
536         sub.prop(rd, "resolution_x", text="X")
537         sub.prop(rd, "resolution_y", text="Y")
538         sub.prop(rd, "resolution_percentage", text="")
539
540         sub.label(text="Aspect Ratio:")
541         sub.prop(rd, "pixel_aspect_x", text="X")
542         sub.prop(rd, "pixel_aspect_y", text="Y")
543
544         row = col.row()
545         row.prop(rd, "use_border", text="Border")
546         sub = row.row()
547         sub.active = rd.use_border
548         sub.prop(rd, "use_crop_to_border", text="Crop")
549
550         col = split.column()
551         sub = col.column(align=True)
552         sub.label(text="Frame Range:")
553         sub.prop(scene, "frame_start", text="Start")
554         sub.prop(scene, "frame_end", text="End")
555         sub.prop(scene, "frame_step", text="Step")
556
557         sub.label(text="Frame Rate:")
558         if rd.fps_base == 1:
559             fps_rate = round(rd.fps / rd.fps_base)
560         else:
561             fps_rate = round(rd.fps / rd.fps_base, 2)
562
563         # TODO: Change the following to iterate over existing presets
564         custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
565
566         if custom_framerate == True:
567             fps_label_text = "Custom (" + str(fps_rate) + " fps)"
568         else:
569             fps_label_text = str(fps_rate) + " fps"
570
571         sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
572
573         if custom_framerate or (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom"):
574             sub.prop(rd, "fps")
575             sub.prop(rd, "fps_base", text="/")
576         subrow = sub.row(align=True)
577         subrow.label(text="Time Remapping:")
578         subrow = sub.row(align=True)
579         subrow.prop(rd, "frame_map_old", text="Old")
580         subrow.prop(rd, "frame_map_new", text="New")
581
582
583 class RENDER_PT_antialiasing(RenderButtonsPanel, Panel):
584     bl_label = "Anti-Aliasing"
585     COMPAT_ENGINES = {'BLENDER_RENDER'}
586
587     def draw_header(self, context):
588         rd = context.scene.render
589
590         self.layout.prop(rd, "use_antialiasing", text="")
591
592     def draw(self, context):
593         layout = self.layout
594
595         rd = context.scene.render
596         layout.active = rd.use_antialiasing
597
598         split = layout.split()
599
600         col = split.column()
601         col.row().prop(rd, "antialiasing_samples", expand=True)
602         sub = col.row()
603         sub.enabled = not rd.use_border
604         sub.prop(rd, "use_full_sample")
605
606         col = split.column()
607         col.prop(rd, "pixel_filter_type", text="")
608         col.prop(rd, "filter_size", text="Size")
609
610
611 class RENDER_PT_motion_blur(RenderButtonsPanel, Panel):
612     bl_label = "Sampled Motion Blur"
613     bl_options = {'DEFAULT_CLOSED'}
614     COMPAT_ENGINES = {'BLENDER_RENDER'}
615
616     @classmethod
617     def poll(cls, context):
618         rd = context.scene.render
619         return not rd.use_full_sample and (rd.engine in cls.COMPAT_ENGINES)
620
621     def draw_header(self, context):
622         rd = context.scene.render
623
624         self.layout.prop(rd, "use_motion_blur", text="")
625
626     def draw(self, context):
627         layout = self.layout
628
629         rd = context.scene.render
630         layout.active = rd.use_motion_blur
631
632         row = layout.row()
633         row.prop(rd, "motion_blur_samples")
634         row.prop(rd, "motion_blur_shutter")
635
636
637 class RENDER_PT_shading(RenderButtonsPanel, Panel):
638     bl_label = "Shading"
639     bl_options = {'DEFAULT_CLOSED'}
640     COMPAT_ENGINES = {'BLENDER_RENDER'}
641
642     def draw(self, context):
643         layout = self.layout
644
645         rd = context.scene.render
646
647         split = layout.split()
648
649         col = split.column()
650         col.prop(rd, "use_textures", text="Textures")
651         col.prop(rd, "use_shadows", text="Shadows")
652         col.prop(rd, "use_sss", text="Subsurface Scattering")
653         col.prop(rd, "use_envmaps", text="Environment Map")
654
655         col = split.column()
656         col.prop(rd, "use_raytrace", text="Ray Tracing")
657         col.prop(rd, "use_color_management")
658         col.prop(rd, "alpha_mode", text="Alpha")
659
660
661 class RENDER_PT_performance(RenderButtonsPanel, Panel):
662     bl_label = "Performance"
663     bl_options = {'DEFAULT_CLOSED'}
664     COMPAT_ENGINES = {'BLENDER_RENDER'}
665
666     def draw(self, context):
667         layout = self.layout
668
669         rd = context.scene.render
670
671         split = layout.split()
672
673         col = split.column()
674         col.label(text="Threads:")
675         col.row().prop(rd, "threads_mode", expand=True)
676         sub = col.column()
677         sub.enabled = rd.threads_mode == 'FIXED'
678         sub.prop(rd, "threads")
679         sub = col.column(align=True)
680         sub.label(text="Tiles:")
681         sub.prop(rd, "parts_x", text="X")
682         sub.prop(rd, "parts_y", text="Y")
683
684         col = split.column()
685         col.label(text="Memory:")
686         sub = col.column()
687         sub.enabled = not (rd.use_border or rd.use_full_sample)
688         sub.prop(rd, "use_save_buffers")
689         sub = col.column()
690         sub.active = rd.use_compositing
691         sub.prop(rd, "use_free_image_textures")
692         sub.prop(rd, "use_free_unused_nodes")
693         sub = col.column()
694         sub.active = rd.use_raytrace
695         sub.label(text="Acceleration structure:")
696         sub.prop(rd, "raytrace_method", text="")
697         if rd.raytrace_method == 'OCTREE':
698             sub.prop(rd, "octree_resolution", text="Resolution")
699         else:
700             sub.prop(rd, "use_instances", text="Instances")
701         sub.prop(rd, "use_local_coords", text="Local Coordinates")
702
703
704 class RENDER_PT_post_processing(RenderButtonsPanel, Panel):
705     bl_label = "Post Processing"
706     bl_options = {'DEFAULT_CLOSED'}
707     COMPAT_ENGINES = {'BLENDER_RENDER'}
708
709     def draw(self, context):
710         layout = self.layout
711
712         rd = context.scene.render
713
714         split = layout.split()
715
716         col = split.column()
717         col.prop(rd, "use_compositing")
718         col.prop(rd, "use_sequencer")
719
720         split.prop(rd, "dither_intensity", text="Dither", slider=True)
721
722         layout.separator()
723
724         split = layout.split()
725
726         col = split.column()
727         col.prop(rd, "use_fields", text="Fields")
728         sub = col.column()
729         sub.active = rd.use_fields
730         sub.row().prop(rd, "field_order", expand=True)
731         sub.prop(rd, "use_fields_still", text="Still")
732
733         col = split.column()
734         col.prop(rd, "use_edge_enhance")
735         sub = col.column()
736         sub.active = rd.use_edge_enhance
737         sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
738         sub.prop(rd, "edge_color", text="")
739
740         layout.separator()
741
742         split = layout.split()
743         col = split.column()
744         col.prop(rd, "use_freestyle", text="Freestyle")
745
746 class RENDER_PT_stamp(RenderButtonsPanel, Panel):
747     bl_label = "Stamp"
748     bl_options = {'DEFAULT_CLOSED'}
749     COMPAT_ENGINES = {'BLENDER_RENDER'}
750
751     def draw_header(self, context):
752         rd = context.scene.render
753
754         self.layout.prop(rd, "use_stamp", text="")
755
756     def draw(self, context):
757         layout = self.layout
758
759         rd = context.scene.render
760
761         layout.active = rd.use_stamp
762
763         split = layout.split()
764
765         col = split.column()
766         col.prop(rd, "use_stamp_time", text="Time")
767         col.prop(rd, "use_stamp_date", text="Date")
768         col.prop(rd, "use_stamp_render_time", text="RenderTime")
769         col.prop(rd, "use_stamp_frame", text="Frame")
770         col.prop(rd, "use_stamp_scene", text="Scene")
771         col.prop(rd, "use_stamp_camera", text="Camera")
772         col.prop(rd, "use_stamp_lens", text="Lens")
773         col.prop(rd, "use_stamp_filename", text="Filename")
774         col.prop(rd, "use_stamp_marker", text="Marker")
775         col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")
776
777         col = split.column()
778         col.active = rd.use_stamp
779         col.prop(rd, "stamp_foreground", slider=True)
780         col.prop(rd, "stamp_background", slider=True)
781         col.separator()
782         col.prop(rd, "stamp_font_size", text="Font Size")
783
784         row = layout.split(percentage=0.2)
785         row.prop(rd, "use_stamp_note", text="Note")
786         sub = row.row()
787         sub.active = rd.use_stamp_note
788         sub.prop(rd, "stamp_note_text", text="")
789
790
791 class RENDER_PT_output(RenderButtonsPanel, Panel):
792     bl_label = "Output"
793     COMPAT_ENGINES = {'BLENDER_RENDER'}
794
795     def draw(self, context):
796         layout = self.layout
797
798         rd = context.scene.render
799         file_format = rd.file_format
800
801         layout.prop(rd, "filepath", text="")
802
803         split = layout.split()
804
805         col = split.column()
806         col.prop(rd, "file_format", text="")
807         col.row().prop(rd, "color_mode", text="Color", expand=True)
808
809         col = split.column()
810         col.prop(rd, "use_file_extension")
811         col.prop(rd, "use_overwrite")
812         col.prop(rd, "use_placeholder")
813
814         if file_format in {'AVI_JPEG', 'JPEG'}:
815             layout.prop(rd, "file_quality", slider=True)
816
817         if file_format == 'PNG':
818             layout.prop(rd, "file_quality", slider=True, text="Compression")
819
820         if file_format in {'OPEN_EXR', 'MULTILAYER'}:
821             row = layout.row()
822             row.prop(rd, "exr_codec", text="Codec")
823
824             if file_format == 'OPEN_EXR':
825                 row = layout.row()
826                 row.prop(rd, "use_exr_half")
827                 row.prop(rd, "exr_zbuf")
828                 row.prop(rd, "exr_preview")
829
830         elif file_format == 'JPEG2000':
831             split = layout.split()
832             col = split.column()
833             col.label(text="Depth:")
834             col.row().prop(rd, "jpeg2k_depth", expand=True)
835
836             col = split.column()
837             col.prop(rd, "jpeg2k_preset", text="")
838             col.prop(rd, "jpeg2k_ycc")
839
840         elif file_format in {'CINEON', 'DPX'}:
841
842             split = layout.split()
843             split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
844             '''
845             col = split.column()
846             col.prop(rd, "use_cineon_log", text="Convert to Log")
847
848             col = split.column(align=True)
849             col.active = rd.use_cineon_log
850             col.prop(rd, "cineon_black", text="Black")
851             col.prop(rd, "cineon_white", text="White")
852             col.prop(rd, "cineon_gamma", text="Gamma")
853             '''
854
855         elif file_format == 'TIFF':
856             layout.prop(rd, "use_tiff_16bit")
857
858         elif file_format == 'QUICKTIME_CARBON':
859             layout.operator("scene.render_data_set_quicktime_codec")
860
861         elif file_format == 'QUICKTIME_QTKIT':
862             split = layout.split()
863             col = split.column()
864             col.prop(rd, "quicktime_codec_type", text="Video Codec")
865             col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
866
867             # Audio
868             col.prop(rd, "quicktime_audiocodec_type", text="Audio Codec")
869             if rd.quicktime_audiocodec_type != 'No audio':
870                 split = layout.split()
871                 if rd.quicktime_audiocodec_type == 'LPCM':
872                     split.prop(rd, "quicktime_audio_bitdepth", text="")
873
874                 split.prop(rd, "quicktime_audio_samplerate", text="")
875
876                 split = layout.split()
877                 col = split.column()
878                 if rd.quicktime_audiocodec_type == 'AAC':
879                     col.prop(rd, "quicktime_audio_bitrate")
880
881                 subsplit = split.split()
882                 col = subsplit.column()
883
884                 if rd.quicktime_audiocodec_type == 'AAC':
885                     col.prop(rd, "quicktime_audio_codec_isvbr")
886
887                 col = subsplit.column()
888                 col.prop(rd, "quicktime_audio_resampling_hq")
889
890
891 class RENDER_PT_encoding(RenderButtonsPanel, Panel):
892     bl_label = "Encoding"
893     bl_options = {'DEFAULT_CLOSED'}
894     COMPAT_ENGINES = {'BLENDER_RENDER'}
895
896     @classmethod
897     def poll(cls, context):
898         rd = context.scene.render
899         return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
900
901     def draw(self, context):
902         layout = self.layout
903
904         rd = context.scene.render
905
906         layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
907
908         split = layout.split()
909         split.prop(rd, "ffmpeg_format")
910         if rd.ffmpeg_format in {'AVI', 'QUICKTIME', 'MKV', 'OGG'}:
911             split.prop(rd, "ffmpeg_codec")
912         else:
913             split.label()
914
915         row = layout.row()
916         row.prop(rd, "ffmpeg_video_bitrate")
917         row.prop(rd, "ffmpeg_gopsize")
918
919         split = layout.split()
920
921         col = split.column()
922         col.label(text="Rate:")
923         col.prop(rd, "ffmpeg_minrate", text="Minimum")
924         col.prop(rd, "ffmpeg_maxrate", text="Maximum")
925         col.prop(rd, "ffmpeg_buffersize", text="Buffer")
926
927         col = split.column()
928         col.prop(rd, "ffmpeg_autosplit")
929         col.label(text="Mux:")
930         col.prop(rd, "ffmpeg_muxrate", text="Rate")
931         col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
932
933         layout.separator()
934
935         # Audio:
936         if rd.ffmpeg_format not in {'MP3'}:
937             layout.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
938
939         split = layout.split()
940
941         col = split.column()
942         col.prop(rd, "ffmpeg_audio_bitrate")
943         col.prop(rd, "ffmpeg_audio_mixrate")
944
945         split.prop(rd, "ffmpeg_audio_volume", slider=True)
946
947
948 class RENDER_PT_bake(RenderButtonsPanel, Panel):
949     bl_label = "Bake"
950     bl_options = {'DEFAULT_CLOSED'}
951     COMPAT_ENGINES = {'BLENDER_RENDER'}
952
953     def draw(self, context):
954         layout = self.layout
955
956         rd = context.scene.render
957
958         layout.operator("object.bake_image", icon='RENDER_STILL')
959
960         layout.prop(rd, "bake_type")
961
962         multires_bake = False
963         if rd.bake_type in ['NORMALS', 'DISPLACEMENT']:
964             layout.prop(rd, 'use_bake_multires')
965             multires_bake = rd.use_bake_multires
966
967         if not multires_bake:
968             if rd.bake_type == 'NORMALS':
969                 layout.prop(rd, "bake_normal_space")
970             elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
971                 layout.prop(rd, "use_bake_normalize")
972
973             # col.prop(rd, "bake_aa_mode")
974             # col.prop(rd, "use_bake_antialiasing")
975
976             layout.separator()
977
978             split = layout.split()
979
980             col = split.column()
981             col.prop(rd, "use_bake_clear")
982             col.prop(rd, "bake_margin")
983             col.prop(rd, "bake_quad_split", text="Split")
984
985             col = split.column()
986             col.prop(rd, "use_bake_selected_to_active")
987             sub = col.column()
988             sub.active = rd.use_bake_selected_to_active
989             sub.prop(rd, "bake_distance")
990             sub.prop(rd, "bake_bias")
991         else:
992             if rd.bake_type == 'DISPLACEMENT':
993                 layout.prop(rd, "use_bake_lores_mesh")
994
995             layout.prop(rd, "use_bake_clear")
996             layout.prop(rd, "bake_margin")
997
998
999 if __name__ == "__main__":  # only for live edit.
1000     bpy.utils.register_module(__name__)