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