Browse Source

Fixes to Panel and Toolbox

More adjustments to get the dang thing working
pull/280/head
Patrick Dulebohn 3 years ago
parent
commit
ae85b03fb1
  1. 12
      korman/operators/op_toolbox.py
  2. 9
      korman/properties/prop_material.py
  3. 24
      korman/ui/ui_material.py

12
korman/operators/op_toolbox.py

@ -174,21 +174,21 @@ 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 = "mat.plasma_toggle_double_sided"
bl_label = "Toggle All Double Sided" bl_label = "Toggle All Double Sided"
bl_description = "Toggles all materials to be double sided (NOT RECOMMENDED)" bl_description = "Toggles all materials to be double sided"
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 mat in bpy.data.materials: for mat in bpy.data.materials:
mat.plasma_material.plasma_double_sided = enable mat.plasma_mat.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 = "mat.plasma_toggle_double_sided_selected"
bl_label = "Toggle Selected Double Sided" bl_label = "Toggle Selected Double Sided"
bl_description = "Toggles selected meshes' material(s) double sided value" bl_description = "Toggles selected meshes' material(s) double sided value"
@ -198,9 +198,9 @@ class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator)
def execute(self, context): def execute(self, context):
mat_list = [i.data for i in context.selected_objects if i.type == "MATERIAL"] 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)) enable = not all((mat.plasma_mat.plasma_double_sided for mat in mat_list))
for mat in mat_list: for mat in mat_list:
mat.plasma_material.plasma_double_sided = enable mat.plasma_mat.plasma_double_sided = enable
return {"FINISHED"} return {"FINISHED"}

9
korman/properties/prop_material.py

@ -19,10 +19,9 @@ from bpy.props import *
from .. import idprops from .. import idprops
class PlasmaMaterial(bpy.types.PropertyGroup): class PlasmaMaterial(bpy.types.PropertyGroup):
bl_name = "material.plasma_material" bl_idname = "mat.plasma_mat"
plasma_double_sided = BoolProperty(name="Double Sided",
description="Sets this material as double sided (formerly TWOSIDE)",
default=False)
plasma_double_sided = BoolProperty(name="Double Sided",
description="Sets this material as double sided (formerly TWOSIDE)",
default=False)

24
korman/ui/ui_material.py

@ -19,20 +19,24 @@ from . import ui_list
class MaterialButtonsPanel: class MaterialButtonsPanel:
bl_space_type = "PROPERTIES" bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW" bl_region_type = "WINDOW"
bl_context = "material" bl_context = "material"
@classmethod
def poll(cls, context):
return context.material and context.scene.render.engine == "PLASMA_GAME"
class PlasmaMaterialPanel(MaterialButtonsPanel, bpy.types.Panel): class PlasmaMaterialPanel(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Plasma Material Options" bl_label = "Plasma Material Options"
def draw(self, context): def draw(self, context):
material = context.material, getattr(context, "material_slot", None) mat, slot = context.material, getattr(context, "material_slot", None)
mat_props = material.plasma_material mat_props = mat.plasma_mat
layout = self.layout layout = self.layout
split = layout.split() split = layout.split()
col = split.column() col = split.column()
sub = col.column() sub = col.column()
col.prop(mat_props, "plasma_double_sided") col.prop(mat_props, "plasma_double_sided")

Loading…
Cancel
Save