4 class MaterialButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "material"
9 def poll(self, context):
10 ob = context.active_object
11 return (ob and ob.active_material)
13 class MATERIAL_PT_material(MaterialButtonsPanel):
14 __idname__= "MATERIAL_PT_material"
15 __label__ = "Material"
17 def draw(self, context):
19 mat = context.active_object.active_material
22 row.itemR(mat, "type", expand=True)
25 row.column().itemR(mat, "diffuse_color")
26 row.column().itemR(mat, "specular_color")
27 row.column().itemR(mat, "mirror_color")
30 row.itemR(mat, "alpha", slider=True)
32 class MATERIAL_PT_sss(MaterialButtonsPanel):
33 __idname__= "MATERIAL_PT_sss"
34 __label__ = "Subsurface Scattering"
36 def poll(self, context):
37 ob = context.active_object
38 return (ob and ob.active_material and ob.active_material.type == "SURFACE")
40 def draw_header(self, context):
41 sss = context.active_object.active_material.subsurface_scattering
44 layout.itemR(sss, "enabled", text="")
46 def draw(self, context):
48 sss = context.active_object.active_material.subsurface_scattering
50 flow = layout.column_flow()
51 flow.itemR(sss, "error_tolerance")
52 flow.itemR(sss, "ior")
53 flow.itemR(sss, "scale")
56 row.column().itemR(sss, "color")
57 row.column().itemR(sss, "radius")
59 flow = layout.column_flow()
60 flow.itemR(sss, "color_factor", slider=True)
61 flow.itemR(sss, "texture_factor", slider=True)
62 flow.itemR(sss, "front")
63 flow.itemR(sss, "back")
65 class MATERIAL_PT_raymir(MaterialButtonsPanel):
66 __idname__= "MATERIAL_PT_raymir"
67 __label__ = "Ray Mirror"
69 def poll(self, context):
70 ob = context.active_object
71 return (ob and ob.active_material and ob.active_material.type == "SURFACE")
73 def draw_header(self, context):
74 raym = context.active_object.active_material.raytrace_mirror
77 layout.itemR(raym, "enabled", text="")
79 def draw(self, context):
81 raym = context.active_object.active_material.raytrace_mirror
83 split = layout.split()
86 sub.itemR(raym, "reflect", text="RayMir", slider=True)
87 sub.itemR(raym, "fresnel")
88 sub.itemR(raym, "fresnel_fac", text="Fac", slider=True)
91 sub.itemR(raym, "gloss", slider=True)
92 sub.itemR(raym, "gloss_threshold", slider=True)
93 sub.itemR(raym, "gloss_samples")
94 sub.itemR(raym, "gloss_anisotropic", slider=True)
96 flow = layout.column_flow()
97 flow.itemR(raym, "distance", text="Max Dist")
98 flow.itemR(raym, "depth")
99 flow.itemR(raym, "fade_to")
101 class MATERIAL_PT_raytransp(MaterialButtonsPanel):
102 __idname__= "MATERIAL_PT_raytransp"
103 __label__= "Ray Transparency"
105 def poll(self, context):
106 ob = context.active_object
107 return (ob and ob.active_material and ob.active_material.type == "SURFACE")
109 def draw_header(self, context):
110 rayt = context.active_object.active_material.raytrace_transparency
113 layout.itemR(rayt, "enabled", text="")
115 def draw(self, context):
117 rayt = context.active_object.active_material.raytrace_transparency
119 split = layout.split()
122 sub.itemR(rayt, "ior")
123 sub.itemR(rayt, "fresnel")
124 sub.itemR(rayt, "fresnel_fac", text="Fac", slider=True)
127 sub.itemR(rayt, "gloss", slider=True)
128 sub.itemR(rayt, "gloss_threshold", slider=True)
129 sub.itemR(rayt, "gloss_samples")
131 flow = layout.column_flow()
132 flow.itemR(rayt, "filter", slider=True)
133 flow.itemR(rayt, "limit")
134 flow.itemR(rayt, "falloff")
135 flow.itemR(rayt, "specular_opacity", slider=True)
136 flow.itemR(rayt, "depth")
138 class MATERIAL_PT_halo(MaterialButtonsPanel):
139 __idname__= "MATERIAL_PT_halo"
142 def poll(self, context):
143 ob = context.active_object
144 return (ob and ob.active_material and ob.active_material.type == "HALO")
146 def draw(self, context):
148 mat = context.active_object.active_material
151 split = layout.split()
154 sub.itemL(text="General Settings:")
155 sub.itemR(halo, "size")
156 sub.itemR(halo, "hardness")
157 sub.itemR(halo, "add", slider=True)
160 sub.itemL(text="Elements:")
161 sub.itemR(halo, "ring")
162 sub.itemR(halo, "lines")
163 sub.itemR(halo, "star")
164 sub.itemR(halo, "flare_mode")
169 sub.itemL(text="Options:")
170 sub.itemR(halo, "use_texture", text="Texture")
171 sub.itemR(halo, "use_vertex_normal", text="Vertex Normal")
172 sub.itemR(halo, "xalpha")
173 sub.itemR(halo, "shaded")
174 sub.itemR(halo, "soft")
178 sub.itemR(halo, "rings")
180 sub.itemR(halo, "line_number")
181 if (halo.ring or halo.lines):
182 sub.itemR(halo, "seed")
184 sub.itemR(halo, "star_tips")
185 if (halo.flare_mode):
186 sub.itemL(text="Flare:")
187 sub.itemR(halo, "flare_size", text="Size")
188 sub.itemR(halo, "flare_subsize", text="Subsize")
189 sub.itemR(halo, "flare_boost", text="Boost")
190 sub.itemR(halo, "flare_seed", text="Seed")
191 sub.itemR(halo, "flares_sub", text="Sub")
193 bpy.types.register(MATERIAL_PT_material)
194 bpy.types.register(MATERIAL_PT_raymir)
195 bpy.types.register(MATERIAL_PT_raytransp)
196 bpy.types.register(MATERIAL_PT_sss)
197 bpy.types.register(MATERIAL_PT_halo)