2
2
mirror of https://github.com/H-uru/korman.git synced 2025-07-17 02:51:18 +00:00

Blender addon skeleton

This commit is contained in:
2012-06-24 20:58:15 -04:00
parent 3673b8dfeb
commit 2587aca886
3 changed files with 719 additions and 0 deletions

43
korman/__init__.py Normal file
View File

@ -0,0 +1,43 @@
# 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
from . import exporter
bl_info = {
"name": "Korman",
"author": "Guild of Writers H'uru Team",
"blender": (2, 6, 3), # I can't be bothered to support old stuff
"location": "File > Import-Export",
"description": "Exporter for Cyan Worlds' Plasma Engine",
"warning": "alpha",
"category": "System", # Eventually, we will hide some of the default
# Blender panels (think materials)
}
def register():
"""Registers all Blender operators and GUI items in Korman"""
# This will auto-magically register all blender classes for us
# We will define a lot of them, methinks...
bpy.utils.register_module(__name__)
def unregister():
"""Unregisters all Blender operators and GUI items"""
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()

57
korman/exporter.py Normal file
View File

@ -0,0 +1,57 @@
# 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
from PyHSPlasma import *
class PlasmaExporter(bpy.types.Operator):
"""Exports ages for Cyan Worlds' Plasma Engine"""
bl_idname = "export.plasma_age"
bl_label = "Export Age"
# Export specific props
pl_version = bpy.props.EnumProperty(
name="Version",
description="Version of the Plasma Engine to target",
default="pots", # This should be changed when moul is easier to target!
items=[
("abm", "Ages Beyond Myst (63.11)", "Targets the original Uru (Live) game", 2),
("pots", "Path of the Shell (63.12)", "Targets the most recent offline expansion pack", 1),
("moul", "Myst Online: Uru Live (70.2)", "Targets the most recent online game", 0),
# I see no reason to even offer Myst 5...
]
)
@classmethod
def poll(cls, context):
return context.object is not None
def execute(self, context):
# TODO
return {"FINISHED"}
def invoke(self, context, event):
# Called when a user hits "export" from the menu
# We will prompt them for the export info, then call execute()
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
# Add the export operator to the Export menu :)
def menu_cb(self, context):
self.layout.operator_context = "INVOKE_DEFAULT"
self.layout.operator(PlasmaExporter.bl_idname, text="Plasma Age (.age)")
bpy.types.INFO_MT_file_export.append(menu_cb)