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