Browse Source

Add enable/disable envmap toolbox operators

pull/125/head
Adam Johnson 6 years ago
parent
commit
e7a42e6c2e
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 19
      korman/operators/op_toolbox.py
  2. 6
      korman/ui/ui_toolbox.py

19
korman/operators/op_toolbox.py

@ -102,6 +102,25 @@ class PlasmaToggleAllPlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator):
return {"FINISHED"} 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): class PlasmaTogglePlasmaObjectsOperator(ToolboxOperator, bpy.types.Operator):
bl_idname = "object.plasma_toggle_selected_objects" bl_idname = "object.plasma_toggle_selected_objects"
bl_label = "Toggle Plasma Objects" bl_label = "Toggle Plasma Objects"

6
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 = col.operator("object.plasma_toggle_all_objects", icon="OBJECT_DATA", text="Disable All")
disable_all.enable = False 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.label("Convert:")
col.operator("object.plasma_convert_plasma_objects", icon="OBJECT_DATA", text="Plasma Objects") 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") col.operator("texture.plasma_convert_layer_opacities", icon="IMAGE_RGB_ALPHA", text="Layer Opacities")

Loading…
Cancel
Save