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