GPL2 header from firebird (without disclaimer), notice theres no copyright attributed...
[blender.git] / release / scripts / ui / properties_render.py
1 # This software is distributable under the terms of the GNU
2 # General Public License (GPL) v2, the text of which can be found at
3 # http://www.gnu.org/copyleft/gpl.html. Installing, importing or otherwise
4 # using this module constitutes acceptance of the terms of this License.
5
6
7 import bpy
8
9 class RenderButtonsPanel(bpy.types.Panel):
10     bl_space_type = 'PROPERTIES'
11     bl_region_type = 'WINDOW'
12     bl_context = "render"
13     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
14
15     def poll(self, context):
16         rd = context.scene.render_data
17         return (context.scene and rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
18
19 class RENDER_PT_render(RenderButtonsPanel):
20     bl_label = "Render"
21     COMPAT_ENGINES = set(['BLENDER_RENDER'])
22
23     def draw(self, context):
24         layout = self.layout
25
26         rd = context.scene.render_data
27
28         row = layout.row()
29         row.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL')
30         row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
31
32         layout.itemR(rd, "display_mode", text="Display")
33
34 class RENDER_PT_layers(RenderButtonsPanel):
35     bl_label = "Layers"
36     bl_default_closed = True
37     COMPAT_ENGINES = set(['BLENDER_RENDER'])
38
39     def draw(self, context):
40         layout = self.layout
41
42         scene = context.scene
43         rd = scene.render_data
44
45         row = layout.row()
46         row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
47
48         col = row.column(align=True)
49         col.itemO("scene.render_layer_add", icon='ICON_ZOOMIN', text="")
50         col.itemO("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="")
51
52         rl = rd.layers[rd.active_layer_index]
53
54         if rl:
55             layout.itemR(rl, "name")
56
57         split = layout.split()
58
59         col = split.column()
60         col.itemR(scene, "visible_layers", text="Scene")
61         col = split.column()
62         col.itemR(rl, "visible_layers", text="Layer")
63
64         layout.itemR(rl, "light_override", text="Light")
65         layout.itemR(rl, "material_override", text="Material")
66
67         layout.itemS()
68         layout.itemL(text="Include:")
69
70         split = layout.split()
71
72         col = split.column()
73         col.itemR(rl, "zmask")
74         row = col.row()
75         row.itemR(rl, "zmask_negate", text="Negate")
76         row.active = rl.zmask
77         col.itemR(rl, "all_z")
78
79         col = split.column()
80         col.itemR(rl, "solid")
81         col.itemR(rl, "halo")
82         col.itemR(rl, "ztransp")
83
84         col = split.column()
85         col.itemR(rl, "sky")
86         col.itemR(rl, "edge")
87         col.itemR(rl, "strand")
88
89         if rl.zmask:
90             split = layout.split()
91             split.itemL(text="Zmask Layers:")
92             split.column().itemR(rl, "zmask_layers", text="")
93
94         layout.itemS()
95
96         split = layout.split()
97
98         col = split.column()
99         col.itemL(text="Passes:")
100         col.itemR(rl, "pass_combined")
101         col.itemR(rl, "pass_z")
102         col.itemR(rl, "pass_vector")
103         col.itemR(rl, "pass_normal")
104         col.itemR(rl, "pass_uv")
105         col.itemR(rl, "pass_mist")
106         col.itemR(rl, "pass_object_index")
107
108         col = split.column()
109         col.itemL()
110         col.itemR(rl, "pass_color")
111         col.itemR(rl, "pass_diffuse")
112         row = col.row()
113         row.itemR(rl, "pass_specular")
114         row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X')
115         row = col.row()
116         row.itemR(rl, "pass_shadow")
117         row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X')
118         row = col.row()
119         row.itemR(rl, "pass_ao")
120         row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X')
121         row = col.row()
122         row.itemR(rl, "pass_reflection")
123         row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X')
124         row = col.row()
125         row.itemR(rl, "pass_refraction")
126         row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
127
128 class RENDER_PT_shading(RenderButtonsPanel):
129     bl_label = "Shading"
130     COMPAT_ENGINES = set(['BLENDER_RENDER'])
131
132     def draw(self, context):
133         layout = self.layout
134
135         rd = context.scene.render_data
136
137         split = layout.split()
138
139         col = split.column()
140         col.itemR(rd, "render_textures", text="Textures")
141         col.itemR(rd, "render_shadows", text="Shadows")
142         col.itemR(rd, "render_sss", text="Subsurface Scattering")
143         col.itemR(rd, "render_envmaps", text="Environment Map")
144
145         col = split.column()
146         col.itemR(rd, "render_raytracing", text="Ray Tracing")
147         col.itemR(rd, "color_management")
148         col.itemR(rd, "alpha_mode", text="Alpha")
149
150 class RENDER_PT_performance(RenderButtonsPanel):
151     bl_label = "Performance"
152     bl_default_closed = True
153     COMPAT_ENGINES = set(['BLENDER_RENDER'])
154
155     def draw(self, context):
156         layout = self.layout
157
158         rd = context.scene.render_data
159
160         split = layout.split()
161
162         col = split.column(align=True)
163         col.itemL(text="Threads:")
164         col.row().itemR(rd, "threads_mode", expand=True)
165         sub = col.column()
166         sub.enabled = rd.threads_mode == 'THREADS_FIXED'
167         sub.itemR(rd, "threads")
168         col.itemL(text="Tiles:")
169         col.itemR(rd, "parts_x", text="X")
170         col.itemR(rd, "parts_y", text="Y")
171
172         col = split.column()
173         col.itemL(text="Memory:")
174         sub = col.column()
175         sub.itemR(rd, "save_buffers")
176         sub.enabled = not rd.full_sample
177         sub = col.column()
178         sub.active = rd.use_compositing
179         sub.itemR(rd, "free_image_textures")
180         sub = col.column()
181         sub.active = rd.render_raytracing
182         sub.itemL(text="Acceleration structure:")
183         sub.itemR(rd, "raytrace_structure", text="")
184         if rd.raytrace_structure == "OCTREE":
185             sub.itemR(rd, "octree_resolution", text="Resolution")
186         else:
187             sub.itemR(rd, "use_instances", text="Instances")
188         sub.itemR(rd, "use_local_coords", text="Local Coordinates")
189
190 class RENDER_PT_post_processing(RenderButtonsPanel):
191     bl_label = "Post Processing"
192     bl_default_closed = True
193     COMPAT_ENGINES = set(['BLENDER_RENDER'])
194
195     def draw(self, context):
196         layout = self.layout
197
198         rd = context.scene.render_data
199
200         split = layout.split()
201
202         col = split.column()
203         col.itemR(rd, "use_compositing")
204         col.itemR(rd, "use_sequencer")
205
206         col = split.column()
207         col.itemR(rd, "dither_intensity", text="Dither", slider=True)
208
209         layout.itemS()
210
211         split = layout.split()
212
213         col = split.column()
214         col.itemR(rd, "fields", text="Fields")
215         sub = col.column()
216         sub.active = rd.fields
217         sub.row().itemR(rd, "field_order", expand=True)
218         sub.itemR(rd, "fields_still", text="Still")
219
220         col = split.column()
221         col.itemR(rd, "edge")
222         sub = col.column()
223         sub.active = rd.edge
224         sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
225         sub.itemR(rd, "edge_color", text="")
226
227 class RENDER_PT_output(RenderButtonsPanel):
228     bl_label = "Output"
229     COMPAT_ENGINES = set(['BLENDER_RENDER'])
230
231     def draw(self, context):
232         layout = self.layout
233
234         rd = context.scene.render_data
235
236         layout.itemR(rd, "output_path", text="")
237
238         split = layout.split()
239         col = split.column()
240         col.itemR(rd, "file_format", text="")
241         col.row().itemR(rd, "color_mode", text="Color", expand=True)
242
243         col = split.column()
244         col.itemR(rd, "file_extensions")
245         col.itemR(rd, "use_overwrite")
246         col.itemR(rd, "use_placeholder")
247
248         if rd.file_format in ('AVIJPEG', 'JPEG'):
249             split = layout.split()
250             split.itemR(rd, "quality", slider=True)
251
252         elif rd.file_format == 'OPENEXR':
253             split = layout.split()
254
255             col = split.column()
256             col.itemL(text="Codec:")
257             col.itemR(rd, "exr_codec", text="")
258
259             subsplit = split.split()
260             col = subsplit.column()
261             col.itemR(rd, "exr_half")
262             col.itemR(rd, "exr_zbuf")
263             col = subsplit.column()
264             col.itemR(rd, "exr_preview")
265
266         elif rd.file_format == 'JPEG2000':
267             split = layout.split()
268             col = split.column()
269             col.itemL(text="Depth:")
270             col.row().itemR(rd, "jpeg2k_depth", expand=True)
271
272             col = split.column()
273             col.itemR(rd, "jpeg2k_preset", text="")
274             col.itemR(rd, "jpeg2k_ycc")
275
276         elif rd.file_format in ('CINEON', 'DPX'):
277             split = layout.split()
278             col = split.column()
279             col.itemR(rd, "cineon_log", text="Convert to Log")
280
281             col = split.column(align=True)
282             col.active = rd.cineon_log
283             col.itemR(rd, "cineon_black", text="Black")
284             col.itemR(rd, "cineon_white", text="White")
285             col.itemR(rd, "cineon_gamma", text="Gamma")
286
287         elif rd.file_format == 'TIFF':
288             split = layout.split()
289             split.itemR(rd, "tiff_bit")
290
291 class RENDER_PT_encoding(RenderButtonsPanel):
292     bl_label = "Encoding"
293     bl_default_closed = True
294     COMPAT_ENGINES = set(['BLENDER_RENDER'])
295
296     def poll(self, context):
297         rd = context.scene.render_data
298         return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
299
300     def draw(self, context):
301         layout = self.layout
302
303         rd = context.scene.render_data
304
305         split = layout.split()
306
307         split.itemR(rd, "ffmpeg_format")
308         if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
309             split.itemR(rd, "ffmpeg_codec")
310         else:
311             split.itemL()
312
313         split = layout.split()
314
315         col = split.column()
316         col.itemR(rd, "ffmpeg_video_bitrate")
317         col.itemL(text="Rate:")
318         col.itemR(rd, "ffmpeg_minrate", text="Minimum")
319         col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
320         col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
321
322         col = split.column()
323         col.itemR(rd, "ffmpeg_gopsize")
324         col.itemR(rd, "ffmpeg_autosplit")
325         col.itemL(text="Mux:")
326         col.itemR(rd, "ffmpeg_muxrate", text="Rate")
327         col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
328
329         row = layout.row()
330         row.itemL(text="Audio:")
331         row = layout.row()
332         row.itemR(rd, "ffmpeg_audio_codec")
333
334         split = layout.split()
335
336         col = split.column()
337         col.itemR(rd, "ffmpeg_audio_bitrate")
338         col.itemR(rd, "ffmpeg_audio_mixrate")
339         col = split.column()
340         col.itemR(rd, "ffmpeg_multiplex_audio")
341         col.itemR(rd, "ffmpeg_audio_volume")
342
343 class RENDER_PT_antialiasing(RenderButtonsPanel):
344     bl_label = "Anti-Aliasing"
345     COMPAT_ENGINES = set(['BLENDER_RENDER'])
346
347     def draw_header(self, context):
348         rd = context.scene.render_data
349
350         self.layout.itemR(rd, "antialiasing", text="")
351
352     def draw(self, context):
353         layout = self.layout
354
355         rd = context.scene.render_data
356
357         layout.active = rd.antialiasing
358
359         split = layout.split()
360
361         col = split.column()
362         col.row().itemR(rd, "antialiasing_samples", expand=True)
363         col.itemR(rd, "full_sample")
364
365         col = split.column()
366         col.itemR(rd, "pixel_filter", text="")
367         col.itemR(rd, "filter_size", text="Size", slider=True)
368
369 class RENDER_PT_dimensions(RenderButtonsPanel):
370     bl_label = "Dimensions"
371     COMPAT_ENGINES = set(['BLENDER_RENDER'])
372
373     def draw(self, context):
374         layout = self.layout
375
376         scene = context.scene
377         rd = scene.render_data
378
379         split = layout.split()
380
381         col = split.column()
382         sub = col.column(align=True)
383         sub.itemL(text="Resolution:")
384         sub.itemR(rd, "resolution_x", text="X")
385         sub.itemR(rd, "resolution_y", text="Y")
386         sub.itemR(rd, "resolution_percentage", text="")
387
388         sub.itemL(text="Aspect Ratio:")
389         sub.itemR(rd, "pixel_aspect_x", text="X")
390         sub.itemR(rd, "pixel_aspect_y", text="Y")
391
392         row = col.row()
393         row.itemR(rd, "use_border", text="Border")
394         rowsub = row.row()
395         rowsub.active = rd.use_border
396         rowsub.itemR(rd, "crop_to_border", text="Crop")
397
398         col = split.column(align=True)
399         col.itemL(text="Frame Range:")
400         col.itemR(scene, "start_frame", text="Start")
401         col.itemR(scene, "end_frame", text="End")
402         col.itemR(scene, "frame_step", text="Step")
403
404         col.itemL(text="Frame Rate:")
405         col.itemR(rd, "fps")
406         col.itemR(rd, "fps_base",text="/")
407
408 class RENDER_PT_stamp(RenderButtonsPanel):
409     bl_label = "Stamp"
410     bl_default_closed = True
411     COMPAT_ENGINES = set(['BLENDER_RENDER'])
412
413     def draw_header(self, context):
414         rd = context.scene.render_data
415
416         self.layout.itemR(rd, "render_stamp", text="")
417
418     def draw(self, context):
419         layout = self.layout
420
421         rd = context.scene.render_data
422
423         layout.active = rd.render_stamp
424
425         split = layout.split()
426
427         col = split.column()
428         col.itemR(rd, "stamp_time", text="Time")
429         col.itemR(rd, "stamp_date", text="Date")
430         col.itemR(rd, "stamp_render_time", text="RenderTime")
431         col.itemR(rd, "stamp_frame", text="Frame")
432         col.itemR(rd, "stamp_scene", text="Scene")
433         col.itemR(rd, "stamp_camera", text="Camera")
434         col.itemR(rd, "stamp_filename", text="Filename")
435         col.itemR(rd, "stamp_marker", text="Marker")
436         col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
437
438         col = split.column()
439         col.active = rd.render_stamp
440         col.itemR(rd, "stamp_foreground", slider=True)
441         col.itemR(rd, "stamp_background", slider=True)
442         col.itemR(rd, "stamp_font_size", text="Font Size")
443
444         row = layout.split(percentage=0.2)
445         row.itemR(rd, "stamp_note", text="Note")
446         sub = row.row()
447         sub.active = rd.stamp_note
448         sub.itemR(rd, "stamp_note_text", text="")
449
450 bpy.types.register(RENDER_PT_render)
451 bpy.types.register(RENDER_PT_layers)
452 bpy.types.register(RENDER_PT_dimensions)
453 bpy.types.register(RENDER_PT_antialiasing)
454 bpy.types.register(RENDER_PT_shading)
455 bpy.types.register(RENDER_PT_output)
456 bpy.types.register(RENDER_PT_encoding)
457 bpy.types.register(RENDER_PT_performance)
458 bpy.types.register(RENDER_PT_post_processing)
459 bpy.types.register(RENDER_PT_stamp)