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