diff options
author | Pablo Vazquez <pablo@blender.org> | 2022-09-20 00:44:54 +0300 |
---|---|---|
committer | Pablo Vazquez <pablo@blender.org> | 2022-09-20 00:44:54 +0300 |
commit | 31656101c5f41b041bf6561d6f733722f49c6524 (patch) | |
tree | 1ca8d66d6f741fa8537a8090a33ba1dac4f335f3 /amaranth | |
parent | 6b9007c0247d4c9b74d641519d67d5b7fa42ff8d (diff) |
Amaranth: Remove "Switch Material" feature
Since 2.8 the Shader Editor has a popover with a UIList of all materials,
much more complete than the dropdown implementation in Amaranth.
Good to see Amaranth features being replaced by built-in ones in Blender :D
Diffstat (limited to 'amaranth')
-rw-r--r-- | amaranth/__init__.py | 1 | ||||
-rw-r--r-- | amaranth/node_editor/switch_material.py | 56 |
2 files changed, 0 insertions, 57 deletions
diff --git a/amaranth/__init__.py b/amaranth/__init__.py index 4cefaf0f..0bdbdb8c 100644 --- a/amaranth/__init__.py +++ b/amaranth/__init__.py @@ -41,7 +41,6 @@ from amaranth.node_editor import ( simplify_nodes, node_stats, normal_node, - switch_material, node_shader_extra, ) diff --git a/amaranth/node_editor/switch_material.py b/amaranth/node_editor/switch_material.py deleted file mode 100644 index 68e1be9b..00000000 --- a/amaranth/node_editor/switch_material.py +++ /dev/null @@ -1,56 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -""" -Material Selector - -Quickly switch materials in the active mesh without going to the Properties editor - -Based on 'Afeitadora's work on Elysiun -http://www.elysiun.com/forum/showthread.php?290097-Dynamic-Object-Dropdown-List&p=2361851#post2361851 - -""" - -import bpy - -def ui_node_editor_material_select(self, context): - - act_ob = context.active_object - - if act_ob and context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'META'} and \ - context.space_data.tree_type == 'ShaderNodeTree' and \ - context.space_data.shader_type == 'OBJECT': - - if act_ob.active_material: - mat_name = act_ob.active_material.name - else: - mat_name = "No Material" - - self.layout.operator_menu_enum("material.menu_select", - "material_select", - text=mat_name, - icon="MATERIAL") - -class AMNodeEditorMaterialSelect(bpy.types.Operator): - bl_idname = "material.menu_select" - bl_label = "Select Material" - bl_description = "Switch to another material in this mesh" - - def avail_materials(self,context): - items = [(str(i),x.name,x.name, "MATERIAL", i) for i,x in enumerate(bpy.context.active_object.material_slots)] - return items - material_select: bpy.props.EnumProperty(items = avail_materials, name = "Available Materials") - - @classmethod - def poll(cls, context): - return context.active_object - - def execute(self,context): - bpy.context.active_object.active_material_index = int(self.material_select) - return {'FINISHED'} - -def register(): - bpy.utils.register_class(AMNodeEditorMaterialSelect) - bpy.types.NODE_HT_header.append(ui_node_editor_material_select) - -def unregister(): - bpy.utils.unregister_class(AMNodeEditorMaterialSelect) - bpy.types.NODE_HT_header.remove(ui_node_editor_material_select) |