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