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