From 3bf842aa603c869011fe65bbb75aad77f32aa886 Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Fri, 20 Aug 2021 10:02:55 -0400 Subject: [PATCH] Adjust Toolbox Buttons Adjusts the Toolbox Double Sided Button Operators to use new material panel toggle for double sided. --- korman/operators/op_toolbox.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/korman/operators/op_toolbox.py b/korman/operators/op_toolbox.py index a5ffb64..1f608dd 100644 --- a/korman/operators/op_toolbox.py +++ b/korman/operators/op_toolbox.py @@ -176,31 +176,31 @@ class PlasmaToggleAllPlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator): class PlasmaToggleDoubleSidedOperator(ToolboxOperator, bpy.types.Operator): bl_idname = "mesh.plasma_toggle_double_sided" bl_label = "Toggle All Double Sided" - bl_description = "Toggles all meshes to be double sided" + bl_description = "Toggles all materials to be double sided (NOT RECOMMENDED)" enable = BoolProperty(name="Enable", description="Enable Double Sided") def execute(self, context): enable = self.enable - for mesh in bpy.data.meshes: - mesh.show_double_sided = enable + for mat in bpy.data.materials: + mat.plasma_material.plasma_double_sided = enable return {"FINISHED"} class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator): bl_idname = "mesh.plasma_toggle_double_sided_selected" bl_label = "Toggle Selected Double Sided" - bl_description = "Toggles selected meshes double sided value" + bl_description = "Toggles selected meshes' material(s) double sided value" @classmethod def poll(cls, context): return super().poll(context) and hasattr(bpy.context, "selected_objects") def execute(self, context): - mesh_list = [i.data for i in context.selected_objects if i.type == "MESH"] - enable = not all((mesh.show_double_sided for mesh in mesh_list)) - for mesh in mesh_list: - mesh.show_double_sided = enable + mat_list = [i.data for i in context.selected_objects if i.type == "MATERIAL"] + enable = not all((mat.plasma_material.plasma_double_sided for mat in mat_list)) + for mat in mat_list: + mat.plasma_material.plasma_double_sided = enable return {"FINISHED"}