LEFT | RIGHT |
1 # ##### BEGIN GPL LICENSE BLOCK ##### | 1 # ##### BEGIN GPL LICENSE BLOCK ##### |
2 # | 2 # |
3 # This program is free software; you can redistribute it and/or | 3 # This program is free software; you can redistribute it and/or |
4 # modify it under the terms of the GNU General Public License | 4 # modify it under the terms of the GNU General Public License |
5 # as published by the Free Software Foundation; either version 2 | 5 # as published by the Free Software Foundation; either version 2 |
6 # of the License, or (at your option) any later version. | 6 # of the License, or (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program; if not, write to the Free Software Foundation, | 14 # along with this program; if not, write to the Free Software Foundation, |
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 # | 16 # |
17 # ##### END GPL LICENSE BLOCK ##### | 17 # ##### END GPL LICENSE BLOCK ##### |
18 | 18 |
19 # <pep8 compliant> | 19 # <pep8 compliant> |
20 import bpy | 20 import bpy |
| 21 from bpy.types import Menu, Panel, UIList |
21 from rna_prop_ui import PropertyPanel | 22 from rna_prop_ui import PropertyPanel |
| 23 from bpy.app.translations import pgettext_iface as iface_ |
22 | 24 |
23 | 25 |
24 def active_node_mat(mat): | 26 def active_node_mat(mat): |
25 # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate | 27 # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate |
26 # which settings from node-materials are used | 28 # which settings from node-materials are used |
27 if mat is not None: | 29 if mat is not None: |
28 mat_node = mat.active_node_material | 30 mat_node = mat.active_node_material |
29 if mat_node: | 31 if mat_node: |
30 return mat_node | 32 return mat_node |
31 else: | 33 else: |
(...skipping 11 matching lines...) Expand all Loading... |
43 return True | 45 return True |
44 return False | 46 return False |
45 | 47 |
46 | 48 |
47 def simple_material(mat): | 49 def simple_material(mat): |
48 if (mat is not None) and (not mat.use_nodes): | 50 if (mat is not None) and (not mat.use_nodes): |
49 return True | 51 return True |
50 return False | 52 return False |
51 | 53 |
52 | 54 |
53 class MATERIAL_MT_sss_presets(bpy.types.Menu): | 55 class MATERIAL_MT_sss_presets(Menu): |
54 bl_label = "SSS Presets" | 56 bl_label = "SSS Presets" |
55 preset_subdir = "sss" | 57 preset_subdir = "sss" |
56 preset_operator = "script.execute_preset" | 58 preset_operator = "script.execute_preset" |
57 draw = bpy.types.Menu.draw_preset | 59 draw = Menu.draw_preset |
58 | 60 |
59 | 61 |
60 class MATERIAL_MT_specials(bpy.types.Menu): | 62 class MATERIAL_MT_specials(Menu): |
61 bl_label = "Material Specials" | 63 bl_label = "Material Specials" |
62 | 64 |
63 def draw(self, context): | 65 def draw(self, context): |
64 layout = self.layout | 66 layout = self.layout |
65 | 67 |
66 layout.operator("object.material_slot_copy", icon='COPY_ID') | 68 layout.operator("object.material_slot_copy", icon='COPY_ID') |
67 layout.operator("material.copy", icon='COPYDOWN') | 69 layout.operator("material.copy", icon='COPYDOWN') |
68 layout.operator("material.paste", icon='PASTEDOWN') | 70 layout.operator("material.paste", icon='PASTEDOWN') |
| 71 |
| 72 |
| 73 class MATERIAL_UL_matslots(UIList): |
| 74 def draw_item(self, context, layout, data, item, icon, active_data, active_p
ropname, index): |
| 75 # assert(isinstance(item, bpy.types.MaterialSlot) |
| 76 ob = data |
| 77 slot = item |
| 78 ma = slot.material |
| 79 if self.layout_type in {'DEFAULT', 'COMPACT'}: |
| 80 layout.label(text=ma.name if ma else "", translate=False, icon_value
=icon) |
| 81 if ma and not context.scene.render.use_shading_nodes: |
| 82 manode = ma.active_node_material |
| 83 if manode: |
| 84 layout.label(text=iface_("Node %s") % manode.name, translate
=False, icon_value=layout.icon(manode)) |
| 85 elif ma.use_nodes: |
| 86 layout.label(text="Node <none>") |
| 87 elif self.layout_type in {'GRID'}: |
| 88 layout.alignment = 'CENTER' |
| 89 layout.label(text="", icon_value=icon) |
69 | 90 |
70 | 91 |
71 class MaterialButtonsPanel(): | 92 class MaterialButtonsPanel(): |
72 bl_space_type = 'PROPERTIES' | 93 bl_space_type = 'PROPERTIES' |
73 bl_region_type = 'WINDOW' | 94 bl_region_type = 'WINDOW' |
74 bl_context = "material" | 95 bl_context = "material" |
75 # COMPAT_ENGINES must be defined in each subclass, external engines can add
themselves here | 96 # COMPAT_ENGINES must be defined in each subclass, external engines can add
themselves here |
76 | 97 |
77 @classmethod | 98 @classmethod |
78 def poll(cls, context): | 99 def poll(cls, context): |
79 return context.material and (context.scene.render.engine in cls.COMPAT_E
NGINES) | 100 return context.material and (context.scene.render.engine in cls.COMPAT_E
NGINES) |
80 | 101 |
81 | 102 |
82 class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel): | 103 class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): |
83 bl_label = "" | 104 bl_label = "" |
84 bl_options = {'HIDE_HEADER'} | 105 bl_options = {'HIDE_HEADER'} |
85 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | 106 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} |
86 | 107 |
87 @classmethod | 108 @classmethod |
88 def poll(cls, context): | 109 def poll(cls, context): |
89 # An exception, dont call the parent poll func because | 110 # An exception, don't call the parent poll func because |
90 # this manages materials for all engine types | 111 # this manages materials for all engine types |
91 | 112 |
92 engine = context.scene.render.engine | 113 engine = context.scene.render.engine |
93 return (context.material or context.object) and (engine in cls.COMPAT_EN
GINES) | 114 return (context.material or context.object) and (engine in cls.COMPAT_EN
GINES) |
94 | 115 |
95 def draw(self, context): | 116 def draw(self, context): |
96 layout = self.layout | 117 layout = self.layout |
97 | 118 |
98 mat = context.material | 119 mat = context.material |
99 ob = context.object | 120 ob = context.object |
100 slot = context.material_slot | 121 slot = context.material_slot |
101 space = context.space_data | 122 space = context.space_data |
102 | 123 |
103 if ob: | 124 if ob: |
104 row = layout.row() | 125 row = layout.row() |
105 | 126 |
106 row.template_list(ob, "material_slots", ob, "active_material_index",
rows=2) | 127 row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots",
ob, "active_material_index", rows=1) |
107 | 128 |
108 col = row.column(align=True) | 129 col = row.column(align=True) |
109 col.operator("object.material_slot_add", icon='ZOOMIN', text="") | 130 col.operator("object.material_slot_add", icon='ZOOMIN', text="") |
110 col.operator("object.material_slot_remove", icon='ZOOMOUT', text="") | 131 col.operator("object.material_slot_remove", icon='ZOOMOUT', text="") |
111 | 132 |
112 col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="") | 133 col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="") |
113 | 134 |
114 if ob.mode == 'EDIT': | 135 if ob.mode == 'EDIT': |
115 row = layout.row(align=True) | 136 row = layout.row(align=True) |
116 row.operator("object.material_slot_assign", text="Assign") | 137 row.operator("object.material_slot_assign", text="Assign") |
117 row.operator("object.material_slot_select", text="Select") | 138 row.operator("object.material_slot_select", text="Select") |
118 row.operator("object.material_slot_deselect", text="Deselect") | 139 row.operator("object.material_slot_deselect", text="Deselect") |
119 | 140 |
120 split = layout.split(percentage=0.65) | 141 split = layout.split(percentage=0.65) |
121 | 142 |
122 if ob: | 143 if ob: |
123 split.template_ID(ob, "active_material", new="material.new") | 144 split.template_ID(ob, "active_material", new="material.new") |
124 row = split.row() | 145 row = split.row() |
125 if mat: | 146 if mat: |
126 row.prop(mat, "use_nodes", icon="NODETREE", text="") | 147 row.prop(mat, "use_nodes", icon='NODETREE', text="") |
127 | 148 |
128 if slot: | 149 if slot: |
129 row.prop(slot, "link", text="") | 150 row.prop(slot, "link", text="") |
130 else: | 151 else: |
131 row.label() | 152 row.label() |
132 elif mat: | 153 elif mat: |
133 split.template_ID(space, "pin_id") | 154 split.template_ID(space, "pin_id") |
134 split.separator() | 155 split.separator() |
135 | 156 |
136 if mat: | 157 if mat: |
137 layout.prop(mat, "type", expand=True) | 158 layout.prop(mat, "type", expand=True) |
138 if mat.use_nodes: | 159 if mat.use_nodes: |
139 row = layout.row() | 160 row = layout.row() |
140 row.label(text="", icon='NODETREE') | 161 row.label(text="", icon='NODETREE') |
141 if mat.active_node_material: | 162 if mat.active_node_material: |
142 row.prop(mat.active_node_material, "name", text="") | 163 row.prop(mat.active_node_material, "name", text="") |
143 else: | 164 else: |
144 row.label(text="No material node selected") | 165 row.label(text="No material node selected") |
145 | 166 |
146 | 167 |
147 class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel): | 168 class MATERIAL_PT_preview(MaterialButtonsPanel, Panel): |
148 bl_label = "Preview" | 169 bl_label = "Preview" |
149 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | 170 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} |
150 | 171 |
151 def draw(self, context): | 172 def draw(self, context): |
152 self.layout.template_preview(context.material) | 173 self.layout.template_preview(context.material) |
153 | 174 |
154 | 175 |
155 class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel): | 176 class MATERIAL_PT_pipeline(MaterialButtonsPanel, Panel): |
156 bl_label = "Render Pipeline Options" | 177 bl_label = "Render Pipeline Options" |
157 bl_options = {'DEFAULT_CLOSED'} | 178 bl_options = {'DEFAULT_CLOSED'} |
158 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | 179 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} |
159 | 180 |
160 @classmethod | 181 @classmethod |
161 def poll(cls, context): | 182 def poll(cls, context): |
162 mat = context.material | 183 mat = context.material |
163 engine = context.scene.render.engine | 184 engine = context.scene.render.engine |
164 return mat and (not simple_material(mat)) and (mat.type in {'SURFACE', '
WIRE', 'VOLUME'}) and (engine in cls.COMPAT_ENGINES) | 185 return mat and (not simple_material(mat)) and (mat.type in {'SURFACE', '
WIRE', 'VOLUME'}) and (engine in cls.COMPAT_ENGINES) |
165 | 186 |
166 def draw(self, context): | 187 def draw(self, context): |
167 layout = self. layout | 188 layout = self. layout |
168 | 189 |
169 mat = context.material | 190 mat = context.material |
170 mat_type = mat.type in {'SURFACE', 'WIRE'} | 191 mat_type = mat.type in {'SURFACE', 'WIRE'} |
171 | 192 |
172 row = layout.row() | 193 row = layout.row() |
173 row.active = mat_type | 194 row.active = mat_type |
174 row.prop(mat, "use_transparency") | 195 row.prop(mat, "use_transparency") |
175 sub = row.column() | 196 sub = row.column() |
176 sub.prop(mat, "offset_z") | 197 sub.prop(mat, "offset_z") |
| 198 |
177 sub.active = mat_type and mat.use_transparency and mat.transparency_meth
od == 'Z_TRANSPARENCY' | 199 sub.active = mat_type and mat.use_transparency and mat.transparency_meth
od == 'Z_TRANSPARENCY' |
178 | 200 |
179 row = layout.row() | 201 row = layout.row() |
180 row.active = mat.use_transparency or not mat_type | 202 row.active = mat.use_transparency or not mat_type |
181 row.prop(mat, "transparency_method", expand=True) | 203 row.prop(mat, "transparency_method", expand=True) |
182 | 204 |
183 layout.separator() | 205 layout.separator() |
184 | 206 |
185 split = layout.split() | 207 split = layout.split() |
186 col = split.column() | 208 col = split.column() |
187 | 209 |
188 col.prop(mat, "use_raytrace") | 210 col.prop(mat, "use_raytrace") |
189 col.prop(mat, "use_full_oversampling") | 211 col.prop(mat, "use_full_oversampling") |
190 sub = col.column() | 212 sub = col.column() |
191 sub.active = mat_type | 213 sub.active = mat_type |
192 sub.prop(mat, "use_sky") | 214 sub.prop(mat, "use_sky") |
193 sub.prop(mat, "invert_z") | 215 sub.prop(mat, "invert_z") |
194 | 216 |
195 col = split.column() | 217 col = split.column() |
196 col.active = mat_type | 218 col.active = mat_type |
197 | 219 |
198 col.prop(mat, "use_cast_shadows_only", text="Cast Only") | 220 col.prop(mat, "use_cast_shadows_only", text="Cast Only") |
199 col.prop(mat, "shadow_cast_alpha", text="Casting Alpha") | 221 col.prop(mat, "shadow_cast_alpha", text="Casting Alpha") |
200 col.prop(mat, "use_cast_buffer_shadows") | 222 col.prop(mat, "use_cast_buffer_shadows") |
201 col.prop(mat, "use_cast_approximate") | 223 col.prop(mat, "use_cast_approximate") |
202 | 224 col.prop(mat, "pass_index") |
203 | 225 |
204 class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel): | 226 |
| 227 class MATERIAL_PT_diffuse(MaterialButtonsPanel, Panel): |
205 bl_label = "Diffuse" | 228 bl_label = "Diffuse" |
206 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | 229 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} |
207 | 230 |
208 @classmethod | 231 @classmethod |
209 def poll(cls, context): | 232 def poll(cls, context): |
210 mat = context.material | 233 mat = context.material |
211 engine = context.scene.render.engine | 234 engine = context.scene.render.engine |
212 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | 235 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) |
213 | 236 |
214 def draw(self, context): | 237 def draw(self, context): |
(...skipping 23 matching lines...) Expand all Loading... |
238 elif mat.diffuse_shader == 'TOON': | 261 elif mat.diffuse_shader == 'TOON': |
239 row = col.row() | 262 row = col.row() |
240 row.prop(mat, "diffuse_toon_size", text="Size") | 263 row.prop(mat, "diffuse_toon_size", text="Size") |
241 row.prop(mat, "diffuse_toon_smooth", text="Smooth") | 264 row.prop(mat, "diffuse_toon_smooth", text="Smooth") |
242 elif mat.diffuse_shader == 'FRESNEL': | 265 elif mat.diffuse_shader == 'FRESNEL': |
243 row = col.row() | 266 row = col.row() |
244 row.prop(mat, "diffuse_fresnel", text="Fresnel") | 267 row.prop(mat, "diffuse_fresnel", text="Fresnel") |
245 row.prop(mat, "diffuse_fresnel_factor", text="Factor") | 268 row.prop(mat, "diffuse_fresnel_factor", text="Factor") |
246 | 269 |
247 if mat.use_diffuse_ramp: | 270 if mat.use_diffuse_ramp: |
248 layout.separator() | 271 col = layout.column() |
249 layout.template_color_ramp(mat, "diffuse_ramp", expand=True) | 272 col.active = (not mat.use_shadeless) |
250 layout.separator() | 273 col.separator() |
251 | 274 col.template_color_ramp(mat, "diffuse_ramp", expand=True) |
252 row = layout.row() | 275 col.separator() |
| 276 |
| 277 row = col.row() |
253 row.prop(mat, "diffuse_ramp_input", text="Input") | 278 row.prop(mat, "diffuse_ramp_input", text="Input") |
254 row.prop(mat, "diffuse_ramp_blend", text="Blend") | 279 row.prop(mat, "diffuse_ramp_blend", text="Blend") |
255 | 280 |
256 layout.prop(mat, "diffuse_ramp_factor", text="Factor") | 281 col.prop(mat, "diffuse_ramp_factor", text="Factor") |
257 | 282 |
258 | 283 |
259 class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel): | 284 class MATERIAL_PT_specular(MaterialButtonsPanel, Panel): |
260 bl_label = "Specular" | 285 bl_label = "Specular" |
261 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | 286 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} |
262 | 287 |
263 @classmethod | 288 @classmethod |
264 def poll(cls, context): | 289 def poll(cls, context): |
265 mat = context.material | 290 mat = context.material |
266 engine = context.scene.render.engine | 291 engine = context.scene.render.engine |
267 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | 292 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) |
268 | 293 |
269 def draw(self, context): | 294 def draw(self, context): |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 layout.template_color_ramp(mat, "specular_ramp", expand=True) | 327 layout.template_color_ramp(mat, "specular_ramp", expand=True) |
303 layout.separator() | 328 layout.separator() |
304 | 329 |
305 row = layout.row() | 330 row = layout.row() |
306 row.prop(mat, "specular_ramp_input", text="Input") | 331 row.prop(mat, "specular_ramp_input", text="Input") |
307 row.prop(mat, "specular_ramp_blend", text="Blend") | 332 row.prop(mat, "specular_ramp_blend", text="Blend") |
308 | 333 |
309 layout.prop(mat, "specular_ramp_factor", text="Factor") | 334 layout.prop(mat, "specular_ramp_factor", text="Factor") |
310 | 335 |
311 | 336 |
312 class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel): | 337 class MATERIAL_PT_shading(MaterialButtonsPanel, Panel): |
313 bl_label = "Shading" | 338 bl_label = "Shading" |
314 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | 339 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} |
315 | 340 |
316 @classmethod | 341 @classmethod |
317 def poll(cls, context): | 342 def poll(cls, context): |
318 mat = context.material | 343 mat = context.material |
319 engine = context.scene.render.engine | 344 engine = context.scene.render.engine |
320 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | 345 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) |
321 | 346 |
322 def draw(self, context): | 347 def draw(self, context): |
(...skipping 13 matching lines...) Expand all Loading... |
336 sub.prop(mat, "translucency") | 361 sub.prop(mat, "translucency") |
337 | 362 |
338 col = split.column() | 363 col = split.column() |
339 col.prop(mat, "use_shadeless") | 364 col.prop(mat, "use_shadeless") |
340 sub = col.column() | 365 sub = col.column() |
341 sub.active = not mat.use_shadeless | 366 sub.active = not mat.use_shadeless |
342 sub.prop(mat, "use_tangent_shading") | 367 sub.prop(mat, "use_tangent_shading") |
343 sub.prop(mat, "use_cubic") | 368 sub.prop(mat, "use_cubic") |
344 | 369 |
345 | 370 |
346 class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel): | 371 class MATERIAL_PT_transp(MaterialButtonsPanel, Panel): |
347 bl_label = "Transparency" | 372 bl_label = "Transparency" |
348 # bl_options = {'DEFAULT_CLOSED'} | |
349 COMPAT_ENGINES = {'BLENDER_RENDER'} | 373 COMPAT_ENGINES = {'BLENDER_RENDER'} |
350 | 374 |
351 @classmethod | 375 @classmethod |
352 def poll(cls, context): | 376 def poll(cls, context): |
353 mat = context.material | 377 mat = context.material |
354 engine = context.scene.render.engine | 378 engine = context.scene.render.engine |
355 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | 379 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) |
356 | 380 |
357 def draw_header(self, context): | 381 def draw_header(self, context): |
358 mat = context.material | 382 mat = context.material |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 426 |
403 col = split.column() | 427 col = split.column() |
404 col.label(text="Gloss:") | 428 col.label(text="Gloss:") |
405 col.prop(rayt, "gloss_factor", text="Amount") | 429 col.prop(rayt, "gloss_factor", text="Amount") |
406 sub = col.column() | 430 sub = col.column() |
407 sub.active = rayt.gloss_factor < 1.0 | 431 sub.active = rayt.gloss_factor < 1.0 |
408 sub.prop(rayt, "gloss_threshold", text="Threshold") | 432 sub.prop(rayt, "gloss_threshold", text="Threshold") |
409 sub.prop(rayt, "gloss_samples", text="Samples") | 433 sub.prop(rayt, "gloss_samples", text="Samples") |
410 | 434 |
411 | 435 |
412 class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel): | 436 class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel): |
413 bl_label = "Mirror" | 437 bl_label = "Mirror" |
414 bl_options = {'DEFAULT_CLOSED'} | 438 bl_options = {'DEFAULT_CLOSED'} |
415 COMPAT_ENGINES = {'BLENDER_RENDER'} | 439 COMPAT_ENGINES = {'BLENDER_RENDER'} |
416 | 440 |
417 @classmethod | 441 @classmethod |
418 def poll(cls, context): | 442 def poll(cls, context): |
419 mat = context.material | 443 mat = context.material |
420 engine = context.scene.render.engine | 444 engine = context.scene.render.engine |
421 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | 445 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) |
422 | 446 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 col = split.column() | 484 col = split.column() |
461 col.label(text="Gloss:") | 485 col.label(text="Gloss:") |
462 col.prop(raym, "gloss_factor", text="Amount") | 486 col.prop(raym, "gloss_factor", text="Amount") |
463 sub = col.column() | 487 sub = col.column() |
464 sub.active = raym.gloss_factor < 1.0 | 488 sub.active = raym.gloss_factor < 1.0 |
465 sub.prop(raym, "gloss_threshold", text="Threshold") | 489 sub.prop(raym, "gloss_threshold", text="Threshold") |
466 sub.prop(raym, "gloss_samples", text="Samples") | 490 sub.prop(raym, "gloss_samples", text="Samples") |
467 sub.prop(raym, "gloss_anisotropic", text="Anisotropic") | 491 sub.prop(raym, "gloss_anisotropic", text="Anisotropic") |
468 | 492 |
469 | 493 |
470 class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel): | 494 class MATERIAL_PT_sss(MaterialButtonsPanel, Panel): |
471 bl_label = "Subsurface Scattering" | 495 bl_label = "Subsurface Scattering" |
472 bl_options = {'DEFAULT_CLOSED'} | 496 bl_options = {'DEFAULT_CLOSED'} |
473 COMPAT_ENGINES = {'BLENDER_RENDER'} | 497 COMPAT_ENGINES = {'BLENDER_RENDER'} |
474 | 498 |
475 @classmethod | 499 @classmethod |
476 def poll(cls, context): | 500 def poll(cls, context): |
477 mat = context.material | 501 mat = context.material |
478 engine = context.scene.render.engine | 502 engine = context.scene.render.engine |
479 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | 503 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) |
480 | 504 |
481 def draw_header(self, context): | 505 def draw_header(self, context): |
482 mat = active_node_mat(context.material) | 506 mat = active_node_mat(context.material) |
483 sss = mat.subsurface_scattering | 507 sss = mat.subsurface_scattering |
484 | 508 |
485 self.layout.active = (not mat.use_shadeless) | 509 self.layout.active = (not mat.use_shadeless) |
486 self.layout.prop(sss, "use", text="") | 510 self.layout.prop(sss, "use", text="") |
487 | 511 |
488 def draw(self, context): | 512 def draw(self, context): |
489 layout = self.layout | 513 layout = self.layout |
490 | 514 |
491 mat = active_node_mat(context.material) | 515 mat = active_node_mat(context.material) |
492 sss = mat.subsurface_scattering | 516 sss = mat.subsurface_scattering |
493 | 517 |
494 layout.active = (sss.use) and (not mat.use_shadeless) | 518 layout.active = (sss.use) and (not mat.use_shadeless) |
495 | 519 |
496 row = layout.row().split() | 520 row = layout.row().split() |
497 sub = row.row(align=True).split(percentage=0.75) | 521 sub = row.row(align=True).split(align=True, percentage=0.75) |
498 sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_prese
ts.bl_label) | 522 sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_prese
ts.bl_label) |
499 sub.operator("material.sss_preset_add", text="", icon="ZOOMIN") | 523 sub.operator("material.sss_preset_add", text="", icon='ZOOMIN') |
500 sub.operator("material.sss_preset_add", text="", icon="ZOOMOUT").remove_
active = True | 524 sub.operator("material.sss_preset_add", text="", icon='ZOOMOUT').remove_
active = True |
501 | 525 |
502 split = layout.split() | 526 split = layout.split() |
503 | 527 |
504 col = split.column() | 528 col = split.column() |
505 col.prop(sss, "ior") | 529 col.prop(sss, "ior") |
506 col.prop(sss, "scale") | 530 col.prop(sss, "scale") |
507 col.prop(sss, "color", text="") | 531 col.prop(sss, "color", text="") |
508 col.prop(sss, "radius", text="RGB Radius", expand=True) | 532 col.prop(sss, "radius", text="RGB Radius", expand=True) |
509 | 533 |
510 col = split.column() | 534 col = split.column() |
511 sub = col.column(align=True) | 535 sub = col.column(align=True) |
512 sub.label(text="Blend:") | 536 sub.label(text="Blend:") |
513 sub.prop(sss, "color_factor", text="Color") | 537 sub.prop(sss, "color_factor", text="Color") |
514 sub.prop(sss, "texture_factor", text="Texture") | 538 sub.prop(sss, "texture_factor", text="Texture") |
515 sub.label(text="Scattering Weight:") | 539 sub.label(text="Scattering Weight:") |
516 sub.prop(sss, "front") | 540 sub.prop(sss, "front") |
517 sub.prop(sss, "back") | 541 sub.prop(sss, "back") |
518 col.separator() | 542 col.separator() |
519 col.prop(sss, "error_threshold", text="Error") | 543 col.prop(sss, "error_threshold", text="Error") |
520 | 544 |
521 | 545 |
522 class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel): | 546 class MATERIAL_PT_halo(MaterialButtonsPanel, Panel): |
523 bl_label = "Halo" | 547 bl_label = "Halo" |
524 COMPAT_ENGINES = {'BLENDER_RENDER'} | 548 COMPAT_ENGINES = {'BLENDER_RENDER'} |
525 | 549 |
526 @classmethod | 550 @classmethod |
527 def poll(cls, context): | 551 def poll(cls, context): |
528 mat = context.material | 552 mat = context.material |
529 engine = context.scene.render.engine | 553 engine = context.scene.render.engine |
530 return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES) | 554 return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES) |
531 | 555 |
532 def draw(self, context): | 556 def draw(self, context): |
533 layout = self.layout | 557 layout = self.layout |
534 | 558 |
535 mat = context.material # dont use node material | 559 mat = context.material # don't use node material |
536 halo = mat.halo | 560 halo = mat.halo |
537 | 561 |
538 def number_but(layout, toggle, number, name, color): | 562 def number_but(layout, toggle, number, name, color): |
539 row = layout.row(align=True) | 563 row = layout.row(align=True) |
540 row.prop(halo, toggle, text="") | 564 row.prop(halo, toggle, text="") |
541 sub = row.column() | 565 sub = row.column(align=True) |
542 sub.active = getattr(halo, toggle) | 566 sub.active = getattr(halo, toggle) |
543 sub.prop(halo, number, text=name) | 567 sub.prop(halo, number, text=name, translate=False) |
544 if not color == "": | 568 if not color == "": |
545 sub.prop(mat, color, text="") | 569 sub.prop(mat, color, text="") |
546 | 570 |
547 split = layout.split() | 571 split = layout.split() |
548 | 572 |
549 col = split.column() | 573 col = split.column() |
550 col.prop(mat, "alpha") | 574 col.prop(mat, "alpha") |
551 col.prop(mat, "diffuse_color", text="") | 575 col.prop(mat, "diffuse_color", text="") |
552 col.prop(halo, "seed") | 576 col.prop(halo, "seed") |
553 | 577 |
554 col = split.column() | 578 col = split.column() |
555 col.prop(halo, "size") | 579 col.prop(halo, "size") |
556 col.prop(halo, "hardness") | 580 col.prop(halo, "hardness") |
557 col.prop(halo, "add") | 581 col.prop(halo, "add") |
558 | 582 |
559 layout.label(text="Options:") | 583 layout.label(text="Options:") |
560 | 584 |
561 split = layout.split() | 585 split = layout.split() |
562 col = split.column() | 586 col = split.column() |
563 col.prop(halo, "use_texture") | 587 col.prop(halo, "use_texture") |
564 col.prop(halo, "use_vertex_normal") | 588 col.prop(halo, "use_vertex_normal") |
565 col.prop(halo, "use_extreme_alpha") | 589 col.prop(halo, "use_extreme_alpha") |
566 col.prop(halo, "use_shaded") | 590 col.prop(halo, "use_shaded") |
567 col.prop(halo, "use_soft") | 591 col.prop(halo, "use_soft") |
568 | 592 |
569 col = split.column() | 593 col = split.column() |
570 number_but(col, "use_ring", "ring_count", "Rings", "mirror_color") | 594 number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color
") |
571 number_but(col, "use_lines", "line_count", "Lines", "specular_color") | 595 number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_co
lor") |
572 number_but(col, "use_star", "star_tip_count", "Star tips", "") | 596 number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "") |
573 | 597 |
574 | 598 |
575 class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel): | 599 class MATERIAL_PT_flare(MaterialButtonsPanel, Panel): |
576 bl_label = "Flare" | 600 bl_label = "Flare" |
577 COMPAT_ENGINES = {'BLENDER_RENDER'} | 601 COMPAT_ENGINES = {'BLENDER_RENDER'} |
578 | 602 |
579 @classmethod | 603 @classmethod |
580 def poll(cls, context): | 604 def poll(cls, context): |
581 mat = context.material | 605 mat = context.material |
582 engine = context.scene.render.engine | 606 engine = context.scene.render.engine |
583 return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES) | 607 return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES) |
584 | 608 |
585 def draw_header(self, context): | 609 def draw_header(self, context): |
586 halo = context.material.halo | 610 halo = context.material.halo |
587 | 611 |
588 self.layout.prop(halo, "use_flare_mode", text="") | |
589 | |
590 def draw(self, context): | |
591 layout = self.layout | |
592 | |
593 mat = context.material # dont use node material | |
594 halo = mat.halo | |
595 | |
596 layout.active = halo.use_flare_mode | |
597 | |
598 split = layout.split() | |
599 | |
600 col = split.column() | |
601 col.prop(halo, "flare_size", text="Size") | |
602 col.prop(halo, "flare_boost", text="Boost") | |
603 col.prop(halo, "flare_seed", text="Seed") | |
604 | |
605 col = split.column() | |
606 col.prop(halo, "flare_subflare_count", text="Subflares") | |
607 col.prop(halo, "flare_subflare_size", text="Subsize") | 612 col.prop(halo, "flare_subflare_size", text="Subsize") |
608 | 613 |
609 | 614 |
610 class MATERIAL_PT_game_settings(MaterialButtonsPanel, bpy.types.Panel): | 615 class MATERIAL_PT_physics(MaterialButtonsPanel, Panel): |
611 bl_label = "Game Settings" | |
612 COMPAT_ENGINES = {'BLENDER_GAME'} | |
613 | |
614 @classmethod | |
615 def poll(cls, context): | |
616 return context.material and (context.scene.render.engine in cls.COMPAT_
ENGINES) | |
617 | |
618 def draw(self, context): | |
619 layout = self.layout | |
620 game = context.material.game_settings # dont use node material | |
621 | |
622 row = layout.row() | |
623 row.prop(game, "two_side") | |
624 row.prop(game, "invisible") | |
625 row.prop(game, "text") | |
626 | |
627 row = layout.row() | |
628 row.label(text="Alpha Blend:") | |
629 row.label(text="Face Orientation:") | |
630 row = layout.row() | |
631 row.prop(game,"alpha_blend",text="") | |
632 row.prop(game,"face_orientation",text="") | |
633 | |
634 class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): | |
635 bl_label = "Physics" | 616 bl_label = "Physics" |
636 COMPAT_ENGINES = {'BLENDER_GAME'} | 617 COMPAT_ENGINES = {'BLENDER_GAME'} |
637 ········ | 618 |
638 def draw_header(self, context): | 619 @classmethod |
639 game = context.material.game_settings | 620 def poll(cls, context): |
640 self.layout.prop(game, "physics", text="") | |
641 | |
642 @classmethod | |
643 def poll(cls, context): | |
644 return context.material and (context.scene.render.engine in cls.COMPAT_E
NGINES) | |
645 | |
646 def draw(self, context): | |
647 layout = self.layout | |
648 layout.active = context.material.game_settings.physics | |
649 | |
650 phys = context.material.physics # dont use node material | |
651 | |
652 split = layout.split() | |
653 row = split.row() | |
654 row.prop(phys, "friction") | |
655 row.prop(phys, "elasticity", slider=True) | |
656 | |
657 row = layout.row() | |
658 row.label(text="Force Field:") | |
659 | |
660 row = layout.row() | |
661 row.prop(phys, "fh_force") | |
662 row.prop(phys, "fh_damping", slider=True) | |
663 | |
664 row = layout.row() | |
665 row.prop(phys, "fh_distance") | |
666 row.prop(phys, "use_fh_normal") | |
667 | |
668 | |
669 class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel): | |
670 bl_label = "Strand" | |
671 bl_options = {'DEFAULT_CLOSED'} | |
672 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
673 | |
674 @classmethod | |
675 def poll(cls, context): | |
676 mat = context.material | |
677 engine = context.scene.render.engine | |
678 return mat and (mat.type in {'SURFACE', 'WIRE', 'HALO'}) and (engine in
cls.COMPAT_ENGINES) | |
679 | |
680 def draw(self, context): | |
681 layout = self.layout | |
682 | |
683 mat = context.material # dont use node material | |
684 tan = mat.strand | |
685 | |
686 split = layout.split() | |
687 | |
688 col = split.column() | |
689 sub = col.column(align=True) | |
690 sub.label(text="Size:") | |
691 sub.prop(tan, "root_size", text="Root") | |
692 sub.prop(tan, "tip_size", text="Tip") | |
693 sub.prop(tan, "size_min", text="Minimum") | |
694 sub.prop(tan, "use_blender_units") | |
695 sub = col.column() | |
696 sub.active = (not mat.use_shadeless) | |
697 sub.prop(tan, "use_tangent_shading") | |
698 col.prop(tan, "shape") | |
699 | |
700 col = split.column() | |
701 col.label(text="Shading:") | |
702 col.prop(tan, "width_fade") | |
703 ob = context.object | |
704 if ob and ob.type == 'MESH': | |
705 col.prop_search(tan, "uv_layer", ob.data, "uv_textures", text="") | |
706 else: | |
707 col.prop(tan, "uv_layer", text="") | |
708 col.separator() | |
709 sub = col.column() | |
710 sub.active = (not mat.use_shadeless) | |
711 sub.label("Surface diffuse:") | |
712 sub = col.column() | |
713 sub.prop(tan, "blend_distance", text="Distance") | |
714 | |
715 | |
716 class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel): | |
717 bl_label = "Options" | |
718 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | |
719 | |
720 @classmethod | |
721 def poll(cls, context): | |
722 mat = context.material | |
723 engine = context.scene.render.engine | |
724 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | |
725 | |
726 def draw(self, context): | |
727 layout = self.layout | |
728 | |
729 base_mat = context.material | |
730 mat = active_node_mat(base_mat) | |
731 | |
732 split = layout.split() | |
733 | |
734 col = split.column() | |
735 if simple_material(base_mat): | |
736 col.prop(mat, "use_raytrace") | |
737 col.prop(mat, "use_full_oversampling") | |
738 col.prop(mat, "use_sky") | |
739 col.prop(mat, "use_mist") | |
740 if simple_material(base_mat): | |
741 col.prop(mat, "invert_z") | |
742 sub = col.row() | |
743 sub.prop(mat, "offset_z") | |
744 sub.active = mat.use_transparency and mat.transparency_method == 'Z_
TRANSPARENCY' | |
745 sub = col.column(align=True) | |
746 sub.label(text="Light Group:") | |
747 sub.prop(mat, "light_group", text="") | |
748 row = sub.row() | |
749 row.active = bool(mat.light_group) | |
750 row.prop(mat, "use_light_group_exclusive", text="Exclusive") | |
751 | |
752 col = split.column() | |
753 col.prop(mat, "use_face_texture") | |
754 sub = col.column() | |
755 sub.active = mat.use_face_texture | |
756 sub.prop(mat, "use_face_texture_alpha") | |
757 col.separator() | |
758 col.prop(mat, "use_vertex_color_paint") | |
759 col.prop(mat, "use_vertex_color_light") | |
760 col.prop(mat, "use_object_color") | |
761 col.prop(mat, "pass_index") | |
762 | |
763 | |
764 class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel): | |
765 bl_label = "Shadow" | |
766 bl_options = {'DEFAULT_CLOSED'} | |
767 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | |
768 | |
769 @classmethod | |
770 def poll(cls, context): | |
771 mat = context.material | |
772 engine = context.scene.render.engine | |
773 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (en
gine in cls.COMPAT_ENGINES) | |
774 | |
775 def draw(self, context): | |
776 layout = self.layout | |
777 | |
778 base_mat = context.material | |
779 mat = active_node_mat(base_mat) | |
780 | |
781 split = layout.split() | |
782 | |
783 col = split.column() | |
784 col.prop(mat, "use_shadows", text="Receive") | |
785 col.prop(mat, "use_transparent_shadows", text="Receive Transparent") | |
786 if simple_material(base_mat): | |
787 col.prop(mat, "use_cast_shadows_only", text="Cast Only") | |
788 col.prop(mat, "shadow_cast_alpha", text="Casting Alpha") | |
789 col.prop(mat, "use_only_shadow", text="Shadows Only") | |
790 sub = col.column() | |
791 sub.active = mat.use_only_shadow | |
792 sub.prop(mat, "shadow_only_type", text="") | |
793 | |
794 col = split.column() | |
795 if simple_material(base_mat): | |
796 col.prop(mat, "use_cast_buffer_shadows") | |
797 sub = col.column() | |
798 sub.active = mat.use_cast_buffer_shadows | |
799 sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias") | |
800 col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias") | |
801 sub = col.column() | |
802 sub.active = (not mat.use_ray_shadow_bias) | |
803 sub.prop(mat, "shadow_ray_bias", text="Ray Bias") | |
804 if simple_material(base_mat): | |
805 col.prop(mat, "use_cast_approximate") | |
806 | |
807 | |
808 class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel): | |
809 bl_label = "Transparency" | |
810 bl_options = {'DEFAULT_CLOSED'} | |
811 COMPAT_ENGINES = {'BLENDER_GAME'} | |
812 | |
813 @classmethod | |
814 def poll(cls, context): | |
815 mat = context.material | |
816 engine = context.scene.render.engine | |
817 return check_material(mat) and (engine in cls.COMPAT_ENGINES) | |
818 | |
819 def draw_header(self, context): | |
820 mat = context.material | |
821 | |
822 if simple_material(mat): | |
823 self.layout.prop(mat, "use_transparency", text="") | |
824 | |
825 def draw(self, context): | |
826 layout = self.layout | |
827 base_mat = context.material | |
828 mat = active_node_mat(base_mat) | |
829 | |
830 if simple_material(base_mat): | |
831 row = layout.row() | |
832 row.active = mat.use_transparency | |
833 row.prop(mat, "transparency_method", expand=True) | |
834 | |
835 layout.prop(mat, "alpha") | |
836 | |
837 | |
838 class VolumeButtonsPanel(): | |
839 bl_space_type = 'PROPERTIES' | |
840 bl_region_type = 'WINDOW' | |
841 bl_context = "material" | |
842 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
843 | |
844 @classmethod | |
845 def poll(cls, context): | |
846 mat = context.material | |
847 engine = context.scene.render.engine | |
848 return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES) | |
849 | |
850 | |
851 class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel): | |
852 bl_label = "Density" | |
853 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
854 | |
855 def draw(self, context): | |
856 layout = self.layout | |
857 | |
858 vol = context.material.volume # dont use node material | |
859 | |
860 row = layout.row() | |
861 row.prop(vol, "density") | |
862 row.prop(vol, "density_scale") | |
863 | |
864 | |
865 class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel): | |
866 bl_label = "Shading" | |
867 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
868 | |
869 def draw(self, context): | |
870 layout = self.layout | |
871 | |
872 vol = context.material.volume # dont use node material | |
873 | |
874 split = layout.split() | |
875 | |
876 col = split.column() | |
877 col.prop(vol, "scattering") | |
878 col.prop(vol, "asymmetry") | |
879 col.prop(vol, "transmission_color") | |
880 | |
881 col = split.column() | |
882 sub = col.column(align=True) | |
883 sub.prop(vol, "emission") | |
884 sub.prop(vol, "emission_color", text="") | |
885 sub = col.column(align=True) | |
886 sub.prop(vol, "reflection") | |
887 sub.prop(vol, "reflection_color", text="") | |
888 | |
889 | |
890 class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel): | |
891 bl_label = "Lighting" | |
892 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
893 | |
894 def draw(self, context): | |
895 layout = self.layout | |
896 | |
897 vol = context.material.volume # dont use node material | |
898 | |
899 split = layout.split() | |
900 | |
901 col = split.column() | |
902 col.prop(vol, "light_method", text="") | |
903 | |
904 col = split.column() | |
905 | |
906 if vol.light_method == 'SHADED': | |
907 col.prop(vol, "use_external_shadows") | |
908 col.prop(vol, "use_light_cache") | |
909 sub = col.column() | |
910 sub.active = vol.use_light_cache | |
911 sub.prop(vol, "cache_resolution") | |
912 elif vol.light_method in {'MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_S
CATTERING'}: | |
913 sub = col.column() | |
914 sub.enabled = True | |
915 sub.active = False | |
916 sub.label("Light Cache Enabled") | |
917 col.prop(vol, "cache_resolution") | |
918 | |
919 sub = col.column(align=True) | |
920 sub.prop(vol, "ms_diffusion") | |
921 sub.prop(vol, "ms_spread") | |
922 sub.prop(vol, "ms_intensity") | |
923 | |
924 | |
925 class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel): | |
926 bl_label = "Transparency" | |
927 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
928 | |
929 @classmethod | |
930 def poll(cls, context): | |
931 mat = context.material | |
932 engine = context.scene.render.engine | |
933 return mat and simple_material(mat) and (mat.type == 'VOLUME') and (engi
ne in cls.COMPAT_ENGINES) | |
934 | |
935 def draw(self, context): | |
936 layout = self.layout | |
937 | |
938 mat = context.material # dont use node material | |
939 | |
940 layout.prop(mat, "transparency_method", expand=True) | |
941 | |
942 | |
943 class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel): | |
944 bl_label = "Integration" | |
945 COMPAT_ENGINES = {'BLENDER_RENDER'} | |
946 | |
947 def draw(self, context): | |
948 layout = self.layout | |
949 | |
950 vol = context.material.volume # dont use node material | |
951 | |
952 split = layout.split() | |
953 | |
954 col = split.column() | |
955 col.label(text="Step Calculation:") | |
956 col.prop(vol, "step_method", text="") | |
957 col = col.column(align=True) | |
958 col.prop(vol, "step_size") | |
959 | |
960 col = split.column() | |
961 col.label() | |
962 col.prop(vol, "depth_threshold") | |
963 | |
964 | |
965 class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel): | |
966 bl_label = "Options" | |
967 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | |
968 bl_options = {'DEFAULT_CLOSED'} | |
969 | |
970 @classmethod | |
971 def poll(cls, context): | |
972 mat = context.material | |
973 engine = context.scene.render.engine | |
974 return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls
.COMPAT_ENGINES) | |
975 | |
976 def draw(self, context): | |
977 layout = self.layout | |
978 | |
979 mat = active_node_mat(context.material) | |
980 | |
981 split = layout.split() | |
982 | |
983 col = split.column() | |
984 if simple_material(context.material): | |
985 col.prop(mat, "use_raytrace") | |
986 col.prop(mat, "use_full_oversampling") | |
987 col.prop(mat, "use_mist") | |
988 | |
989 col = split.column() | |
990 col.label(text="Light Group:") | |
991 col.prop(mat, "light_group", text="") | |
992 row = col.row() | |
993 row.active = bool(mat.light_group) | |
994 row.prop(mat, "use_light_group_exclusive", text="Exclusive") | |
995 | |
996 | |
997 class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Pa
nel): | |
998 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} | |
999 _context_path = "material" | |
1000 _property_type = bpy.types.Material | |
1001 | |
1002 if __name__ == "__main__": # only for live edit. | |
1003 bpy.utils.register_module(__name__) | |
LEFT | RIGHT |