Skip to content

Commit 746e286

Browse files
committed
Fixes to Panel and Toolbox
More adjustments to get the dang thing working
1 parent cefae99 commit 746e286

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

korman/operators/op_toolbox.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,21 @@ def execute(self, context):
174174

175175

176176
class PlasmaToggleDoubleSidedOperator(ToolboxOperator, bpy.types.Operator):
177-
bl_idname = "mesh.plasma_toggle_double_sided"
177+
bl_idname = "mat.plasma_toggle_double_sided"
178178
bl_label = "Toggle All Double Sided"
179-
bl_description = "Toggles all materials to be double sided (NOT RECOMMENDED)"
179+
bl_description = "Toggles all materials to be double sided"
180180

181181
enable = BoolProperty(name="Enable", description="Enable Double Sided")
182182

183183
def execute(self, context):
184184
enable = self.enable
185185
for mat in bpy.data.materials:
186-
mat.plasma_material.plasma_double_sided = enable
186+
mat.plasma_mat.plasma_double_sided = enable
187187
return {"FINISHED"}
188188

189189

190190
class PlasmaToggleDoubleSidedSelectOperator(ToolboxOperator, bpy.types.Operator):
191-
bl_idname = "mesh.plasma_toggle_double_sided_selected"
191+
bl_idname = "mat.plasma_toggle_double_sided_selected"
192192
bl_label = "Toggle Selected Double Sided"
193193
bl_description = "Toggles selected meshes' material(s) double sided value"
194194

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

199199
def execute(self, context):
200200
mat_list = [i.data for i in context.selected_objects if i.type == "MATERIAL"]
201-
enable = not all((mat.plasma_material.plasma_double_sided for mat in mat_list))
201+
enable = not all((mat.plasma_mat.plasma_double_sided for mat in mat_list))
202202
for mat in mat_list:
203-
mat.plasma_material.plasma_double_sided = enable
203+
mat.plasma_mat.plasma_double_sided = enable
204204
return {"FINISHED"}
205205

206206

korman/properties/prop_material.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
from .. import idprops
2020

2121
class PlasmaMaterial(bpy.types.PropertyGroup):
22-
bl_name = "material.plasma_material"
22+
bl_idname = "mat.plasma_mat"
2323

24-
plasma_double_sided = BoolProperty(name="Double Sided",
25-
description="Sets this material as double sided (formerly TWOSIDE)",
26-
default=False)
27-
24+
plasma_double_sided = BoolProperty(name="Double Sided",
25+
description="Sets this material as double sided (formerly TWOSIDE)",
26+
default=False)
2827

korman/ui/ui_material.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,24 @@
1919

2020
class MaterialButtonsPanel:
2121
bl_space_type = "PROPERTIES"
22-
bl_region_type = "WINDOW"
23-
bl_context = "material"
22+
bl_region_type = "WINDOW"
23+
bl_context = "material"
24+
25+
@classmethod
26+
def poll(cls, context):
27+
return context.material and context.scene.render.engine == "PLASMA_GAME"
2428

2529

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

29-
def draw(self, context):
30-
material = context.material, getattr(context, "material_slot", None)
31-
mat_props = material.plasma_material
32-
layout = self.layout
33-
34-
split = layout.split()
35-
col = split.column()
36-
sub = col.column()
37-
col.prop(mat_props, "plasma_double_sided")
33+
def draw(self, context):
34+
mat, slot = context.material, getattr(context, "material_slot", None)
35+
mat_props = mat.plasma_mat
36+
layout = self.layout
37+
38+
split = layout.split()
39+
col = split.column()
40+
sub = col.column()
41+
col.prop(mat_props, "plasma_double_sided")
3842

0 commit comments

Comments
 (0)