diff --git a/korman/operators/op_toolbox.py b/korman/operators/op_toolbox.py index 3b34522..8df708a 100644 --- a/korman/operators/op_toolbox.py +++ b/korman/operators/op_toolbox.py @@ -14,6 +14,7 @@ # along with Korman. If not, see . import bpy +from bpy.props import * class ToolboxOperator: @classmethod @@ -70,17 +71,6 @@ class PlasmaConvertPlasmaObjectOperator(ToolboxOperator, bpy.types.Operator): return {"FINISHED"} -class PlasmaEnablePlasmaObjectOperator(ToolboxOperator, bpy.types.Operator): - bl_idname = "object.plasma_enable_all_objects" - bl_label = "Enable All Plasma Objects" - bl_description = "Marks all Objects as Plasma Objects for exporting" - - def execute(self, context): - for i in bpy.data.objects: - i.plasma_object.enabled = True - return {"FINISHED"} - - class PlasmaEnableTexturesOperator(ToolboxOperator, bpy.types.Operator): bl_idname = "texture.plasma_enable_all_textures" bl_label = "Enable All Textures" @@ -99,8 +89,21 @@ class PlasmaEnableTexturesOperator(ToolboxOperator, bpy.types.Operator): return {"FINISHED"} +class PlasmaToggleAllPlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator): + bl_idname = "object.plasma_toggle_all_objects" + bl_label = "Toggle All Plasma Objects" + bl_description = "Changes the state of all Plasma Objects" + + enable = BoolProperty(name="Enable", description="Enable Plasma Object") + + def execute(self, context): + for i in bpy.data.objects: + i.plasma_object.enabled = self.enable + return {"FINISHED"} + + class PlasmaTogglePlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator): - bl_idname = "object.plasma_toggle_objects" + bl_idname = "object.plasma_toggle_selected_objects" bl_label = "Toggle Plasma Objects" bl_description = "Toggles the Plasma Object status of a selection" diff --git a/korman/ui/ui_toolbox.py b/korman/ui/ui_toolbox.py index 1d5297f..a73bc93 100644 --- a/korman/ui/ui_toolbox.py +++ b/korman/ui/ui_toolbox.py @@ -34,9 +34,12 @@ class PlasmaToolboxPanel(ToolboxPanel, bpy.types.Panel): col = layout.column(align=True) col.label("Plasma Objects:") - col.operator("object.plasma_enable_all_objects", icon="OBJECT_DATA", text="Enable All") + enable_all = col.operator("object.plasma_toggle_all_objects", icon="OBJECT_DATA", text="Enable All") + enable_all.enable = True 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.operator("object.plasma_toggle_selected_objects", icon="VIEW3D", text="Disable Selection" if all_plasma_objects else "Enable Selection") + disable_all = col.operator("object.plasma_toggle_all_objects", icon="OBJECT_DATA", text="Disable All") + disable_all.enable = False col.label("Convert:") col.operator("object.plasma_convert_plasma_objects", icon="OBJECT_DATA", text="Plasma Objects")