1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
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,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 from bpy.types import Menu, Panel, UIList
22 from rna_prop_ui import PropertyPanel
23 from bpy.app.translations import pgettext_iface as iface_
26 def active_node_mat(mat):
27 # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
28 # which settings from node-materials are used
30 mat_node = mat.active_node_material
39 def check_material(mat):
42 if mat.active_node_material is not None:
49 def simple_material(mat):
50 if (mat is not None) and (not mat.use_nodes):
55 class MATERIAL_MT_sss_presets(Menu):
56 bl_label = "SSS Presets"
58 preset_operator = "script.execute_preset"
59 draw = Menu.draw_preset
62 class MATERIAL_MT_specials(Menu):
63 bl_label = "Material Specials"
65 def draw(self, context):
68 layout.operator("object.material_slot_copy", icon='COPY_ID')
69 layout.operator("material.copy", icon='COPYDOWN')
70 layout.operator("material.paste", icon='PASTEDOWN')
73 class MATERIAL_UL_matslots(UIList):
74 def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
75 # assert(isinstance(item, bpy.types.MaterialSlot)
79 if self.layout_type in {'DEFAULT', 'COMPACT'}:
81 layout.prop(ma, "name", text="", emboss=False, icon_value=icon)
83 layout.label(text="", icon_value=icon)
84 if ma and not context.scene.render.use_shading_nodes:
85 manode = ma.active_node_material
87 layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
89 layout.label(text="Node <none>")
90 elif self.layout_type in {'GRID'}:
91 layout.alignment = 'CENTER'
92 layout.label(text="", icon_value=icon)
95 class MaterialButtonsPanel():
96 bl_space_type = 'PROPERTIES'
97 bl_region_type = 'WINDOW'
98 bl_context = "material"
99 # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
102 def poll(cls, context):
103 return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
106 class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
108 bl_options = {'HIDE_HEADER'}
109 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
112 def poll(cls, context):
113 # An exception, don't call the parent poll func because
114 # this manages materials for all engine types
116 engine = context.scene.render.engine
117 return (context.material or context.object) and (engine in cls.COMPAT_ENGINES)
119 def draw(self, context):
122 mat = context.material
124 slot = context.material_slot
125 space = context.space_data
130 row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=1)
132 col = row.column(align=True)
133 col.operator("object.material_slot_add", icon='ZOOMIN', text="")
134 col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
136 col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
138 if ob.mode == 'EDIT':
139 row = layout.row(align=True)
140 row.operator("object.material_slot_assign", text="Assign")
141 row.operator("object.material_slot_select", text="Select")
142 row.operator("object.material_slot_deselect", text="Deselect")
144 split = layout.split(percentage=0.65)
147 split.template_ID(ob, "active_material", new="material.new")
150 row.prop(mat, "use_nodes", icon='NODETREE', text="")
153 row.prop(slot, "link", text="")
157 split.template_ID(space, "pin_id")
161 layout.prop(mat, "type", expand=True)
164 row.label(text="", icon='NODETREE')
165 if mat.active_node_material:
166 row.prop(mat.active_node_material, "name", text="")
168 row.label(text="No material node selected")
171 class MATERIAL_PT_preview(MaterialButtonsPanel, Panel):
173 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
175 def draw(self, context):
176 self.layout.template_preview(context.material)
179 class MATERIAL_PT_pipeline(MaterialButtonsPanel, Panel):
180 bl_label = "Render Pipeline Options"
181 bl_options = {'DEFAULT_CLOSED'}
182 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
185 def poll(cls, context):
186 mat = context.material
187 engine = context.scene.render.engine
188 return mat and (not simple_material(mat)) and (mat.type in {'SURFACE', 'WIRE', 'VOLUME'}) and (engine in cls.COMPAT_ENGINES)
190 def draw(self, context):
191 layout = self. layout
193 mat = context.material
194 mat_type = mat.type in {'SURFACE', 'WIRE'}
197 row.active = mat_type
198 row.prop(mat, "use_transparency")
200 sub.prop(mat, "offset_z")
202 sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
205 row.active = mat.use_transparency or not mat_type
206 row.prop(mat, "transparency_method", expand=True)
210 split = layout.split()
213 col.prop(mat, "use_raytrace")
214 col.prop(mat, "use_full_oversampling")
216 sub.active = mat_type
217 sub.prop(mat, "use_sky")
218 sub.prop(mat, "invert_z")
219 col.prop(mat, "pass_index")
222 col.active = mat_type
224 col.prop(mat, "use_cast_shadows", text="Cast")
225 col.prop(mat, "use_cast_shadows_only", text="Cast Only")
226 col.prop(mat, "use_cast_buffer_shadows")
228 sub.active = mat.use_cast_buffer_shadows
229 sub.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
230 col.prop(mat, "use_cast_approximate")
233 class MATERIAL_PT_diffuse(MaterialButtonsPanel, Panel):
235 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
238 def poll(cls, context):
239 mat = context.material
240 engine = context.scene.render.engine
241 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
243 def draw(self, context):
246 mat = active_node_mat(context.material)
248 split = layout.split()
251 col.prop(mat, "diffuse_color", text="")
253 sub.active = (not mat.use_shadeless)
254 sub.prop(mat, "diffuse_intensity", text="Intensity")
257 col.active = (not mat.use_shadeless)
258 col.prop(mat, "diffuse_shader", text="")
259 col.prop(mat, "use_diffuse_ramp", text="Ramp")
261 col = layout.column()
262 col.active = (not mat.use_shadeless)
263 if mat.diffuse_shader == 'OREN_NAYAR':
264 col.prop(mat, "roughness")
265 elif mat.diffuse_shader == 'MINNAERT':
266 col.prop(mat, "darkness")
267 elif mat.diffuse_shader == 'TOON':
269 row.prop(mat, "diffuse_toon_size", text="Size")
270 row.prop(mat, "diffuse_toon_smooth", text="Smooth")
271 elif mat.diffuse_shader == 'FRESNEL':
273 row.prop(mat, "diffuse_fresnel", text="Fresnel")
274 row.prop(mat, "diffuse_fresnel_factor", text="Factor")
276 if mat.use_diffuse_ramp:
277 col = layout.column()
278 col.active = (not mat.use_shadeless)
280 col.template_color_ramp(mat, "diffuse_ramp", expand=True)
284 row.prop(mat, "diffuse_ramp_input", text="Input")
285 row.prop(mat, "diffuse_ramp_blend", text="Blend")
287 col.prop(mat, "diffuse_ramp_factor", text="Factor")
290 class MATERIAL_PT_specular(MaterialButtonsPanel, Panel):
291 bl_label = "Specular"
292 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
295 def poll(cls, context):
296 mat = context.material
297 engine = context.scene.render.engine
298 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
300 def draw(self, context):
303 mat = active_node_mat(context.material)
305 layout.active = (not mat.use_shadeless)
307 split = layout.split()
310 col.prop(mat, "specular_color", text="")
311 col.prop(mat, "specular_intensity", text="Intensity")
314 col.prop(mat, "specular_shader", text="")
315 col.prop(mat, "use_specular_ramp", text="Ramp")
317 col = layout.column()
318 if mat.specular_shader in {'COOKTORR', 'PHONG'}:
319 col.prop(mat, "specular_hardness", text="Hardness")
320 elif mat.specular_shader == 'BLINN':
322 row.prop(mat, "specular_hardness", text="Hardness")
323 row.prop(mat, "specular_ior", text="IOR")
324 elif mat.specular_shader == 'WARDISO':
325 col.prop(mat, "specular_slope", text="Slope")
326 elif mat.specular_shader == 'TOON':
328 row.prop(mat, "specular_toon_size", text="Size")
329 row.prop(mat, "specular_toon_smooth", text="Smooth")
331 if mat.use_specular_ramp:
333 layout.template_color_ramp(mat, "specular_ramp", expand=True)
337 row.prop(mat, "specular_ramp_input", text="Input")
338 row.prop(mat, "specular_ramp_blend", text="Blend")
340 layout.prop(mat, "specular_ramp_factor", text="Factor")
343 class MATERIAL_PT_shading(MaterialButtonsPanel, Panel):
345 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
348 def poll(cls, context):
349 mat = context.material
350 engine = context.scene.render.engine
351 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
353 def draw(self, context):
356 mat = active_node_mat(context.material)
358 if mat.type in {'SURFACE', 'WIRE'}:
359 split = layout.split()
363 sub.active = not mat.use_shadeless
364 sub.prop(mat, "emit")
365 sub.prop(mat, "ambient")
367 sub.prop(mat, "translucency")
370 col.prop(mat, "use_shadeless")
372 sub.active = not mat.use_shadeless
373 sub.prop(mat, "use_tangent_shading")
374 sub.prop(mat, "use_cubic")
377 class MATERIAL_PT_transp(MaterialButtonsPanel, Panel):
378 bl_label = "Transparency"
379 COMPAT_ENGINES = {'BLENDER_RENDER'}
382 def poll(cls, context):
383 mat = context.material
384 engine = context.scene.render.engine
385 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
387 def draw_header(self, context):
388 mat = context.material
390 if simple_material(mat):
391 self.layout.prop(mat, "use_transparency", text="")
393 def draw(self, context):
396 base_mat = context.material
397 mat = active_node_mat(context.material)
398 rayt = mat.raytrace_transparency
400 if simple_material(base_mat):
402 row.active = mat.use_transparency
403 row.prop(mat, "transparency_method", expand=True)
405 split = layout.split()
406 split.active = base_mat.use_transparency
409 col.prop(mat, "alpha")
411 row.active = (base_mat.transparency_method != 'MASK') and (not mat.use_shadeless)
412 row.prop(mat, "specular_alpha", text="Specular")
415 col.active = (not mat.use_shadeless)
416 col.prop(rayt, "fresnel")
418 sub.active = (rayt.fresnel > 0.0)
419 sub.prop(rayt, "fresnel_factor", text="Blend")
421 if base_mat.transparency_method == 'RAYTRACE':
423 split = layout.split()
424 split.active = base_mat.use_transparency
427 col.prop(rayt, "ior")
428 col.prop(rayt, "filter")
429 col.prop(rayt, "falloff")
430 col.prop(rayt, "depth_max")
431 col.prop(rayt, "depth")
434 col.label(text="Gloss:")
435 col.prop(rayt, "gloss_factor", text="Amount")
437 sub.active = rayt.gloss_factor < 1.0
438 sub.prop(rayt, "gloss_threshold", text="Threshold")
439 sub.prop(rayt, "gloss_samples", text="Samples")
442 class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel):
444 bl_options = {'DEFAULT_CLOSED'}
445 COMPAT_ENGINES = {'BLENDER_RENDER'}
448 def poll(cls, context):
449 mat = context.material
450 engine = context.scene.render.engine
451 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
453 def draw_header(self, context):
454 raym = active_node_mat(context.material).raytrace_mirror
456 self.layout.prop(raym, "use", text="")
458 def draw(self, context):
461 mat = active_node_mat(context.material)
462 raym = mat.raytrace_mirror
464 layout.active = raym.use
466 split = layout.split()
469 col.prop(raym, "reflect_factor")
470 col.prop(mat, "mirror_color", text="")
473 col.prop(raym, "fresnel")
475 sub.active = (raym.fresnel > 0.0)
476 sub.prop(raym, "fresnel_factor", text="Blend")
478 split = layout.split()
482 col.prop(raym, "depth")
483 col.prop(raym, "distance", text="Max Dist")
485 sub = col.split(percentage=0.4)
486 sub.active = (raym.distance > 0.0)
487 sub.label(text="Fade To:")
488 sub.prop(raym, "fade_to", text="")
491 col.label(text="Gloss:")
492 col.prop(raym, "gloss_factor", text="Amount")
494 sub.active = (raym.gloss_factor < 1.0)
495 sub.prop(raym, "gloss_threshold", text="Threshold")
496 sub.prop(raym, "gloss_samples", text="Samples")
497 sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
500 class MATERIAL_PT_sss(MaterialButtonsPanel, Panel):
501 bl_label = "Subsurface Scattering"
502 bl_options = {'DEFAULT_CLOSED'}
503 COMPAT_ENGINES = {'BLENDER_RENDER'}
506 def poll(cls, context):
507 mat = context.material
508 engine = context.scene.render.engine
509 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
511 def draw_header(self, context):
512 mat = active_node_mat(context.material)
513 sss = mat.subsurface_scattering
515 self.layout.active = (not mat.use_shadeless)
516 self.layout.prop(sss, "use", text="")
518 def draw(self, context):
521 mat = active_node_mat(context.material)
522 sss = mat.subsurface_scattering
524 layout.active = (sss.use) and (not mat.use_shadeless)
526 row = layout.row().split()
527 sub = row.row(align=True).split(align=True, percentage=0.75)
528 sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
529 sub.operator("material.sss_preset_add", text="", icon='ZOOMIN')
530 sub.operator("material.sss_preset_add", text="", icon='ZOOMOUT').remove_active = True
532 split = layout.split()
536 col.prop(sss, "scale")
537 col.prop(sss, "color", text="")
538 col.prop(sss, "radius", text="RGB Radius", expand=True)
541 sub = col.column(align=True)
542 sub.label(text="Blend:")
543 sub.prop(sss, "color_factor", text="Color")
544 sub.prop(sss, "texture_factor", text="Texture")
545 sub.label(text="Scattering Weight:")
546 sub.prop(sss, "front")
547 sub.prop(sss, "back")
549 col.prop(sss, "error_threshold", text="Error")
552 class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
554 COMPAT_ENGINES = {'BLENDER_RENDER'}
557 def poll(cls, context):
558 mat = context.material
559 engine = context.scene.render.engine
560 return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
562 def draw(self, context):
565 mat = context.material # don't use node material
568 def number_but(layout, toggle, number, name, color):
569 row = layout.row(align=True)
570 row.prop(halo, toggle, text="")
571 sub = row.column(align=True)
572 sub.active = getattr(halo, toggle)
573 sub.prop(halo, number, text=name, translate=False)
575 sub.prop(mat, color, text="")
577 split = layout.split()
580 col.prop(mat, "alpha")
581 col.prop(mat, "diffuse_color", text="")
582 col.prop(halo, "seed")
585 col.prop(halo, "size")
586 col.prop(halo, "hardness")
587 col.prop(halo, "add")
589 layout.label(text="Options:")
591 split = layout.split()
593 col.prop(halo, "use_texture")
594 col.prop(halo, "use_vertex_normal")
595 col.prop(halo, "use_extreme_alpha")
596 col.prop(halo, "use_shaded")
597 col.prop(halo, "use_soft")
600 number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color")
601 number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color")
602 number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
605 class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
607 COMPAT_ENGINES = {'BLENDER_RENDER'}
610 def poll(cls, context):
611 mat = context.material
612 engine = context.scene.render.engine
613 return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
615 def draw_header(self, context):
616 halo = context.material.halo
618 self.layout.prop(halo, "use_flare_mode", text="")
620 def draw(self, context):
623 mat = context.material # don't use node material
626 layout.active = halo.use_flare_mode
628 split = layout.split()
631 col.prop(halo, "flare_size", text="Size")
632 col.prop(halo, "flare_boost", text="Boost")
633 col.prop(halo, "flare_seed", text="Seed")
636 col.prop(halo, "flare_subflare_count", text="Subflares")
637 col.prop(halo, "flare_subflare_size", text="Subsize")
640 class MATERIAL_PT_game_settings(MaterialButtonsPanel, Panel):
641 bl_label = "Game Settings"
642 COMPAT_ENGINES = {'BLENDER_GAME'}
645 def poll(cls, context):
646 return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
648 def draw(self, context):
650 game = context.material.game_settings # don't use node material
653 row.prop(game, "use_backface_culling")
654 row.prop(game, "invisible")
655 row.prop(game, "text")
658 row.label(text="Alpha Blend:")
659 row.label(text="Face Orientation:")
661 row.prop(game, "alpha_blend", text="")
662 row.prop(game, "face_orientation", text="")
665 class MATERIAL_PT_physics(MaterialButtonsPanel, Panel):
667 COMPAT_ENGINES = {'BLENDER_GAME'}
669 def draw_header(self, context):
670 game = context.material.game_settings
671 self.layout.prop(game, "physics", text="")
674 def poll(cls, context):
675 return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
677 def draw(self, context):
679 layout.active = context.material.game_settings.physics
681 phys = context.material.physics # don't use node material
683 split = layout.split()
685 row.prop(phys, "friction")
686 row.prop(phys, "elasticity", slider=True)
689 row.label(text="Force Field:")
692 row.prop(phys, "fh_force")
693 row.prop(phys, "fh_damping", slider=True)
696 row.prop(phys, "fh_distance")
697 row.prop(phys, "use_fh_normal")
700 class MATERIAL_PT_strand(MaterialButtonsPanel, Panel):
702 bl_options = {'DEFAULT_CLOSED'}
703 COMPAT_ENGINES = {'BLENDER_RENDER'}
706 def poll(cls, context):
707 mat = context.material
708 engine = context.scene.render.engine
709 return mat and (mat.type in {'SURFACE', 'WIRE', 'HALO'}) and (engine in cls.COMPAT_ENGINES)
711 def draw(self, context):
714 mat = context.material # don't use node material
717 split = layout.split()
720 sub = col.column(align=True)
721 sub.label(text="Size:")
722 sub.prop(tan, "root_size", text="Root")
723 sub.prop(tan, "tip_size", text="Tip")
724 sub.prop(tan, "size_min", text="Minimum")
725 sub.prop(tan, "use_blender_units")
727 sub.active = (not mat.use_shadeless)
728 sub.prop(tan, "use_tangent_shading")
729 col.prop(tan, "shape")
732 col.label(text="Shading:")
733 col.prop(tan, "width_fade")
735 if ob and ob.type == 'MESH':
736 col.prop_search(tan, "uv_layer", ob.data, "uv_textures", text="")
738 col.prop(tan, "uv_layer", text="")
741 sub.active = (not mat.use_shadeless)
742 sub.label("Surface diffuse:")
744 sub.prop(tan, "blend_distance", text="Distance")
747 class MATERIAL_PT_options(MaterialButtonsPanel, Panel):
749 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
752 def poll(cls, context):
753 mat = context.material
754 engine = context.scene.render.engine
755 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
757 def draw(self, context):
760 base_mat = context.material
761 mat = active_node_mat(base_mat)
763 split = layout.split()
766 if simple_material(base_mat):
767 col.prop(mat, "use_raytrace")
768 col.prop(mat, "use_full_oversampling")
769 col.prop(mat, "use_sky")
770 col.prop(mat, "use_mist")
771 if simple_material(base_mat):
772 col.prop(mat, "invert_z")
774 sub.prop(mat, "offset_z")
775 sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
776 sub = col.column(align=True)
777 sub.label(text="Light Group:")
778 sub.prop(mat, "light_group", text="")
779 row = sub.row(align=True)
780 row.active = bool(mat.light_group)
781 row.prop(mat, "use_light_group_exclusive", text="Exclusive")
782 row.prop(mat, "use_light_group_local", text="Local")
785 col.prop(mat, "use_face_texture")
787 sub.active = mat.use_face_texture
788 sub.prop(mat, "use_face_texture_alpha")
790 col.prop(mat, "use_vertex_color_paint")
791 col.prop(mat, "use_vertex_color_light")
792 col.prop(mat, "use_object_color")
793 col.prop(mat, "use_uv_project")
794 if simple_material(base_mat):
795 col.prop(mat, "pass_index")
798 class MATERIAL_PT_shadow(MaterialButtonsPanel, Panel):
800 bl_options = {'DEFAULT_CLOSED'}
801 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
804 def poll(cls, context):
805 mat = context.material
806 engine = context.scene.render.engine
807 return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
809 def draw(self, context):
812 base_mat = context.material
813 mat = active_node_mat(base_mat)
815 split = layout.split()
818 col.prop(mat, "use_shadows", text="Receive")
819 col.prop(mat, "use_transparent_shadows", text="Receive Transparent")
820 col.prop(mat, "use_only_shadow", text="Shadows Only")
822 sub.active = mat.use_only_shadow
823 sub.prop(mat, "shadow_only_type", text="")
825 if not simple_material(base_mat):
828 col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias")
830 sub.active = (not mat.use_ray_shadow_bias)
831 sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
833 if simple_material(base_mat):
836 col.prop(mat, "use_cast_shadows", text="Cast")
837 col.prop(mat, "use_cast_shadows_only", text="Cast Only")
838 col.prop(mat, "use_cast_buffer_shadows")
840 sub.active = mat.use_cast_buffer_shadows
841 if simple_material(base_mat):
842 sub.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
843 sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
844 if simple_material(base_mat):
845 col.prop(mat, "use_cast_approximate")
848 class MATERIAL_PT_transp_game(MaterialButtonsPanel, Panel):
849 bl_label = "Transparency"
850 bl_options = {'DEFAULT_CLOSED'}
851 COMPAT_ENGINES = {'BLENDER_GAME'}
854 def poll(cls, context):
855 mat = context.material
856 engine = context.scene.render.engine
857 return check_material(mat) and (engine in cls.COMPAT_ENGINES)
859 def draw_header(self, context):
860 mat = context.material
862 if simple_material(mat):
863 self.layout.prop(mat, "use_transparency", text="")
865 def draw(self, context):
867 base_mat = context.material
868 mat = active_node_mat(base_mat)
870 if simple_material(base_mat):
872 row.active = mat.use_transparency
873 row.prop(mat, "transparency_method", expand=True)
875 layout.prop(mat, "alpha")
878 class VolumeButtonsPanel():
879 bl_space_type = 'PROPERTIES'
880 bl_region_type = 'WINDOW'
881 bl_context = "material"
882 COMPAT_ENGINES = {'BLENDER_RENDER'}
885 def poll(cls, context):
886 mat = context.material
887 engine = context.scene.render.engine
888 return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
891 class MATERIAL_PT_volume_density(VolumeButtonsPanel, Panel):
893 COMPAT_ENGINES = {'BLENDER_RENDER'}
895 def draw(self, context):
898 vol = context.material.volume # don't use node material
901 row.prop(vol, "density")
902 row.prop(vol, "density_scale")
905 class MATERIAL_PT_volume_shading(VolumeButtonsPanel, Panel):
907 COMPAT_ENGINES = {'BLENDER_RENDER'}
909 def draw(self, context):
912 vol = context.material.volume # don't use node material
914 split = layout.split()
917 col.prop(vol, "scattering")
918 col.prop(vol, "asymmetry")
919 col.prop(vol, "transmission_color")
922 sub = col.column(align=True)
923 sub.prop(vol, "emission")
924 sub.prop(vol, "emission_color", text="")
925 sub = col.column(align=True)
926 sub.prop(vol, "reflection")
927 sub.prop(vol, "reflection_color", text="")
930 class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, Panel):
931 bl_label = "Lighting"
932 COMPAT_ENGINES = {'BLENDER_RENDER'}
934 def draw(self, context):
937 vol = context.material.volume # don't use node material
939 split = layout.split()
942 col.prop(vol, "light_method", text="")
946 if vol.light_method == 'SHADED':
947 col.prop(vol, "use_external_shadows")
948 col.prop(vol, "use_light_cache")
950 sub.active = vol.use_light_cache
951 sub.prop(vol, "cache_resolution")
952 elif vol.light_method in {'MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'}:
956 sub.label("Light Cache Enabled")
957 col.prop(vol, "cache_resolution")
959 sub = col.column(align=True)
960 sub.prop(vol, "ms_diffusion")
961 sub.prop(vol, "ms_spread")
962 sub.prop(vol, "ms_intensity")
965 class MATERIAL_PT_volume_transp(VolumeButtonsPanel, Panel):
966 bl_label = "Transparency"
967 COMPAT_ENGINES = {'BLENDER_RENDER'}
970 def poll(cls, context):
971 mat = context.material
972 engine = context.scene.render.engine
973 return mat and simple_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
975 def draw(self, context):
978 mat = context.material # don't use node material
980 layout.prop(mat, "transparency_method", expand=True)
983 class MATERIAL_PT_volume_integration(VolumeButtonsPanel, Panel):
984 bl_label = "Integration"
985 COMPAT_ENGINES = {'BLENDER_RENDER'}
987 def draw(self, context):
990 vol = context.material.volume # don't use node material
992 split = layout.split()
995 col.label(text="Step Calculation:")
996 col.prop(vol, "step_method", text="")
997 col = col.column(align=True)
998 col.prop(vol, "step_size")
1000 col = split.column()
1002 col.prop(vol, "depth_threshold")
1005 class MATERIAL_PT_volume_options(VolumeButtonsPanel, Panel):
1006 bl_label = "Options"
1007 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
1008 bl_options = {'DEFAULT_CLOSED'}
1011 def poll(cls, context):
1012 mat = context.material
1013 engine = context.scene.render.engine
1014 return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
1016 def draw(self, context):
1017 layout = self.layout
1019 mat = active_node_mat(context.material)
1021 split = layout.split()
1023 col = split.column()
1024 if simple_material(context.material):
1025 col.prop(mat, "use_raytrace")
1026 col.prop(mat, "use_full_oversampling")
1027 col.prop(mat, "use_mist")
1029 col = split.column()
1030 col.label(text="Light Group:")
1031 col.prop(mat, "light_group", text="")
1033 row.active = bool(mat.light_group)
1034 row.prop(mat, "use_light_group_exclusive", text="Exclusive")
1037 class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, Panel):
1038 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
1039 _context_path = "material"
1040 _property_type = bpy.types.Material
1042 if __name__ == "__main__": # only for live edit.
1043 bpy.utils.register_module(__name__)