4 class MaterialButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "material"
9 def poll(self, context):
10 return (context.material != None)
12 class MATERIAL_PT_preview(MaterialButtonsPanel):
13 __idname__= "MATERIAL_PT_preview"
16 def poll(self, context):
17 return (context.material or context.material_slot)
19 def draw(self, context):
21 mat = context.material
23 layout.template_preview(mat)
25 class MATERIAL_PT_context(MaterialButtonsPanel):
26 __idname__= "MATERIAL_PT_context"
29 def poll(self, context):
30 return (context.material or context.material_slot)
32 def draw(self, context):
35 mat = context.material
37 slot = context.material_slot
38 space = context.space_data
42 row.template_list(ob, "materials", ob, "active_material_index")
44 col = row.column(align=True)
45 col.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
46 col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
48 split = layout.split(percentage=0.65)
51 split.template_ID(slot, "material", new="MATERIAL_OT_new")
52 #split.itemR(ob, "active_material_index", text="Active")
54 split.template_ID(space, "pin_id")
58 class MATERIAL_PT_material(MaterialButtonsPanel):
59 __idname__= "MATERIAL_PT_material"
60 __label__ = "Material"
62 def poll(self, context):
63 return (context.material or context.material_slot)
65 def draw(self, context):
68 mat = context.material
70 slot = context.material_slot
71 space = context.space_data
74 layout.itemR(mat, "type", expand=True)
76 layout.itemR(mat, "alpha", slider=True)
79 row.active = mat.type in ('SURFACE', 'VOLUME')
80 row.itemR(mat, "shadeless")
81 row.itemR(mat, "wireframe")
83 rowsub.active = mat.shadeless== False
84 rowsub.itemR(mat, "tangent_shading")
86 class MATERIAL_PT_strand(MaterialButtonsPanel):
87 __idname__= "MATERIAL_PT_strand"
89 __default_closed__ = True
91 def draw(self, context):
93 tan = context.material.strand
94 mat = context.material
96 split = layout.split()
99 sub.itemL(text="Size:")
100 sub.itemR(tan, "start_size", text="Root")
101 sub.itemR(tan, "end_size", text="Tip")
102 sub.itemR(tan, "min_size", text="Minimum")
103 sub.itemR(tan, "blender_units")
104 colsub = sub.column()
105 colsub.active = mat.shadeless== False
106 colsub.itemR(tan, "tangent_shading")
109 sub.itemR(tan, "shape")
110 sub.itemR(tan, "width_fade")
111 sub.itemR(tan, "uv_layer")
112 colsub = sub.column()
113 colsub.active = mat.shadeless== False
114 colsub.itemR(tan, "surface_diffuse")
115 colsubsub = colsub.column()
116 colsubsub.active = tan.surface_diffuse
117 colsubsub.itemR(tan, "blend_distance", text="Distance")
119 class MATERIAL_PT_options(MaterialButtonsPanel):
120 __idname__= "MATERIAL_PT_options"
121 __label__ = "Options"
123 def draw(self, context):
125 mat = context.material
127 split = layout.split()
130 sub.itemR(mat, "traceable")
131 sub.itemR(mat, "full_oversampling")
132 sub.itemR(mat, "sky")
133 sub.itemR(mat, "exclude_mist")
134 sub.itemR(mat, "face_texture")
135 colsub = sub.column()
136 colsub.active = mat.face_texture
137 colsub.itemR(mat, "face_texture_alpha")
138 sub.itemR(mat, "invert_z")
139 sub.itemR(mat, "light_group")
140 sub.itemR(mat, "light_group_exclusive")
143 sub.itemL(text="Shadows:")
144 sub.itemR(mat, "shadows", text="Recieve")
145 sub.itemR(mat, "transparent_shadows", text="Recieve Transparent")
146 sub.itemR(mat, "only_shadow", text="Shadows Only")
147 sub.itemR(mat, "cast_shadows_only", text="Cast Only")
148 sub.itemR(mat, "shadow_casting_alpha", text="Casting Alpha", slider=True)
150 sub.itemR(mat, "ray_shadow_bias")
151 colsub = sub.column()
152 colsub.active = mat.ray_shadow_bias
153 colsub.itemR(mat, "shadow_ray_bias", text="Raytracing Bias")
154 sub.itemR(mat, "cast_buffer_shadows")
155 colsub = sub.column()
156 colsub.active = mat.cast_buffer_shadows
157 colsub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias")
159 class MATERIAL_PT_diffuse(MaterialButtonsPanel):
160 __idname__= "MATERIAL_PT_diffuse"
161 __label__ = "Diffuse"
163 def poll(self, context):
164 mat = context.material
165 return (mat and mat.type != "HALO")
167 def draw(self, context):
169 mat = context.material
171 split = layout.split()
174 sub.itemR(mat, "diffuse_color", text="")
175 sub.itemR(mat, "object_color")
176 colsub = sub.column()
177 colsub.active = mat.shadeless== False
178 colsub.itemR(mat, "ambient", slider=True)
179 colsub.itemR(mat, "emit")
180 sub.itemR(mat, "translucency", slider=True)
183 sub.active = mat.shadeless== False
184 sub.itemR(mat, "diffuse_reflection", text="Intensity", slider=True)
185 sub.itemR(mat, "vertex_color_light")
186 sub.itemR(mat, "vertex_color_paint")
187 sub.itemR(mat, "cubic")
190 row.active = mat.shadeless== False
191 row.itemR(mat, "diffuse_shader", text="Shader")
193 split = layout.split()
194 split.active = mat.shadeless== False
196 if mat.diffuse_shader == 'OREN_NAYAR':
197 sub.itemR(mat, "roughness")
199 if mat.diffuse_shader == 'MINNAERT':
200 sub.itemR(mat, "darkness")
202 if mat.diffuse_shader == 'TOON':
203 sub.itemR(mat, "diffuse_toon_size", text="Size")
205 sub.itemR(mat, "diffuse_toon_smooth", text="Smooth")
206 if mat.diffuse_shader == 'FRESNEL':
207 sub.itemR(mat, "diffuse_fresnel", text="Fresnel")
209 sub.itemR(mat, "diffuse_fresnel_factor", text="Factor")
211 layout.itemR(mat, "diffuse_ramp", text="Ramp")
213 class MATERIAL_PT_specular(MaterialButtonsPanel):
214 __idname__= "MATERIAL_PT_specular"
215 __label__ = "Specular"
217 def poll(self, context):
218 mat = context.material
219 return (mat and mat.type != "HALO")
221 def draw(self, context):
223 mat = context.material
225 layout.active = mat.shadeless== False
227 split = layout.split()
230 sub.itemR(mat, "specular_color", text="")
232 sub.itemR(mat, "specular_reflection", text="Intensity", slider=True)
234 layout.itemR(mat, "spec_shader", text="Shader")
236 split = layout.split()
239 if mat.spec_shader in ('COOKTORR', 'PHONG'):
240 sub.itemR(mat, "specular_hardness", text="Hardness")
242 if mat.spec_shader == 'BLINN':
243 sub.itemR(mat, "specular_hardness", text="Hardness")
245 sub.itemR(mat, "specular_ior", text="IOR")
246 if mat.spec_shader == 'WARDISO':
247 sub.itemR(mat, "specular_slope", text="Slope")
248 sub.itemR(mat, "specular_hardness", text="Hardness")
249 if mat.spec_shader == 'TOON':
250 sub.itemR(mat, "specular_toon_size", text="Size")
252 sub.itemR(mat, "specular_toon_smooth", text="Smooth")
254 layout.itemR(mat, "specular_ramp", text="Ramp")
256 class MATERIAL_PT_sss(MaterialButtonsPanel):
257 __idname__= "MATERIAL_PT_sss"
258 __label__ = "Subsurface Scattering"
259 __default_closed__ = True
261 def poll(self, context):
262 mat = context.material
263 return (mat and mat.type == "SURFACE")
265 def draw_header(self, context):
267 sss = context.material.subsurface_scattering
269 layout.itemR(sss, "enabled", text="")
271 def draw(self, context):
273 sss = context.material.subsurface_scattering
274 mat = context.material
275 layout.active = sss.enabled
277 split = layout.split()
278 split.active = mat.shadeless== False
281 sub.itemR(sss, "color", text="")
282 sub.itemL(text="Blend:")
283 sub.itemR(sss, "color_factor", slider=True)
284 sub.itemR(sss, "texture_factor", slider=True)
285 sub.itemL(text="Scattering Weight:")
286 sub.itemR(sss, "front")
287 sub.itemR(sss, "back")
290 sub.itemR(sss, "ior")
291 sub.itemR(sss, "scale")
292 sub.itemR(sss, "radius", text="RGB Radius")
293 sub.itemR(sss, "error_tolerance")
295 class MATERIAL_PT_raymir(MaterialButtonsPanel):
296 __idname__= "MATERIAL_PT_raymir"
297 __label__ = "Ray Mirror"
298 __default_closed__ = True
300 def poll(self, context):
301 mat = context.material
302 return (mat and mat.type == "SURFACE")
304 def draw_header(self, context):
306 raym = context.material.raytrace_mirror
308 layout.itemR(raym, "enabled", text="")
310 def draw(self, context):
312 raym = context.material.raytrace_mirror
313 mat = context.material
315 layout.active = raym.enabled
317 split = layout.split()
320 sub.itemR(raym, "reflect", text="Reflectivity", slider=True)
321 sub.itemR(mat, "mirror_color", text="")
322 sub.itemR(raym, "fresnel")
323 sub.itemR(raym, "fresnel_fac", text="Fac", slider=True)
326 sub.itemR(raym, "gloss", slider=True)
327 colsub = sub.column()
328 colsub.active = raym.gloss < 1
329 colsub.itemR(raym, "gloss_threshold", slider=True, text="Threshold")
330 colsub.itemR(raym, "gloss_samples", text="Samples")
331 colsub.itemR(raym, "gloss_anisotropic", slider=True, text="Anisotropic")
334 row.itemR(raym, "distance", text="Max Dist")
335 row.itemR(raym, "depth")
337 layout.itemR(raym, "fade_to")
339 class MATERIAL_PT_raytransp(MaterialButtonsPanel):
340 __idname__= "MATERIAL_PT_raytransp"
341 __label__= "Ray Transparency"
342 __default_closed__ = True
344 def poll(self, context):
345 mat = context.material
346 return (mat and mat.type == "SURFACE")
348 def draw_header(self, context):
350 rayt = context.material.raytrace_transparency
352 layout.itemR(rayt, "enabled", text="")
354 def draw(self, context):
356 rayt = context.material.raytrace_transparency
357 mat = context.material
359 layout.active = rayt.enabled
361 split = layout.split()
362 split.active = mat.shadeless== False
365 sub.itemR(rayt, "ior")
366 sub.itemR(rayt, "fresnel")
367 sub.itemR(rayt, "fresnel_fac", text="Fac", slider=True)
370 sub.itemR(rayt, "gloss", slider=True)
371 colsub = sub.column()
372 colsub.active = rayt.gloss < 1
373 colsub.itemR(rayt, "gloss_threshold", slider=True, text="Threshold")
374 colsub.itemR(rayt, "gloss_samples", text="Samples")
376 flow = layout.column_flow()
377 flow.active = mat.shadeless== False
378 flow.itemR(rayt, "filter", slider=True)
379 flow.itemR(rayt, "limit")
380 flow.itemR(rayt, "falloff")
381 flow.itemR(rayt, "specular_opacity", slider=True, text="Spec Opacity")
382 flow.itemR(rayt, "depth")
384 class MATERIAL_PT_halo(MaterialButtonsPanel):
385 __idname__= "MATERIAL_PT_halo"
388 def poll(self, context):
389 mat = context.material
390 return (mat and mat.type == "HALO")
392 def draw(self, context):
395 mat = context.material
398 split = layout.split()
401 col.itemR(mat, "diffuse_color", text="")
402 col.itemR(halo, "size")
403 col.itemR(halo, "hardness")
404 col.itemR(halo, "add", slider=True)
406 col.itemL(text="Options:")
407 col.itemR(halo, "use_texture", text="Texture")
408 col.itemR(halo, "use_vertex_normal", text="Vertex Normal")
409 col.itemR(halo, "xalpha")
410 col.itemR(halo, "shaded")
411 col.itemR(halo, "soft")
415 col.itemR(halo, "ring")
416 colsub = col.column()
417 colsub.active = halo.ring
418 colsub.itemR(halo, "rings")
419 colsub.itemR(mat, "mirror_color", text="")
420 col.itemR(halo, "lines")
421 colsub = col.column()
422 colsub.active = halo.lines
423 colsub.itemR(halo, "line_number", text="Lines")
424 colsub.itemR(mat, "specular_color", text="")
425 col.itemR(halo, "star")
426 colsub = col.column()
427 colsub.active = halo.star
428 colsub.itemR(halo, "star_tips")
429 col.itemR(halo, "flare_mode")
430 colsub = col.column()
431 colsub.active = halo.flare_mode
432 colsub.itemR(halo, "flare_size", text="Size")
433 colsub.itemR(halo, "flare_subsize", text="Subsize")
434 colsub.itemR(halo, "flare_boost", text="Boost")
435 colsub.itemR(halo, "flare_seed", text="Seed")
436 colsub.itemR(halo, "flares_sub", text="Sub")
439 bpy.types.register(MATERIAL_PT_context)
440 bpy.types.register(MATERIAL_PT_preview)
441 bpy.types.register(MATERIAL_PT_material)
442 bpy.types.register(MATERIAL_PT_diffuse)
443 bpy.types.register(MATERIAL_PT_specular)
444 bpy.types.register(MATERIAL_PT_raymir)
445 bpy.types.register(MATERIAL_PT_raytransp)
446 bpy.types.register(MATERIAL_PT_sss)
447 bpy.types.register(MATERIAL_PT_halo)
448 bpy.types.register(MATERIAL_PT_strand)
449 bpy.types.register(MATERIAL_PT_options)