From 0bdd42204e36414c6895fa0462713890cdfd4f7e Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Fri, 20 Aug 2021 16:26:23 -0400 Subject: [PATCH] Further Updates to Toolbox and Panel Added suggestions from Hoikas --- korman/exporter/material.py | 2 +- korman/operators/op_toolbox.py | 6 +++--- korman/properties/prop_material.py | 4 ++-- korman/ui/ui_material.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 4f7b4d8..b624836 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -1401,7 +1401,7 @@ class MaterialConverter: state = layer.state is_waveset = bo.plasma_modifiers.water_basic.enabled - if bm.plasma_material.plasma_double_sided: + if bm.plasma_material.double_sided: if is_waveset: self._report.warn("FORCING single sided--this is a waveset (are you insane?)") else: diff --git a/korman/operators/op_toolbox.py b/korman/operators/op_toolbox.py index 52fd861..827b6ad 100644 --- a/korman/operators/op_toolbox.py +++ b/korman/operators/op_toolbox.py @@ -174,7 +174,7 @@ class PlasmaToggleAllPlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator): 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 @@ class PlasmaToggleDoubleSidedOperator(ToolboxOperator, bpy.types.Operator): 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 @@ class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator) 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 e1ea28d..7d82208 100644 --- a/korman/properties/prop_material.py +++ b/korman/properties/prop_material.py @@ -19,9 +19,9 @@ from bpy.props import * 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", + double_sided = BoolProperty(name="Double Sided", description="Sets this material as double sided (formerly TWOSIDE)", default=False) diff --git a/korman/ui/ui_material.py b/korman/ui/ui_material.py index db460d2..adf5d44 100644 --- a/korman/ui/ui_material.py +++ b/korman/ui/ui_material.py @@ -31,12 +31,12 @@ 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() col = split.column() sub = col.column() - col.prop(mat_props, "plasma_double_sided") + col.prop(mat_props, "double_sided")