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