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