diff --git a/korman/operators/op_toolbox.py b/korman/operators/op_toolbox.py index 8df708a..a1dda66 100644 --- a/korman/operators/op_toolbox.py +++ b/korman/operators/op_toolbox.py @@ -102,6 +102,25 @@ class PlasmaToggleAllPlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator): return {"FINISHED"} +class PlasmaToggleEnvironmentMapsOperator(ToolboxOperator, bpy.types.Operator): + bl_idname = "texture.plasma_toggle_environment_maps" + bl_label = "Toggle Environment Maps" + bl_description = "Changes the state of all Environment Maps" + + enable = BoolProperty(name="Enable", description="Enable Environment Maps") + + def execute(self, context): + enable = self.enable + for material in bpy.data.materials: + for slot in material.texture_slots: + if slot is None: + continue + if slot.texture.type == "ENVIRONMENT_MAP": + slot.use = enable + return {"FINISHED"} + + + class PlasmaTogglePlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator): bl_idname = "object.plasma_toggle_selected_objects" bl_label = "Toggle Plasma Objects" diff --git a/korman/ui/ui_toolbox.py b/korman/ui/ui_toolbox.py index a73bc93..34117d4 100644 --- a/korman/ui/ui_toolbox.py +++ b/korman/ui/ui_toolbox.py @@ -41,7 +41,11 @@ class PlasmaToolboxPanel(ToolboxPanel, bpy.types.Panel): disable_all = col.operator("object.plasma_toggle_all_objects", icon="OBJECT_DATA", text="Disable All") disable_all.enable = False + col.label("Textures:") + col.operator("texture.plasma_enable_all_textures", icon="TEXTURE", text="Enable All") + col.operator("texture.plasma_toggle_environment_maps", icon="IMAGE_RGB", text="Enable All EnvMaps").enable = True + col.operator("texture.plasma_toggle_environment_maps", icon="IMAGE_RGB_ALPHA", text="Disable All EnvMaps").enable = False + col.label("Convert:") col.operator("object.plasma_convert_plasma_objects", icon="OBJECT_DATA", text="Plasma Objects") - col.operator("texture.plasma_enable_all_textures", icon="TEXTURE") col.operator("texture.plasma_convert_layer_opacities", icon="IMAGE_RGB_ALPHA", text="Layer Opacities")