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