Browse Source

Add a Disable All tool for Plasma Objects

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

27
korman/operators/op_toolbox.py

@ -14,6 +14,7 @@
# along with Korman. If not, see <http://www.gnu.org/licenses/>.
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"

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

Loading…
Cancel
Save