Browse Source

Adjust Toolbox Buttons

Adjusts the Toolbox Double Sided Button Operators to use new material panel toggle for double sided.
pull/280/head
Patrick Dulebohn 3 years ago
parent
commit
3bf842aa60
  1. 16
      korman/operators/op_toolbox.py

16
korman/operators/op_toolbox.py

@ -176,31 +176,31 @@ class PlasmaToggleAllPlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator):
class PlasmaToggleDoubleSidedOperator(ToolboxOperator, bpy.types.Operator): class PlasmaToggleDoubleSidedOperator(ToolboxOperator, bpy.types.Operator):
bl_idname = "mesh.plasma_toggle_double_sided" bl_idname = "mesh.plasma_toggle_double_sided"
bl_label = "Toggle All 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") enable = BoolProperty(name="Enable", description="Enable Double Sided")
def execute(self, context): def execute(self, context):
enable = self.enable enable = self.enable
for mesh in bpy.data.meshes: for mat in bpy.data.materials:
mesh.show_double_sided = enable mat.plasma_material.plasma_double_sided = enable
return {"FINISHED"} return {"FINISHED"}
class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator): class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator):
bl_idname = "mesh.plasma_toggle_double_sided_selected" bl_idname = "mesh.plasma_toggle_double_sided_selected"
bl_label = "Toggle Selected Double Sided" 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 @classmethod
def poll(cls, context): def poll(cls, context):
return super().poll(context) and hasattr(bpy.context, "selected_objects") return super().poll(context) and hasattr(bpy.context, "selected_objects")
def execute(self, context): def execute(self, context):
mesh_list = [i.data for i in context.selected_objects if i.type == "MESH"] mat_list = [i.data for i in context.selected_objects if i.type == "MATERIAL"]
enable = not all((mesh.show_double_sided for mesh in mesh_list)) enable = not all((mat.plasma_material.plasma_double_sided for mat in mat_list))
for mesh in mesh_list: for mat in mat_list:
mesh.show_double_sided = enable mat.plasma_material.plasma_double_sided = enable
return {"FINISHED"} return {"FINISHED"}

Loading…
Cancel
Save