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