mirror of https://github.com/H-uru/korman.git
Browse Source
As requested by Doobes, we now have buttons that enable Plasma Object on everything and all Textures. These are mostly useful for the case of updating from PyPRP, which was opt-out and totally ignored the checked-ness of Textures.pull/9/head
Adam Johnson
10 years ago
4 changed files with 91 additions and 1 deletions
@ -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 <http://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
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"} |
@ -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 <http://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
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") |
Loading…
Reference in new issue