Browse Source

Add a Plasma Object toggle tool for dendwaler

pull/67/head
Adam Johnson 7 years ago
parent
commit
5ac7ac149a
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 16
      korman/operators/op_toolbox.py
  2. 2
      korman/ui/ui_toolbox.py

16
korman/operators/op_toolbox.py

@ -97,3 +97,19 @@ class PlasmaEnableTexturesOperator(ToolboxOperator, bpy.types.Operator):
continue
slot.use = True
return {"FINISHED"}
class PlasmaTogglePlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator):
bl_idname = "object.plasma_toggle_objects"
bl_label = "Toggle Plasma Objects"
bl_description = "Toggles the Plasma Object status of a selection"
@classmethod
def poll(cls, context):
return super().poll(context) and hasattr(bpy.context, "selected_objects")
def execute(self, context):
enable = not all((i.plasma_object.enabled for i in bpy.context.selected_objects))
for i in context.selected_objects:
i.plasma_object.enabled = enable
return {"FINISHED"}

2
korman/ui/ui_toolbox.py

@ -35,6 +35,8 @@ class PlasmaToolboxPanel(ToolboxPanel, bpy.types.Panel):
col.label("Plasma Objects:")
col.operator("object.plasma_enable_all_objects", icon="OBJECT_DATA", text="Enable All")
all_plasma_objects = all((i.plasma_object.enabled for i in bpy.context.selected_objects))
col.operator("object.plasma_toggle_objects", icon="VIEW3D", text="Disable Selection" if all_plasma_objects else "Enable Selection")
col.label("Convert:")
col.operator("object.plasma_convert_plasma_objects", icon="OBJECT_DATA", text="Plasma Objects")

Loading…
Cancel
Save