rna function api was overwriting useful errors with keyword errors.
[blender.git] / release / ui / buttons_material.py
1         
2 import bpy
3
4 class MaterialButtonsPanel(bpy.types.Panel):
5         __space_type__ = 'PROPERTIES'
6         __region_type__ = 'WINDOW'
7         __context__ = "material"
8         # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
9
10         def poll(self, context):
11                 mat = context.material
12                 engine = context.scene.render_data.engine
13                 return mat and (engine in self.COMPAT_ENGINES)
14
15 class MATERIAL_PT_preview(MaterialButtonsPanel):
16         __label__ = "Preview"
17         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
18
19         def draw(self, context):
20                 self.layout.template_preview(context.material)
21                 
22 class MATERIAL_PT_context_material(MaterialButtonsPanel):
23         __show_header__ = False
24         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
25
26         def poll(self, context):
27                 # An exception, dont call the parent poll func because
28                 # this manages materials for all engine types
29                 
30                 engine = context.scene.render_data.engine
31                 return (context.material or context.object) and (engine in self.COMPAT_ENGINES)
32
33         def draw(self, context):
34                 layout = self.layout
35                 
36                 mat = context.material
37                 ob = context.object
38                 slot = context.material_slot
39                 space = context.space_data
40
41                 if ob:
42                         row = layout.row()
43
44                         row.template_list(ob, "materials", ob, "active_material_index", rows=2)
45
46                         col = row.column(align=True)
47                         col.itemO("object.material_slot_add", icon='ICON_ZOOMIN', text="")
48                         col.itemO("object.material_slot_remove", icon='ICON_ZOOMOUT', text="")
49
50                         if ob.mode == 'EDIT':
51                                 row = layout.row(align=True)
52                                 row.itemO("object.material_slot_assign", text="Assign")
53                                 row.itemO("object.material_slot_select", text="Select")
54                                 row.itemO("object.material_slot_deselect", text="Deselect")
55
56                 split = layout.split(percentage=0.65)
57
58                 if ob:
59                         split.template_ID(ob, "active_material", new="material.new")
60                         row = split.row()
61                         if slot:
62                                 row.itemR(slot, "link", text="")
63                         else:
64                                 row.itemL()
65                 elif mat:
66                         split.template_ID(space, "pin_id")
67                         split.itemS()
68                 
69                 if mat:
70                         layout.itemR(mat, "type", expand=True)
71         
72 class MATERIAL_PT_shading(MaterialButtonsPanel):
73         __label__ = "Shading"
74         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
75
76         def poll(self, context):
77                 mat = context.material
78                 engine = context.scene.render_data.engine
79                 return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
80
81         def draw(self, context):
82                 layout = self.layout
83                 
84                 mat = context.material
85
86                 if mat.type in ('SURFACE', 'WIRE'):
87                         split = layout.split()
88         
89                         col = split.column()
90                         sub = col.column()
91                         sub.active = not mat.shadeless
92                         sub.itemR(mat, "emit")
93                         sub.itemR(mat, "ambient")
94                         sub = col.column()
95                         sub.itemR(mat, "translucency")
96                                 
97                         col = split.column()
98                         col.itemR(mat, "shadeless")     
99                         sub = col.column()
100                         sub.active = not mat.shadeless
101                         sub.itemR(mat, "tangent_shading")
102                         sub.itemR(mat, "cubic")
103                                 
104                 elif mat.type == 'HALO':
105                         layout.itemR(mat, "alpha")
106                         
107 class MATERIAL_PT_strand(MaterialButtonsPanel):
108         __label__ = "Strand"
109         __default_closed__ = True
110         COMPAT_ENGINES = set(['BLENDER_RENDER'])
111
112         def poll(self, context):
113                 mat = context.material
114                 engine = context.scene.render_data.engine
115                 return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
116         
117         def draw(self, context):
118                 layout = self.layout
119                 
120                 mat = context.material
121                 tan = mat.strand
122                 
123                 split = layout.split()
124                 
125                 col = split.column(align=True)
126                 col.itemL(text="Size:")
127                 col.itemR(tan, "root_size", text="Root")
128                 col.itemR(tan, "tip_size", text="Tip")
129                 col.itemR(tan, "min_size", text="Minimum")
130                 col.itemR(tan, "blender_units")
131                 sub = col.column()
132                 sub.active = (not mat.shadeless)
133                 sub.itemR(tan, "tangent_shading")
134                 col.itemR(tan, "shape")
135                 
136                 col = split.column()
137                 col.itemL(text="Shading:")
138                 col.itemR(tan, "width_fade")
139                 col.itemR(tan, "uv_layer")
140                 col.itemS()
141                 sub = col.column()
142                 sub.active = (not mat.shadeless)
143                 sub.itemR(tan, "surface_diffuse")
144                 sub = col.column()
145                 sub.active = tan.surface_diffuse
146                 sub.itemR(tan, "blend_distance", text="Distance")
147                 
148 class MATERIAL_PT_physics(MaterialButtonsPanel):
149         __label__ = "Physics"
150         COMPAT_ENGINES = set(['BLENDER_GAME'])
151         
152         def draw(self, context):
153                 layout = self.layout
154                 
155                 phys = context.material.physics
156                 
157                 split = layout.split()
158                 
159                 col = split.column()
160                 col.itemR(phys, "distance")
161                 col.itemR(phys, "friction")
162                 col.itemR(phys, "align_to_normal")
163                 
164                 col = split.column()
165                 col.itemR(phys, "force", slider=True)
166                 col.itemR(phys, "elasticity", slider=True)
167                 col.itemR(phys, "damp", slider=True)
168                 
169 class MATERIAL_PT_options(MaterialButtonsPanel):
170         __label__ = "Options"
171         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
172
173         def poll(self, context):
174                 mat = context.material
175                 engine = context.scene.render_data.engine
176                 return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
177
178         def draw(self, context):
179                 layout = self.layout
180                 
181                 mat = context.material
182                 
183                 split = layout.split()
184                 
185                 col = split.column()
186                 col.itemR(mat, "traceable")
187                 col.itemR(mat, "full_oversampling")
188                 col.itemR(mat, "sky")
189                 col.itemR(mat, "exclude_mist")
190                 col.itemR(mat, "invert_z")
191                 sub = col.column(align=True)
192                 sub.itemL(text="Light Group:")
193                 sub.itemR(mat, "light_group", text="")
194                 row = sub.row()
195                 row.active = mat.light_group
196                 row.itemR(mat, "light_group_exclusive", text="Exclusive")
197
198                 col = split.column()
199                 col.itemR(mat, "face_texture")
200                 sub = col.column()
201                 sub.active = mat.face_texture
202                 sub.itemR(mat, "face_texture_alpha")
203                 col.itemS()
204                 col.itemR(mat, "vertex_color_paint")
205                 col.itemR(mat, "vertex_color_light")
206                 col.itemR(mat, "object_color")
207
208 class MATERIAL_PT_shadow(MaterialButtonsPanel):
209         __label__ = "Shadow"
210         __default_closed__ = True
211         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
212         
213         def poll(self, context):
214                 mat = context.material
215                 engine = context.scene.render_data.engine
216                 return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
217
218         def draw(self, context):
219                 layout = self.layout
220                 
221                 mat = context.material
222                 
223                 split = layout.split()
224                 
225                 col = split.column()
226                 col.itemR(mat, "shadows", text="Receive")
227                 col.itemR(mat, "receive_transparent_shadows", text="Receive Transparent")
228                 col.itemR(mat, "only_shadow", text="Shadows Only")
229                 col.itemR(mat, "cast_shadows_only", text="Cast Only")
230                 col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha")
231                 
232                 col = split.column()
233                 col.itemR(mat, "cast_buffer_shadows")
234                 sub = col.column()
235                 sub.active = mat.cast_buffer_shadows
236                 sub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias")
237                 col.itemR(mat, "ray_shadow_bias", text="Auto Ray Bias")
238                 sub = col.column()
239                 sub.active = (not mat.ray_shadow_bias)
240                 sub.itemR(mat, "shadow_ray_bias", text="Ray Bias")
241
242 class MATERIAL_PT_diffuse(MaterialButtonsPanel):
243         __label__ = "Diffuse"
244         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
245
246         def poll(self, context):
247                 mat = context.material
248                 engine = context.scene.render_data.engine
249                 return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
250
251         def draw(self, context):
252                 layout = self.layout
253                 
254                 mat = context.material  
255                 
256                 split = layout.split()
257                 
258                 col = split.column()
259                 col.itemR(mat, "diffuse_color", text="")
260                 sub = col.column()
261                 sub.active = (not mat.shadeless)
262                 sub.itemR(mat, "diffuse_intensity", text="Intensity")
263                 
264                 col = split.column()
265                 col.active = (not mat.shadeless)
266                 col.itemR(mat, "diffuse_shader", text="")
267                 col.itemR(mat, "use_diffuse_ramp", text="Ramp")
268                 
269                 col = layout.column()
270                 col.active = (not mat.shadeless)
271                 if mat.diffuse_shader == 'OREN_NAYAR':
272                         col.itemR(mat, "roughness")
273                 elif mat.diffuse_shader == 'MINNAERT':
274                         col.itemR(mat, "darkness")
275                 elif mat.diffuse_shader == 'TOON':
276                         row = col.row()
277                         row.itemR(mat, "diffuse_toon_size", text="Size")
278                         row.itemR(mat, "diffuse_toon_smooth", text="Smooth")
279                 elif mat.diffuse_shader == 'FRESNEL':
280                         row = col.row()
281                         row.itemR(mat, "diffuse_fresnel", text="Fresnel")
282                         row.itemR(mat, "diffuse_fresnel_factor", text="Factor")
283                         
284                 if mat.use_diffuse_ramp:
285                         layout.itemS()
286                         layout.template_color_ramp(mat, "diffuse_ramp", expand=True)
287                         layout.itemS()
288                         row = layout.row()
289                         split = row.split(percentage=0.3)
290                         split.itemL(text="Input:")
291                         split.itemR(mat, "diffuse_ramp_input", text="")
292                         split = row.split(percentage=0.3)
293                         split.itemL(text="Blend:")
294                         split.itemR(mat, "diffuse_ramp_blend", text="")
295
296 class MATERIAL_PT_specular(MaterialButtonsPanel):
297         __label__ = "Specular"
298         COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
299
300         def poll(self, context):
301                 mat = context.material
302                 engine = context.scene.render_data.engine
303                 return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
304
305         def draw(self, context):
306                 layout = self.layout
307                 
308                 mat = context.material
309                 
310                 layout.active = (not mat.shadeless)
311                 
312                 split = layout.split()
313                 
314                 col = split.column()
315                 col.itemR(mat, "specular_color", text="")
316                 col.itemR(mat, "specular_intensity", text="Intensity")
317
318                 col = split.column()
319                 col.itemR(mat, "specular_shader", text="")
320                 col.itemR(mat, "use_specular_ramp", text="Ramp")
321
322                 col = layout.column()
323                 if mat.specular_shader in ('COOKTORR', 'PHONG'):
324                         col.itemR(mat, "specular_hardness", text="Hardness")
325                 elif mat.specular_shader == 'BLINN':
326                         row = col.row()
327                         row.itemR(mat, "specular_hardness", text="Hardness")
328                         row.itemR(mat, "specular_ior", text="IOR")
329                 elif mat.specular_shader == 'WARDISO':
330                         col.itemR(mat, "specular_slope", text="Slope")
331                 elif mat.specular_shader == 'TOON':
332                         row = col.row()
333                         row.itemR(mat, "specular_toon_size", text="Size")
334                         row.itemR(mat, "specular_toon_smooth", text="Smooth")
335                 
336                 if mat.use_specular_ramp:
337                         layout.itemS()
338                         layout.template_color_ramp(mat, "specular_ramp", expand=True)
339                         layout.itemS()
340                         row = layout.row()
341                         split = row.split(percentage=0.3)
342                         split.itemL(text="Input:")
343                         split.itemR(mat, "specular_ramp_input", text="")
344                         split = row.split(percentage=0.3)
345                         split.itemL(text="Blend:")
346                         split.itemR(mat, "specular_ramp_blend", text="")
347                 
348 class MATERIAL_PT_sss(MaterialButtonsPanel):
349         __label__ = "Subsurface Scattering"
350         __default_closed__ = True
351         COMPAT_ENGINES = set(['BLENDER_RENDER'])
352         
353         def poll(self, context):
354                 mat = context.material
355                 engine = context.scene.render_data.engine
356                 return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
357
358         def draw_header(self, context):
359                 sss = context.material.subsurface_scattering
360                 mat = context.material
361                 
362                 self.layout.active = (not mat.shadeless)
363                 self.layout.itemR(sss, "enabled", text="")
364         
365         def draw(self, context):
366                 layout = self.layout
367                 
368                 mat = context.material
369                 sss = context.material.subsurface_scattering
370
371                 layout.active = sss.enabled     
372                 
373                 split = layout.split()
374                 split.active = (not mat.shadeless)
375                 
376                 col = split.column()
377                 col.itemR(sss, "ior")
378                 col.itemR(sss, "scale")
379                 col.itemR(sss, "color", text="")
380                 col.itemR(sss, "radius", text="RGB Radius")
381                 
382                 col = split.column()
383                 sub = col.column(align=True)
384                 sub.itemL(text="Blend:")
385                 sub.itemR(sss, "color_factor", text="Color")
386                 sub.itemR(sss, "texture_factor", text="Texture")
387                 sub.itemL(text="Scattering Weight:")
388                 sub.itemR(sss, "front")
389                 sub.itemR(sss, "back")
390                 col.itemS()
391                 col.itemR(sss, "error_tolerance", text="Error")
392
393 class MATERIAL_PT_mirror(MaterialButtonsPanel):
394         __label__ = "Mirror"
395         __default_closed__ = True
396         COMPAT_ENGINES = set(['BLENDER_RENDER'])
397         
398         def poll(self, context):
399                 mat = context.material
400                 engine = context.scene.render_data.engine
401                 return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
402         
403         def draw_header(self, context): 
404                 raym = context.material.raytrace_mirror
405
406                 self.layout.itemR(raym, "enabled", text="")
407         
408         def draw(self, context):
409                 layout = self.layout
410                 
411                 mat = context.material
412                 raym = context.material.raytrace_mirror
413                 
414                 layout.active = raym.enabled
415                 
416                 split = layout.split()
417                 
418                 col = split.column()
419                 col.itemR(raym, "reflect_factor")
420                 col.itemR(mat, "mirror_color", text="")
421
422                 col = split.column()
423                 col.itemR(raym, "fresnel")
424                 sub = col.column()
425                 sub.active = raym.fresnel > 0
426                 sub.itemR(raym, "fresnel_factor", text="Blend")
427                 
428                 split = layout.split()
429                 
430                 col = split.column()
431                 col.itemS()
432                 col.itemR(raym, "distance", text="Max Dist")
433                 col.itemR(raym, "depth")
434                 col.itemS()
435                 sub = col.split(percentage=0.4)
436                 sub.itemL(text="Fade To:")
437                 sub.itemR(raym, "fade_to", text="")
438                 
439                 col = split.column()
440                 col.itemL(text="Gloss:")
441                 col.itemR(raym, "gloss_factor", text="Amount")
442                 sub = col.column()
443                 sub.active = raym.gloss_factor < 1.0
444                 sub.itemR(raym, "gloss_threshold", text="Threshold")
445                 sub.itemR(raym, "gloss_samples", text="Samples")
446                 sub.itemR(raym, "gloss_anisotropic", text="Anisotropic")
447
448 class MATERIAL_PT_transp(MaterialButtonsPanel):
449         __label__= "Transparency"
450         __default_closed__ = True
451         COMPAT_ENGINES = set(['BLENDER_RENDER'])
452                 
453         def poll(self, context):
454                 mat = context.material
455                 engine = context.scene.render_data.engine
456                 return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
457
458         def draw_header(self, context): 
459                 mat = context.material
460                 self.layout.itemR(mat, "transparency", text="")
461
462         def draw(self, context):
463                 layout = self.layout
464                 
465                 mat = context.material
466                 rayt = context.material.raytrace_transparency
467                 
468                 row = layout.row()
469                 row.active = mat.transparency and (not mat.shadeless)
470                 row.itemR(mat, "transparency_method", expand=True)
471                 
472                 split = layout.split()
473                 
474                 col = split.column()
475                 col.itemR(mat, "alpha")
476                 row = col.row()
477                 row.active = mat.transparency and (not mat.shadeless)
478                 row.itemR(mat, "specular_alpha", text="Specular")
479
480                 col = split.column()
481                 col.active = (not mat.shadeless)
482                 col.itemR(rayt, "fresnel")
483                 sub = col.column()
484                 sub.active = rayt.fresnel > 0
485                 sub.itemR(rayt, "fresnel_factor", text="Blend")
486
487                 if mat.transparency_method == 'RAYTRACE':
488                         layout.itemS()
489                         split = layout.split()
490                         split.active = mat.transparency
491
492                         col = split.column()
493                         col.itemR(rayt, "ior")
494                         col.itemR(rayt, "filter")
495                         col.itemR(rayt, "falloff")
496                         col.itemR(rayt, "limit")
497                         col.itemR(rayt, "depth")
498                         
499                         col = split.column()
500                         col.itemL(text="Gloss:")
501                         col.itemR(rayt, "gloss_factor", text="Amount")
502                         sub = col.column()
503                         sub.active = rayt.gloss_factor < 1.0
504                         sub.itemR(rayt, "gloss_threshold", text="Threshold")
505                         sub.itemR(rayt, "gloss_samples", text="Samples")
506
507 class MATERIAL_PT_halo(MaterialButtonsPanel):
508         __label__= "Halo"
509         COMPAT_ENGINES = set(['BLENDER_RENDER'])
510         
511         def poll(self, context):
512                 mat = context.material
513                 engine = context.scene.render_data.engine
514                 return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
515         
516         def draw(self, context):
517                 layout = self.layout
518                 
519                 mat = context.material
520                 halo = mat.halo
521
522                 split = layout.split()
523                 
524                 col = split.column()
525                 col.itemR(mat, "diffuse_color", text="")
526                 col.itemR(halo, "size")
527                 col.itemR(halo, "hardness")
528                 col.itemR(halo, "add")
529                 col.itemL(text="Options:")
530                 col.itemR(halo, "texture")
531                 col.itemR(halo, "vertex_normal")
532                 col.itemR(halo, "xalpha")
533                 col.itemR(halo, "shaded")
534                 col.itemR(halo, "soft")
535
536                 col = split.column()
537                 col.itemR(halo, "ring")
538                 sub = col.column()
539                 sub.active = halo.ring
540                 sub.itemR(halo, "rings")
541                 sub.itemR(mat, "mirror_color", text="")
542                 col.itemS()
543                 col.itemR(halo, "lines")
544                 sub = col.column()
545                 sub.active = halo.lines
546                 sub.itemR(halo, "line_number", text="Lines")
547                 sub.itemR(mat, "specular_color", text="")
548                 col.itemS()
549                 col.itemR(halo, "star")
550                 sub = col.column()
551                 sub.active = halo.star
552                 sub.itemR(halo, "star_tips")
553                 
554 class MATERIAL_PT_flare(MaterialButtonsPanel):
555         __label__= "Flare"
556         COMPAT_ENGINES = set(['BLENDER_RENDER'])
557         
558         def poll(self, context):
559                 mat = context.material
560                 engine = context.scene.render_data.engine
561                 return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
562         
563         def draw_header(self, context):
564                 layout = self.layout
565                 
566                 mat = context.material
567                 halo = mat.halo
568                 layout.itemR(halo, "flare_mode", text="")
569         
570         def draw(self, context):
571                 layout = self.layout
572                 
573                 mat = context.material
574                 halo = mat.halo
575
576                 layout.active = halo.flare_mode
577                 
578                 split = layout.split()
579                 
580                 col = split.column()
581                 col.itemR(halo, "flare_size", text="Size")
582                 col.itemR(halo, "flare_boost", text="Boost")
583                 col.itemR(halo, "flare_seed", text="Seed")
584                 col = split.column()
585                 col.itemR(halo, "flares_sub", text="Subflares")
586                 col.itemR(halo, "flare_subsize", text="Subsize")
587                 
588 bpy.types.register(MATERIAL_PT_context_material)
589 bpy.types.register(MATERIAL_PT_preview)
590 bpy.types.register(MATERIAL_PT_diffuse)
591 bpy.types.register(MATERIAL_PT_specular)
592 bpy.types.register(MATERIAL_PT_shading)
593 bpy.types.register(MATERIAL_PT_transp)
594 bpy.types.register(MATERIAL_PT_mirror)
595 bpy.types.register(MATERIAL_PT_sss)
596 bpy.types.register(MATERIAL_PT_halo)
597 bpy.types.register(MATERIAL_PT_flare)
598 bpy.types.register(MATERIAL_PT_physics)
599 bpy.types.register(MATERIAL_PT_strand)
600 bpy.types.register(MATERIAL_PT_options)
601 bpy.types.register(MATERIAL_PT_shadow)
602
603 # Volumetrics
604 class VolumeButtonsPanel(bpy.types.Panel):
605         __space_type__ = 'PROPERTIES'
606         __region_type__ = 'WINDOW'
607         __context__ = "material"
608
609         def poll(self, context):
610                 mat = context.material
611                 engine = context.scene.render_data.engine
612                 return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
613                 
614 class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
615         __label__ = "Shading"
616         __default_closed__ = False
617         COMPAT_ENGINES = set(['BLENDER_RENDER'])
618
619         def draw(self, context):
620                 layout = self.layout
621
622                 mat = context.material
623                 vol = context.material.volume
624                 
625                 row = layout.row()
626                 row.itemR(vol, "density")
627                 row.itemR(vol, "scattering")
628
629                 split = layout.split()
630                 
631                 col = split.column()
632                 col.itemR(vol, "absorption")
633                 col.itemR(vol, "absorption_color", text="")
634
635                 col = split.column()
636                 col.itemR(vol, "emission")
637                 col.itemR(vol, "emission_color", text="")
638
639 class MATERIAL_PT_volume_scattering(VolumeButtonsPanel):
640         __label__ = "Scattering"
641         __default_closed__ = False
642         COMPAT_ENGINES = set(['BLENDER_RENDER'])
643
644         def draw(self, context):
645                 layout = self.layout
646                 
647                 vol = context.material.volume
648                 
649                 split = layout.split()
650                 
651                 col = split.column()
652                 col.itemR(vol, "scattering_mode", text="")
653                 if vol.scattering_mode == 'SINGLE_SCATTERING':
654                         col.itemR(vol, "light_cache")
655                         sub = col.column()
656                         sub.active = vol.light_cache
657                         sub.itemR(vol, "cache_resolution")
658                 elif vol.scattering_mode in ('MULTIPLE_SCATTERING', 'SINGLE_PLUS_MULTIPLE_SCATTERING'):
659                         col.itemR(vol, "cache_resolution")
660                         
661                         col = col.column(align=True)
662                         col.itemR(vol, "ms_diffusion")
663                         col.itemR(vol, "ms_spread")
664                         col.itemR(vol, "ms_intensity")
665                 
666                 col = split.column()
667                 # col.itemL(text="Anisotropic Scattering:")
668                 col.itemR(vol, "phase_function", text="")
669                 if vol.phase_function in ('SCHLICK', 'HENYEY-GREENSTEIN'):
670                         col.itemR(vol, "asymmetry")
671
672 class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
673         __label__= "Transparency"
674         COMPAT_ENGINES = set(['BLENDER_RENDER'])
675
676         def draw(self, context):
677                 layout = self.layout
678                 
679                 mat = context.material
680                 rayt = context.material.raytrace_transparency
681                 
682                 row= layout.row()
683                 row.itemR(mat, "transparency_method", expand=True)
684                 row.active = mat.transparency and (not mat.shadeless)
685                 
686 class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
687         __label__ = "Integration"
688         __default_closed__ = False
689         COMPAT_ENGINES = set(['BLENDER_RENDER'])
690
691         def draw(self, context):
692                 layout = self.layout
693                 
694                 mat = context.material
695                 vol = context.material.volume
696                 
697                 split = layout.split()
698                 
699                 col = split.column()
700                 col.itemL(text="Step Calculation:")
701                 col.itemR(vol, "step_calculation", text="")
702                 col = col.column(align=True)
703                 col.itemR(vol, "step_size")
704                 col.itemR(vol, "shading_step_size")
705                 
706                 col = split.column()
707                 col.itemL()
708                 col.itemR(vol, "depth_cutoff")
709                 col.itemR(vol, "density_scale")
710
711 bpy.types.register(MATERIAL_PT_volume_shading)
712 bpy.types.register(MATERIAL_PT_volume_scattering)
713 bpy.types.register(MATERIAL_PT_volume_transp)
714 bpy.types.register(MATERIAL_PT_volume_integration)