Skip to content

Commit

Permalink
Fixes to Panel and Toolbox
Browse files Browse the repository at this point in the history
More adjustments to get the dang thing working
  • Loading branch information
DoobesURU committed Aug 20, 2021
1 parent cefae99 commit 746e286
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
12 changes: 6 additions & 6 deletions korman/operators/op_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,21 @@ def execute(self, context):


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_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")

def execute(self, context):
enable = self.enable
for mat in bpy.data.materials:
mat.plasma_material.plasma_double_sided = enable
mat.plasma_mat.plasma_double_sided = enable
return {"FINISHED"}


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_description = "Toggles selected meshes' material(s) double sided value"

Expand All @@ -198,9 +198,9 @@ def poll(cls, context):

def execute(self, context):
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:
mat.plasma_material.plasma_double_sided = enable
mat.plasma_mat.plasma_double_sided = enable
return {"FINISHED"}


Expand Down
9 changes: 4 additions & 5 deletions korman/properties/prop_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
from .. import idprops

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)

26 changes: 15 additions & 11 deletions korman/ui/ui_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@

class MaterialButtonsPanel:
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "material"
bl_region_type = "WINDOW"
bl_context = "material"

@classmethod
def poll(cls, context):
return context.material and context.scene.render.engine == "PLASMA_GAME"


class PlasmaMaterialPanel(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Plasma Material Options"

def draw(self, context):
material = context.material, getattr(context, "material_slot", None)
mat_props = material.plasma_material
layout = self.layout
split = layout.split()
col = split.column()
sub = col.column()
col.prop(mat_props, "plasma_double_sided")
def draw(self, context):
mat, slot = context.material, getattr(context, "material_slot", None)
mat_props = mat.plasma_mat
layout = self.layout

split = layout.split()
col = split.column()
sub = col.column()
col.prop(mat_props, "plasma_double_sided")

0 comments on commit 746e286

Please sign in to comment.