Removing MESH_OT_vertices_transform_to_sphere.
[blender-staging.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
79                 col = split.column()
80                 col.itemR(rl, "sky")
81                 col.itemR(rl, "edge")
82                 col.itemR(rl, "strand")
83
84                 if rl.zmask:
85                         split = layout.split()
86                         split.itemL(text="Zmask Layers:")
87                         split.column().itemR(rl, "zmask_layers", text="")
88                 
89                 layout.itemS()
90                 
91                 split = layout.split()
92                 
93                 col = split.column()
94                 col.itemL(text="Passes:")
95                 col.itemR(rl, "pass_combined")
96                 col.itemR(rl, "pass_z")
97                 col.itemR(rl, "pass_vector")
98                 col.itemR(rl, "pass_normal")
99                 col.itemR(rl, "pass_uv")
100                 col.itemR(rl, "pass_mist")
101                 col.itemR(rl, "pass_object_index")
102
103                 col = split.column()
104                 col.itemL()
105                 col.itemR(rl, "pass_color")
106                 col.itemR(rl, "pass_diffuse")
107                 row = col.row()
108                 row.itemR(rl, "pass_specular")
109                 row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X')
110                 row = col.row()
111                 row.itemR(rl, "pass_shadow")
112                 row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X')
113                 row = col.row()
114                 row.itemR(rl, "pass_ao")
115                 row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X')
116                 row = col.row()
117                 row.itemR(rl, "pass_reflection")
118                 row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X')
119                 row = col.row()
120                 row.itemR(rl, "pass_refraction")
121                 row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
122
123 class RENDER_PT_shading(RenderButtonsPanel):
124         __label__ = "Shading"
125         COMPAT_ENGINES = set(['BLENDER_RENDER'])
126
127         def draw(self, context):
128                 layout = self.layout
129                 
130                 rd = context.scene.render_data
131                 
132                 split = layout.split()
133                 
134                 col = split.column()
135                 col.itemR(rd, "render_textures", text="Textures")
136                 col.itemR(rd, "render_shadows", text="Shadows")
137                 col.itemR(rd, "render_sss", text="Subsurface Scattering")
138                 col.itemR(rd, "render_envmaps", text="Environment Map")
139                 
140                 col = split.column()
141                 col.itemR(rd, "render_raytracing", text="Ray Tracing")
142                 col.itemR(rd, "color_management")
143                 col.itemR(rd, "alpha_mode", text="Alpha")
144
145 class RENDER_PT_performance(RenderButtonsPanel):
146         __label__ = "Performance"
147         __default_closed__ = True
148         COMPAT_ENGINES = set(['BLENDER_RENDER'])
149
150         def draw(self, context):
151                 layout = self.layout
152                 
153                 rd = context.scene.render_data
154
155                 split = layout.split()
156                 
157                 col = split.column(align=True)
158                 col.itemL(text="Threads:")
159                 col.row().itemR(rd, "threads_mode", expand=True)
160                 sub = col.column()
161                 sub.enabled = rd.threads_mode == 'THREADS_FIXED'
162                 sub.itemR(rd, "threads")
163                 col.itemL(text="Tiles:")
164                 col.itemR(rd, "parts_x", text="X")
165                 col.itemR(rd, "parts_y", text="Y")
166
167                 col = split.column()
168                 col.itemL(text="Memory:")
169                 sub = col.column()
170                 sub.itemR(rd, "save_buffers")
171                 sub.enabled = not rd.full_sample
172                 sub = col.column()
173                 sub.active = rd.use_compositing
174                 sub.itemR(rd, "free_image_textures")
175                 sub = col.column()
176                 sub.active = rd.render_raytracing
177                 sub.itemL(text="Acceleration structure:")
178                 sub.itemR(rd, "raytrace_structure", text="")
179                 if rd.raytrace_structure == "OCTREE":
180                         sub.itemR(rd, "octree_resolution", text="Resolution")
181                 else:
182                         sub.itemR(rd, "use_instances", text="Instances")
183                 sub.itemR(rd, "use_local_coords", text="Local Coordinates")
184
185 class RENDER_PT_post_processing(RenderButtonsPanel):
186         __label__ = "Post Processing"
187         __default_closed__ = True
188         COMPAT_ENGINES = set(['BLENDER_RENDER'])
189
190         def draw(self, context):
191                 layout = self.layout
192                 
193                 rd = context.scene.render_data
194
195                 split = layout.split()
196
197                 col = split.column()
198                 col.itemR(rd, "use_compositing")
199                 col.itemR(rd, "use_sequencer")
200                 
201                 col = split.column()
202                 col.itemR(rd, "dither_intensity", text="Dither", slider=True)
203                 
204                 layout.itemS()
205                                 
206                 split = layout.split()
207                 
208                 col = split.column()
209                 col.itemR(rd, "fields", text="Fields")
210                 sub = col.column()
211                 sub.active = rd.fields
212                 sub.row().itemR(rd, "field_order", expand=True)
213                 sub.itemR(rd, "fields_still", text="Still")
214                 
215                 col = split.column()
216                 col.itemR(rd, "edge")
217                 sub = col.column()
218                 sub.active = rd.edge
219                 sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
220                 sub.itemR(rd, "edge_color", text="")
221                 
222 class RENDER_PT_output(RenderButtonsPanel):
223         __label__ = "Output"
224         COMPAT_ENGINES = set(['BLENDER_RENDER'])
225
226         def draw(self, context):
227                 layout = self.layout
228                 
229                 rd = context.scene.render_data
230                 
231                 layout.itemR(rd, "output_path", text="")
232
233                 split = layout.split()
234                 col = split.column()
235                 col.itemR(rd, "file_format", text="")
236                 col.row().itemR(rd, "color_mode", text="Color", expand=True)
237
238                 col = split.column()
239                 col.itemR(rd, "file_extensions")
240                 col.itemR(rd, "use_overwrite")
241                 col.itemR(rd, "use_placeholder")
242
243                 if rd.file_format in ('AVIJPEG', 'JPEG'):
244                         split = layout.split()
245                         split.itemR(rd, "quality", slider=True)
246                         
247                 elif rd.file_format == 'OPENEXR':
248                         split = layout.split()
249                         
250                         col = split.column()
251                         col.itemL(text="Codec:")
252                         col.itemR(rd, "exr_codec", text="")
253
254                         subsplit = split.split()
255                         col = subsplit.column()
256                         col.itemR(rd, "exr_half")
257                         col.itemR(rd, "exr_zbuf")
258                         col = subsplit.column()
259                         col.itemR(rd, "exr_preview")
260                 
261                 elif rd.file_format == 'JPEG2000':
262                         split = layout.split()
263                         col = split.column()
264                         col.itemL(text="Depth:")
265                         col.row().itemR(rd, "jpeg2k_depth", expand=True)
266
267                         col = split.column()
268                         col.itemR(rd, "jpeg2k_preset", text="")
269                         col.itemR(rd, "jpeg2k_ycc")
270                         
271                 elif rd.file_format in ('CINEON', 'DPX'):
272                         split = layout.split()
273                         col = split.column()
274                         col.itemR(rd, "cineon_log", text="Convert to Log")
275
276                         col = split.column(align=True)
277                         col.active = rd.cineon_log
278                         col.itemR(rd, "cineon_black", text="Black")
279                         col.itemR(rd, "cineon_white", text="White")
280                         col.itemR(rd, "cineon_gamma", text="Gamma")
281                         
282                 elif rd.file_format == 'TIFF':
283                         split = layout.split()
284                         split.itemR(rd, "tiff_bit")
285
286 class RENDER_PT_encoding(RenderButtonsPanel):
287         __label__ = "Encoding"
288         __default_closed__ = True
289         COMPAT_ENGINES = set(['BLENDER_RENDER'])
290         
291         def poll(self, context):
292                 rd = context.scene.render_data
293                 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
294
295         def draw(self, context):
296                 layout = self.layout
297                 
298                 rd = context.scene.render_data
299
300                 split = layout.split()
301                 
302                 split.itemR(rd, "ffmpeg_format")
303                 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
304                         split.itemR(rd, "ffmpeg_codec")
305                 else:
306                         split.itemL()
307
308                 split = layout.split()
309         
310                 col = split.column()
311                 col.itemR(rd, "ffmpeg_video_bitrate")
312                 col.itemL(text="Rate:")
313                 col.itemR(rd, "ffmpeg_minrate", text="Minimum")
314                 col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
315                 col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
316                 
317                 col = split.column()
318                 col.itemR(rd, "ffmpeg_gopsize")
319                 col.itemR(rd, "ffmpeg_autosplit")
320                 col.itemL(text="Mux:")
321                 col.itemR(rd, "ffmpeg_muxrate", text="Rate")
322                 col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
323                 
324                 row = layout.row()
325                 row.itemL(text="Audio:")
326                 row = layout.row()
327                 row.itemR(rd, "ffmpeg_audio_codec")
328                 
329                 split = layout.split()
330
331                 col = split.column()
332                 col.itemR(rd, "ffmpeg_audio_bitrate")
333                 col.itemR(rd, "ffmpeg_audio_mixrate")
334                 col = split.column()
335                 col.itemR(rd, "ffmpeg_multiplex_audio")
336                 col.itemR(rd, "ffmpeg_audio_volume")
337
338 class RENDER_PT_antialiasing(RenderButtonsPanel):
339         __label__ = "Anti-Aliasing"
340         COMPAT_ENGINES = set(['BLENDER_RENDER'])
341
342         def draw_header(self, context):
343                 rd = context.scene.render_data
344
345                 self.layout.itemR(rd, "antialiasing", text="")
346
347         def draw(self, context):
348                 layout = self.layout
349                 
350                 rd = context.scene.render_data
351
352                 layout.active = rd.antialiasing
353
354                 split = layout.split()
355                 
356                 col = split.column()
357                 col.row().itemR(rd, "antialiasing_samples", expand=True)
358                 col.itemR(rd, "full_sample")
359
360                 col = split.column()
361                 col.itemR(rd, "pixel_filter", text="")
362                 col.itemR(rd, "filter_size", text="Size", slider=True)
363         
364 class RENDER_PT_dimensions(RenderButtonsPanel):
365         __label__ = "Dimensions"
366         COMPAT_ENGINES = set(['BLENDER_RENDER'])
367
368         def draw(self, context):
369                 layout = self.layout
370                 
371                 scene = context.scene
372                 rd = scene.render_data
373                 
374                 split = layout.split()
375                 
376                 col = split.column()
377                 sub = col.column(align=True)
378                 sub.itemL(text="Resolution:")
379                 sub.itemR(rd, "resolution_x", text="X")
380                 sub.itemR(rd, "resolution_y", text="Y")
381                 sub.itemR(rd, "resolution_percentage", text="")
382                 
383                 sub.itemL(text="Aspect Ratio:")
384                 sub.itemR(rd, "pixel_aspect_x", text="X")
385                 sub.itemR(rd, "pixel_aspect_y", text="Y")
386
387                 row = col.row()
388                 row.itemR(rd, "use_border", text="Border")
389                 rowsub = row.row()
390                 rowsub.active = rd.use_border
391                 rowsub.itemR(rd, "crop_to_border", text="Crop")
392                 
393                 col = split.column(align=True)
394                 col.itemL(text="Frame Range:")
395                 col.itemR(scene, "start_frame", text="Start")
396                 col.itemR(scene, "end_frame", text="End")
397                 col.itemR(scene, "frame_step", text="Step")
398                 
399                 col.itemL(text="Frame Rate:")
400                 col.itemR(rd, "fps")
401                 col.itemR(rd, "fps_base",text="/")
402
403 class RENDER_PT_stamp(RenderButtonsPanel):
404         __label__ = "Stamp"
405         __default_closed__ = True
406         COMPAT_ENGINES = set(['BLENDER_RENDER'])
407
408         def draw_header(self, context):
409                 rd = context.scene.render_data
410
411                 self.layout.itemR(rd, "render_stamp", text="")
412
413         def draw(self, context):
414                 layout = self.layout
415                 
416                 rd = context.scene.render_data
417
418                 layout.active = rd.render_stamp
419
420                 split = layout.split()
421                 
422                 col = split.column()
423                 col.itemR(rd, "stamp_time", text="Time")
424                 col.itemR(rd, "stamp_date", text="Date")
425                 col.itemR(rd, "stamp_render_time", text="RenderTime")
426                 col.itemR(rd, "stamp_frame", text="Frame")
427                 col.itemR(rd, "stamp_scene", text="Scene")
428                 col.itemR(rd, "stamp_camera", text="Camera")
429                 col.itemR(rd, "stamp_filename", text="Filename")
430                 col.itemR(rd, "stamp_marker", text="Marker")
431                 col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
432
433                 col = split.column()
434                 col.active = rd.render_stamp
435                 col.itemR(rd, "stamp_foreground", slider=True)
436                 col.itemR(rd, "stamp_background", slider=True)
437                 col.itemR(rd, "stamp_font_size", text="Font Size")
438
439                 row = layout.split(percentage=0.2)
440                 row.itemR(rd, "stamp_note", text="Note")
441                 sub = row.row()
442                 sub.active = rd.stamp_note
443                 sub.itemR(rd, "stamp_note_text", text="")
444
445 bpy.types.register(RENDER_PT_render)
446 bpy.types.register(RENDER_PT_layers)
447 bpy.types.register(RENDER_PT_dimensions)
448 bpy.types.register(RENDER_PT_antialiasing)
449 bpy.types.register(RENDER_PT_shading)
450 bpy.types.register(RENDER_PT_output)
451 bpy.types.register(RENDER_PT_encoding)
452 bpy.types.register(RENDER_PT_performance)
453 bpy.types.register(RENDER_PT_post_processing)
454 bpy.types.register(RENDER_PT_stamp)