1# ##### BEGIN MIT LICENSE BLOCK ##### 2# Copyright (C) 2011 by Lih-Hern Pang 3 4# Permission is hereby granted, free of charge, to any person obtaining a copy 5# of this software and associated documentation files (the "Software"), to deal 6# in the Software without restriction, including without limitation the rights 7# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8# copies of the Software, and to permit persons to whom the Software is 9# furnished to do so, subject to the following conditions: 10 11# The above copyright notice and this permission notice shall be included in 12# all copies or substantial portions of the Software. 13 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20# THE SOFTWARE. 21# ##### END MIT LICENSE BLOCK ##### 22 23bl_info = { 24 "name": "Ogre Mesh Exporter", 25 "description": "Exports mesh and (skeletal/morph/pose) animations to Ogre3D format.", 26 "author": "Lih-Hern Pang", 27 "version": (2, 0, 3), 28 "blender": (2, 6, 4), 29 "api": 44136, 30 "location": "3D View Side Panel", 31 "warning": '', # used for warning icon and text in addons panel 32 "wiki_url": "http://www.ogre3d.org/tikiwiki/Blender+2.5+Exporter", 33 "tracker_url": "http://sourceforge.net/tracker/?group_id=2997&atid=302997", 34 "category": "Import-Export"} 35 36if "bpy" in locals(): 37 import imp 38 imp.reload(global_properties) 39 imp.reload(material_properties) 40 imp.reload(skeleton_properties) 41 imp.reload(mesh_properties) 42 imp.reload(main_exporter_panel) 43 imp.reload(log_manager) 44 #~ imp.reload(material_panel) 45 imp.reload(skeleton_panel) 46 imp.reload(skeleton_impl) 47 imp.reload(mesh_panel) 48 imp.reload(mesh_exporter) 49 imp.reload(mesh_impl) 50else: 51 from . import global_properties 52 from . import material_properties 53 from . import skeleton_properties 54 from . import mesh_properties 55 from . import main_exporter_panel 56 from . import log_manager 57 #~ from . import material_panel 58 from . import skeleton_panel 59 from . import skeleton_impl 60 from . import mesh_panel 61 from . import mesh_exporter 62 from . import mesh_impl 63 64import bpy, mathutils 65from bpy.props import PointerProperty 66from bpy.app.handlers import persistent 67from ogre_mesh_exporter.global_properties import GlobalProperties, loadStaticConfig 68from ogre_mesh_exporter.material_properties import MaterialProperties 69from ogre_mesh_exporter.skeleton_properties import SkeletonProperties 70from ogre_mesh_exporter.mesh_properties import MeshProperties 71from ogre_mesh_exporter.main_exporter_panel import MainExporterPanel 72 73@persistent 74def onBlendLoadHandler(dummy): 75 loadStaticConfig() 76 77# registering and menu integration 78def register(): 79 bpy.utils.register_module(__name__) 80 81 # initialize the global properties group. 82 bpy.types.Scene.ogre_mesh_exporter = PointerProperty( 83 name = "Ogre Mesh Exporter properties", 84 type = GlobalProperties, 85 description = "Ogre Mesh Exporter properties" 86 ) 87 88 bpy.types.Material.ogre_mesh_exporter = PointerProperty( 89 name = "Ogre Mesh Exporter properties", 90 type = MaterialProperties, 91 description = "Ogre Mesh Exporter properties" 92 ) 93 94 bpy.types.Armature.ogre_mesh_exporter = PointerProperty( 95 name = "Ogre Mesh Exporter properties", 96 type = SkeletonProperties, 97 description = "Ogre Mesh Exporter properties" 98 ) 99 100 bpy.types.Mesh.ogre_mesh_exporter = PointerProperty( 101 name = "Ogre Mesh Exporter properties", 102 type = MeshProperties, 103 description = "Ogre Mesh Exporter properties" 104 ) 105 106 # register scene update callback. 107 # NOTE: This is for a hack to allow us to list selected objects on the fly. 108 # SEE: MainExporterPanel.refreshSelection in mesh_exporter_panel.py 109 bpy.app.handlers.scene_update_pre.append(MainExporterPanel.refreshSelection) 110 bpy.app.handlers.load_post.append(onBlendLoadHandler) 111 112# unregistering and removing menus 113def unregister(): 114 bpy.utils.unregister_module(__name__) 115 116 # unregister scene update callback. 117 # NOTE: This is for a hack to allow us to list selected objects on the fly. 118 # SEE: MainExporterPanel.refreshSelection in mesh_exporter_panel.py 119 bpy.app.handlers.scene_update_pre.remove(MainExporterPanel.refreshSelection) 120 bpy.app.handlers.load_post.remove(onBlendLoadHandler) 121 122if __name__ == "__main__": 123 register() 124