Rework of volume shading
[blender.git] / release / scripts / 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                 mat = context.material
360                 sss = mat.subsurface_scattering
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 = mat.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 = mat.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
461                 self.layout.itemR(mat, "transparency", text="")
462
463         def draw(self, context):
464                 layout = self.layout
465                 
466                 mat = context.material
467                 rayt = mat.raytrace_transparency
468                 
469                 row = layout.row()
470                 row.active = mat.transparency and (not mat.shadeless)
471                 row.itemR(mat, "transparency_method", expand=True)
472                 
473                 split = layout.split()
474                 
475                 col = split.column()
476                 col.itemR(mat, "alpha")
477                 row = col.row()
478                 row.active = mat.transparency and (not mat.shadeless)
479                 row.itemR(mat, "specular_alpha", text="Specular")
480
481                 col = split.column()
482                 col.active = (not mat.shadeless)
483                 col.itemR(rayt, "fresnel")
484                 sub = col.column()
485                 sub.active = rayt.fresnel > 0
486                 sub.itemR(rayt, "fresnel_factor", text="Blend")
487
488                 if mat.transparency_method == 'RAYTRACE':
489                         layout.itemS()
490                         split = layout.split()
491                         split.active = mat.transparency
492
493                         col = split.column()
494                         col.itemR(rayt, "ior")
495                         col.itemR(rayt, "filter")
496                         col.itemR(rayt, "falloff")
497                         col.itemR(rayt, "limit")
498                         col.itemR(rayt, "depth")
499                         
500                         col = split.column()
501                         col.itemL(text="Gloss:")
502                         col.itemR(rayt, "gloss_factor", text="Amount")
503                         sub = col.column()
504                         sub.active = rayt.gloss_factor < 1.0
505                         sub.itemR(rayt, "gloss_threshold", text="Threshold")
506                         sub.itemR(rayt, "gloss_samples", text="Samples")
507
508 class MATERIAL_PT_halo(MaterialButtonsPanel):
509         __label__= "Halo"
510         COMPAT_ENGINES = set(['BLENDER_RENDER'])
511         
512         def poll(self, context):
513                 mat = context.material
514                 engine = context.scene.render_data.engine
515                 return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
516         
517         def draw(self, context):
518                 layout = self.layout
519                 
520                 mat = context.material
521                 halo = mat.halo
522
523                 split = layout.split()
524                 
525                 col = split.column()
526                 col.itemR(mat, "diffuse_color", text="")
527                 col.itemR(halo, "size")
528                 col.itemR(halo, "hardness")
529                 col.itemR(halo, "add")
530                 col.itemL(text="Options:")
531                 col.itemR(halo, "texture")
532                 col.itemR(halo, "vertex_normal")
533                 col.itemR(halo, "xalpha")
534                 col.itemR(halo, "shaded")
535                 col.itemR(halo, "soft")
536
537                 col = split.column()
538                 col.itemR(halo, "ring")
539                 sub = col.column()
540                 sub.active = halo.ring
541                 sub.itemR(halo, "rings")
542                 sub.itemR(mat, "mirror_color", text="")
543                 col.itemS()
544                 col.itemR(halo, "lines")
545                 sub = col.column()
546                 sub.active = halo.lines
547                 sub.itemR(halo, "line_number", text="Lines")
548                 sub.itemR(mat, "specular_color", text="")
549                 col.itemS()
550                 col.itemR(halo, "star")
551                 sub = col.column()
552                 sub.active = halo.star
553                 sub.itemR(halo, "star_tips")
554                 
555 class MATERIAL_PT_flare(MaterialButtonsPanel):
556         __label__= "Flare"
557         COMPAT_ENGINES = set(['BLENDER_RENDER'])
558         
559         def poll(self, context):
560                 mat = context.material
561                 engine = context.scene.render_data.engine
562                 return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
563         
564         def draw_header(self, context):
565                 halo = context.material.halo
566
567                 self.layout.itemR(halo, "flare_mode", text="")
568         
569         def draw(self, context):
570                 layout = self.layout
571                 
572                 mat = context.material
573                 halo = mat.halo
574
575                 layout.active = halo.flare_mode
576                 
577                 split = layout.split()
578                 
579                 col = split.column()
580                 col.itemR(halo, "flare_size", text="Size")
581                 col.itemR(halo, "flare_boost", text="Boost")
582                 col.itemR(halo, "flare_seed", text="Seed")
583                 col = split.column()
584                 col.itemR(halo, "flares_sub", text="Subflares")
585                 col.itemR(halo, "flare_subsize", text="Subsize")
586                 
587 bpy.types.register(MATERIAL_PT_context_material)
588 bpy.types.register(MATERIAL_PT_preview)
589 bpy.types.register(MATERIAL_PT_diffuse)
590 bpy.types.register(MATERIAL_PT_specular)
591 bpy.types.register(MATERIAL_PT_shading)
592 bpy.types.register(MATERIAL_PT_transp)
593 bpy.types.register(MATERIAL_PT_mirror)
594 bpy.types.register(MATERIAL_PT_sss)
595 bpy.types.register(MATERIAL_PT_halo)
596 bpy.types.register(MATERIAL_PT_flare)
597 bpy.types.register(MATERIAL_PT_physics)
598 bpy.types.register(MATERIAL_PT_strand)
599 bpy.types.register(MATERIAL_PT_options)
600 bpy.types.register(MATERIAL_PT_shadow)
601
602 # Volumetrics
603 class VolumeButtonsPanel(bpy.types.Panel):
604         __space_type__ = 'PROPERTIES'
605         __region_type__ = 'WINDOW'
606         __context__ = "material"
607
608         def poll(self, context):
609                 mat = context.material
610                 engine = context.scene.render_data.engine
611                 return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
612
613 class MATERIAL_PT_volume_density(VolumeButtonsPanel):
614         __label__ = "Density"
615         __default_closed__ = False
616         COMPAT_ENGINES = set(['BLENDER_RENDER'])
617
618         def draw(self, context):
619                 layout = self.layout
620
621                 mat = context.material
622                 vol = context.material.volume
623                 
624                 split = layout.split()
625                 row = split.row()
626                 row.itemR(vol, "density")
627                 row.itemR(vol, "density_scale")
628
629                 
630 class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
631         __label__ = "Shading"
632         __default_closed__ = False
633         COMPAT_ENGINES = set(['BLENDER_RENDER'])
634
635         def draw(self, context):
636                 layout = self.layout
637
638                 vol = context.material.volume
639                 
640                 split = layout.split()
641                 
642                 col = split.column()
643                 col.itemR(vol, "scattering")
644                 col.itemR(vol, "asymmetry")
645                 col.itemR(vol, "transmission_color")
646                 
647                 col = split.column()
648                 sub = col.column(align=True)
649                 sub.itemR(vol, "emission")
650                 sub.itemR(vol, "emission_color", text="")
651                 sub = col.column(align=True)
652                 sub.itemR(vol, "reflection")
653                 sub.itemR(vol, "reflection_color", text="")     
654
655 class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
656         __label__ = "Lighting"
657         __default_closed__ = False
658         COMPAT_ENGINES = set(['BLENDER_RENDER'])
659
660         def draw(self, context):
661                 layout = self.layout
662                 
663                 vol = context.material.volume
664                 
665                 split = layout.split()
666                 
667                 col = split.column()
668                 col.itemR(vol, "scattering_mode", text="")
669                 
670                 col = split.column()
671                 
672                 if vol.scattering_mode == 'SINGLE_SCATTERING':
673                         col.itemR(vol, "light_cache")
674                         sub = col.column()
675                         sub.active = vol.light_cache
676                         sub.itemR(vol, "cache_resolution")
677                 elif vol.scattering_mode in ('MULTIPLE_SCATTERING', 'SINGLE_PLUS_MULTIPLE_SCATTERING'):
678                         sub = col.column()
679                         sub.enabled = True
680                         sub.active = False
681                         sub.itemR(vol, "light_cache")
682                         col.itemR(vol, "cache_resolution")
683                         
684                         sub = col.column(align=True)
685                         sub.itemR(vol, "ms_diffusion")
686                         sub.itemR(vol, "ms_spread")
687                         sub.itemR(vol, "ms_intensity")
688
689
690 class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
691         __label__= "Transparency"
692         COMPAT_ENGINES = set(['BLENDER_RENDER'])
693
694         def draw(self, context):
695                 layout = self.layout
696                 
697                 mat = context.material
698                 
699                 layout.itemR(mat, "transparency_method", expand=True)
700                 
701 class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
702         __label__ = "Integration"
703         __default_closed__ = False
704         COMPAT_ENGINES = set(['BLENDER_RENDER'])
705
706         def draw(self, context):
707                 layout = self.layout
708
709                 vol = context.material.volume
710                 
711                 split = layout.split()
712                 
713                 col = split.column()
714                 col.itemL(text="Step Calculation:")
715                 col.itemR(vol, "step_calculation", text="")
716                 col = col.column(align=True)
717                 col.itemR(vol, "step_size")
718                 
719                 col = split.column()
720                 col.itemL()
721                 col.itemR(vol, "depth_cutoff")
722
723 bpy.types.register(MATERIAL_PT_volume_density)
724 bpy.types.register(MATERIAL_PT_volume_shading)
725 bpy.types.register(MATERIAL_PT_volume_lighting)
726 bpy.types.register(MATERIAL_PT_volume_transp)
727 bpy.types.register(MATERIAL_PT_volume_integration)