Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_material.py
| Context not available. | |||||
| from bpy.app.translations import pgettext_iface as iface_ | from bpy.app.translations import pgettext_iface as iface_ | ||||
| from bpy_extras.node_utils import find_node_input | from bpy_extras.node_utils import find_node_input | ||||
| def material_property_options(layout, context): | |||||
| layout.use_property_split = True | |||||
| mat = context | |||||
| layout.prop(mat, "blend_method") | |||||
| if mat.blend_method != 'OPAQUE': | |||||
| layout.prop(mat, "transparent_shadow_method") | |||||
| row = layout.row() | |||||
| row.active = ((mat.blend_method == 'CLIP') or (mat.transparent_shadow_method == 'CLIP')) | |||||
| row.prop(mat, "alpha_threshold") | |||||
| if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}: | |||||
| layout.prop(mat, "show_transparent_backside") | |||||
| layout.prop(mat, "use_screen_refraction") | |||||
| layout.prop(mat, "refraction_depth") | |||||
| layout.prop(mat, "use_sss_translucency") | |||||
| def material_property_viewport(layout, context): | |||||
| mat = context | |||||
| layout.use_property_split = True | |||||
| col = layout.column() | |||||
| col.prop(mat, "diffuse_color") | |||||
| col.prop(mat, "specular_color") | |||||
| col.prop(mat, "roughness") | |||||
| class MATERIAL_MT_specials(Menu): | class MATERIAL_MT_specials(Menu): | ||||
| bl_label = "Material Specials" | bl_label = "Material Specials" | ||||
| Context not available. | |||||
| return context.material and (engine in cls.COMPAT_ENGINES) | return context.material and (engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | material_property_options(self.layout, context.material) | ||||
| layout.use_property_split = True | |||||
| mat = context.material | |||||
| layout.prop(mat, "blend_method") | |||||
| if mat.blend_method != 'OPAQUE': | |||||
| layout.prop(mat, "transparent_shadow_method") | |||||
| row = layout.row() | |||||
| row.active = ((mat.blend_method == 'CLIP') or (mat.transparent_shadow_method == 'CLIP')) | |||||
| row.prop(mat, "alpha_threshold") | |||||
| if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}: | |||||
| layout.prop(mat, "show_transparent_backside") | |||||
| layout.prop(mat, "use_screen_refraction") | |||||
| layout.prop(mat, "refraction_depth") | |||||
| layout.prop(mat, "use_sss_translucency") | |||||
| class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel): | class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel): | ||||
| Context not available. | |||||
| return context.material | return context.material | ||||
| def draw(self, context): | def draw(self, context): | ||||
| mat = context.material | material_property_viewport(self.layout, context.material) | ||||
| layout = self.layout | |||||
| layout.use_property_split = True | |||||
| col = layout.column() | |||||
| col.prop(mat, "diffuse_color") | |||||
| col.prop(mat, "specular_color") | |||||
| col.prop(mat, "roughness") | |||||
| classes = ( | classes = ( | ||||
| Context not available. | |||||