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