diff --git a/korman/operators/op_toolbox.py b/korman/operators/op_toolbox.py index 52fd8612..827b6adc 100644 --- a/korman/operators/op_toolbox.py +++ b/korman/operators/op_toolbox.py @@ -174,7 +174,7 @@ def execute(self, context): class PlasmaToggleDoubleSidedOperator(ToolboxOperator, bpy.types.Operator): - bl_idname = "mat.plasma_toggle_double_sided" + bl_idname = "material.plasma_toggle_double_sided" bl_label = "Toggle All Double Sided" bl_description = "Toggles all materials to be double sided" @@ -188,7 +188,7 @@ def execute(self, context): class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator): - bl_idname = "mat.plasma_toggle_double_sided_selected" + bl_idname = "material.plasma_toggle_double_sided_selected" bl_label = "Toggle Selected Double Sided" bl_description = "Toggles selected meshes' material(s) double sided value" @@ -197,7 +197,7 @@ def poll(cls, context): return super().poll(context) and hasattr(bpy.context, "selected_objects") def execute(self, context): - mat_list = [i.data for i in context.selected_objects if i.type == "MATERIAL"] + mat_list = [slot.material for slot in itertools.chain.from_iterable((i.material_slots for i in context.selected_objects)) if slot and slot.material] enable = not all((mat.plasma_mat.plasma_double_sided for mat in mat_list)) for mat in mat_list: mat.plasma_mat.plasma_double_sided = enable diff --git a/korman/properties/prop_material.py b/korman/properties/prop_material.py index e1ea28dd..4c5b8002 100644 --- a/korman/properties/prop_material.py +++ b/korman/properties/prop_material.py @@ -19,7 +19,7 @@ from .. import idprops class PlasmaMaterial(bpy.types.PropertyGroup): - bl_idname = "mat.plasma_mat" + bl_idname = "material.plasma_material" plasma_double_sided = BoolProperty(name="Double Sided", description="Sets this material as double sided (formerly TWOSIDE)", diff --git a/korman/ui/ui_material.py b/korman/ui/ui_material.py index db460d2b..496a6674 100644 --- a/korman/ui/ui_material.py +++ b/korman/ui/ui_material.py @@ -31,8 +31,8 @@ class PlasmaMaterialPanel(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Plasma Material Options" def draw(self, context): - mat, slot = context.material, getattr(context, "material_slot", None) - mat_props = mat.plasma_mat + mat = context.material + mat_props = mat.plasma_material layout = self.layout split = layout.split()