diff --git a/korman/operators/__init__.py b/korman/operators/__init__.py index f0c38fe..65305c0 100644 --- a/korman/operators/__init__.py +++ b/korman/operators/__init__.py @@ -16,6 +16,7 @@ from . import op_export as exporter from . import op_lightmap as lightmap from . import op_modifier as modifier +from . import op_toolbox as toolbox from . import op_world as world def register(): diff --git a/korman/operators/op_toolbox.py b/korman/operators/op_toolbox.py new file mode 100644 index 0000000..3e52d3a --- /dev/null +++ b/korman/operators/op_toolbox.py @@ -0,0 +1,50 @@ +# This file is part of Korman. +# +# Korman is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Korman is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Korman. If not, see . + +import bpy + +class ToolboxOperator: + @classmethod + def poll(cls, context): + return context.scene.render.engine == "PLASMA_GAME" + + +class PlasmaEnablePlasmaObjectOperator(ToolboxOperator, bpy.types.Operator): + bl_idname = "object.plasma_enable_all_objects" + bl_label = "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 = "Textures" + bl_description = "Ensures that all Textures are enabled" + + def execute(self, context): + for mesh in bpy.data.meshes: + for material in mesh.materials: + if material is None: + continue + + for slot in material.texture_slots: + if slot is None: + continue + slot.use = True + return {"FINISHED"} diff --git a/korman/ui/__init__.py b/korman/ui/__init__.py index 1416d1e..0c04b5e 100644 --- a/korman/ui/__init__.py +++ b/korman/ui/__init__.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with Korman. If not, see . -from .ui_object import * from .ui_modifiers import * +from .ui_object import * +from .ui_toolbox import * from .ui_world import * diff --git a/korman/ui/ui_toolbox.py b/korman/ui/ui_toolbox.py new file mode 100644 index 0000000..af25c12 --- /dev/null +++ b/korman/ui/ui_toolbox.py @@ -0,0 +1,38 @@ +# This file is part of Korman. +# +# Korman is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Korman is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Korman. If not, see . + +import bpy + +class ToolboxPanel: + bl_category = "Tools" + bl_space_type = "VIEW_3D" + bl_region_type = "TOOLS" + + @classmethod + def poll(cls, context): + return context.object and context.scene.render.engine == "PLASMA_GAME" + + +class PlasmaToolboxPanel(ToolboxPanel, bpy.types.Panel): + bl_context = "objectmode" + bl_label = "Plasma" + + def draw(self, context): + layout = self.layout + col = layout.column(align=True) + + col.label("Enable All:") + col.operator("object.plasma_enable_all_objects", icon="OBJECT_DATA") + col.operator("texture.plasma_enable_all_textures", icon="TEXTURE")