svn merge -r 22571:22800 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender-staging.git] / release / ui / buttons_scene.py
1
2 import bpy
3
4 class RenderButtonsPanel(bpy.types.Panel):
5         __space_type__ = 'PROPERTIES'
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                 col.itemR(rd, "dither_intensity", text="Dither", slider=True)
197                 
198                 layout.itemS()
199                                 
200                 split = layout.split()
201                 
202                 col = split.column()
203                 col.itemR(rd, "fields", text="Fields")
204                 sub = col.column()
205                 sub.active = rd.fields
206                 sub.row().itemR(rd, "field_order", expand=True)
207                 sub.itemR(rd, "fields_still", text="Still")
208                 
209                 col = split.column()
210                 col.itemR(rd, "edge")
211                 sub = col.column()
212                 sub.active = rd.edge
213                 sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
214                 sub.itemR(rd, "edge_color", text="")
215                 
216 class SCENE_PT_output(RenderButtonsPanel):
217         __label__ = "Output"
218         COMPAT_ENGINES = set(['BLENDER_RENDER'])
219
220         def draw(self, context):
221                 layout = self.layout
222                 
223                 rd = context.scene.render_data
224                 
225                 layout.itemR(rd, "output_path", text="")
226
227                 split = layout.split()
228                 col = split.column()
229                 col.itemR(rd, "file_format", text="")
230                 col.row().itemR(rd, "color_mode", text="Color", expand=True)
231
232                 col = split.column()
233                 col.itemR(rd, "file_extensions")
234                 col.itemR(rd, "use_overwrite")
235                 col.itemR(rd, "use_placeholder")
236
237                 if rd.file_format in ('AVIJPEG', 'JPEG'):
238                         split = layout.split()
239                         split.itemR(rd, "quality", slider=True)
240                         
241                 elif rd.file_format == 'OPENEXR':
242                         split = layout.split()
243                         
244                         col = split.column()
245                         col.itemR(rd, "exr_codec")
246
247                         subsplit = split.split()
248                         col = subsplit.column()
249                         col.itemR(rd, "exr_half")
250                         col.itemR(rd, "exr_zbuf")
251                         col = subsplit.column()
252                         col.itemR(rd, "exr_preview")
253                 
254                 elif rd.file_format == 'JPEG2000':
255                         split = layout.split()
256                         col = split.column()
257                         col.itemL(text="Depth:")
258                         col.row().itemR(rd, "jpeg_depth", expand=True)
259
260                         col = split.column()
261                         col.itemR(rd, "jpeg_preset", text="")
262                         col.itemR(rd, "jpeg_ycc")
263                         col.itemR(rd, "exr_preview")
264                         
265                 elif rd.file_format in ('CINEON', 'DPX'):
266                         split = layout.split()
267                         col = split.column()
268                         col.itemR(rd, "cineon_log", text="Convert to Log")
269
270                         col = split.column(align=True)
271                         col.active = rd.cineon_log
272                         col.itemR(rd, "cineon_black", text="Black")
273                         col.itemR(rd, "cineon_white", text="White")
274                         col.itemR(rd, "cineon_gamma", text="Gamma")
275                         
276                 elif rd.file_format == 'TIFF':
277                         split = layout.split()
278                         split.itemR(rd, "tiff_bit")
279
280 class SCENE_PT_encoding(RenderButtonsPanel):
281         __label__ = "Encoding"
282         __default_closed__ = True
283         COMPAT_ENGINES = set(['BLENDER_RENDER'])
284         
285         def poll(self, context):
286                 rd = context.scene.render_data
287                 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
288
289         def draw(self, context):
290                 layout = self.layout
291                 
292                 rd = context.scene.render_data
293
294                 split = layout.split()
295                 
296                 split.itemR(rd, "ffmpeg_format")
297                 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
298                         split.itemR(rd, "ffmpeg_codec")
299                 else:
300                         split.itemL()
301
302                 split = layout.split()
303         
304                 col = split.column()
305                 col.itemR(rd, "ffmpeg_video_bitrate")
306                 col.itemL(text="Rate:")
307                 col.itemR(rd, "ffmpeg_minrate", text="Minimum")
308                 col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
309                 col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
310                 
311                 col = split.column()
312                 col.itemR(rd, "ffmpeg_gopsize")
313                 col.itemR(rd, "ffmpeg_autosplit")
314                 col.itemL(text="Mux:")
315                 col.itemR(rd, "ffmpeg_muxrate", text="Rate")
316                 col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
317                 
318                 row = layout.row()
319                 row.itemL(text="Audio:")
320                 row = layout.row()
321                 row.itemR(rd, "ffmpeg_audio_codec")
322                 
323                 split = layout.split()
324
325                 col = split.column()
326                 col.itemR(rd, "ffmpeg_audio_bitrate")
327                 col = split.column()
328                 col.itemR(rd, "ffmpeg_multiplex_audio")
329
330 class SCENE_PT_antialiasing(RenderButtonsPanel):
331         __label__ = "Anti-Aliasing"
332         COMPAT_ENGINES = set(['BLENDER_RENDER'])
333
334         def draw_header(self, context):
335                 rd = context.scene.render_data
336
337                 self.layout.itemR(rd, "antialiasing", text="")
338
339         def draw(self, context):
340                 layout = self.layout
341                 
342                 rd = context.scene.render_data
343
344                 layout.active = rd.antialiasing
345
346                 split = layout.split()
347                 
348                 col = split.column()
349                 col.row().itemR(rd, "antialiasing_samples", expand=True)
350                 col.itemR(rd, "full_sample")
351
352                 col = split.column()
353                 col.itemR(rd, "pixel_filter", text="")
354                 col.itemR(rd, "filter_size", text="Size", slider=True)
355         
356 class SCENE_PT_dimensions(RenderButtonsPanel):
357         __label__ = "Dimensions"
358         COMPAT_ENGINES = set(['BLENDER_RENDER'])
359
360         def draw(self, context):
361                 layout = self.layout
362                 
363                 scene = context.scene
364                 rd = scene.render_data
365                 
366                 split = layout.split()
367                 
368                 col = split.column()
369                 sub = col.column(align=True)
370                 sub.itemL(text="Resolution:")
371                 sub.itemR(rd, "resolution_x", text="X")
372                 sub.itemR(rd, "resolution_y", text="Y")
373                 sub.itemR(rd, "resolution_percentage", text="")
374                 
375                 sub.itemL(text="Aspect Ratio:")
376                 sub.itemR(rd, "pixel_aspect_x", text="X")
377                 sub.itemR(rd, "pixel_aspect_y", text="Y")
378
379                 row = col.row()
380                 row.itemR(rd, "use_border", text="Border")
381                 rowsub = row.row()
382                 rowsub.active = rd.use_border
383                 rowsub.itemR(rd, "crop_to_border", text="Crop")
384                 
385                 col = split.column(align=True)
386                 col.itemL(text="Frame Range:")
387                 col.itemR(scene, "start_frame", text="Start")
388                 col.itemR(scene, "end_frame", text="End")
389                 col.itemR(scene, "frame_step", text="Step")
390                 
391                 col.itemL(text="Frame Rate:")
392                 col.itemR(rd, "fps")
393                 col.itemR(rd, "fps_base",text="/")
394
395 class SCENE_PT_stamp(RenderButtonsPanel):
396         __label__ = "Stamp"
397         __default_closed__ = True
398         COMPAT_ENGINES = set(['BLENDER_RENDER'])
399
400         def draw_header(self, context):
401                 rd = context.scene.render_data
402
403                 self.layout.itemR(rd, "render_stamp", text="")
404
405         def draw(self, context):
406                 layout = self.layout
407                 
408                 rd = context.scene.render_data
409
410                 layout.active = rd.render_stamp
411
412                 split = layout.split()
413                 
414                 col = split.column()
415                 col.itemR(rd, "stamp_time", text="Time")
416                 col.itemR(rd, "stamp_date", text="Date")
417                 col.itemR(rd, "stamp_frame", text="Frame")
418                 col.itemR(rd, "stamp_scene", text="Scene")
419                 col.itemR(rd, "stamp_camera", text="Camera")
420                 col.itemR(rd, "stamp_filename", text="Filename")
421                 col.itemR(rd, "stamp_marker", text="Marker")
422                 col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
423
424                 col = split.column()
425                 col.active = rd.render_stamp
426                 col.itemR(rd, "stamp_foreground", slider=True)
427                 col.itemR(rd, "stamp_background", slider=True)
428                 col.itemR(rd, "stamp_font_size", text="Font Size")
429
430                 row = layout.split(percentage=0.2)
431                 row.itemR(rd, "stamp_note", text="Note")
432                 sub = row.row()
433                 sub.active = rd.stamp_note
434                 sub.itemR(rd, "stamp_note_text", text="")
435
436 class SCENE_PT_unit(RenderButtonsPanel):
437         __label__ = "Units"
438         __default_closed__ = True
439         COMPAT_ENGINES = set(['BLENDER_RENDER'])
440
441         def draw(self, context):
442                 layout = self.layout
443                 
444                 unit = context.scene.unit_settings
445                 
446                 col = layout.column()
447                 col.row().itemR(unit, "system", expand=True)
448                 
449                 row = layout.row()
450                 row.active = (unit.system != 'NONE')
451                 row.itemR(unit, "scale_length", text="Scale")
452                 row.itemR(unit, "use_separate")
453
454
455 bpy.types.register(SCENE_PT_render)
456 bpy.types.register(SCENE_PT_layers)
457 bpy.types.register(SCENE_PT_dimensions)
458 bpy.types.register(SCENE_PT_antialiasing)
459 bpy.types.register(SCENE_PT_shading)
460 bpy.types.register(SCENE_PT_output)
461 bpy.types.register(SCENE_PT_encoding)
462 bpy.types.register(SCENE_PT_performance)
463 bpy.types.register(SCENE_PT_post_processing)
464 bpy.types.register(SCENE_PT_stamp)
465 bpy.types.register(SCENE_PT_unit)