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