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