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