diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-29 06:54:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-30 04:27:36 +0300 |
commit | 5a2c3d67f7f61caea570f139219ddb760da51325 (patch) | |
tree | 26fee46d2f9ccf38f48cd96b48e7d9aa4d8ff9e4 /io_export_dxf | |
parent | 38e90857d82644b6b29bfd1e12a52835684eb8b8 (diff) |
DXF Exporter: support module reloading
Also remove use of register_module
Diffstat (limited to 'io_export_dxf')
-rw-r--r-- | io_export_dxf/__init__.py | 40 | ||||
-rw-r--r-- | io_export_dxf/export_dxf.py | 18 | ||||
-rw-r--r-- | io_export_dxf/operator.py | 24 |
3 files changed, 68 insertions, 14 deletions
diff --git a/io_export_dxf/__init__.py b/io_export_dxf/__init__.py index ab451bb1..254ffdae 100644 --- a/io_export_dxf/__init__.py +++ b/io_export_dxf/__init__.py @@ -1,9 +1,9 @@ -# ***** GPL LICENSE BLOCK ***** +# ##### BEGIN GPL LICENSE BLOCK ##### # -# This program 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. +# This program 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 2 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,9 +11,10 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# All rights reserved. -# ***** GPL LICENSE BLOCK ***** +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### bl_info = { "name": "Export Autocad DXF Format (.dxf)", @@ -28,20 +29,35 @@ bl_info = { "category": "Import-Export", } +if "bpy" in locals(): + from importlib import reload + reload(operator) + del reload import bpy -from .operator import DXFExporter +from . import operator def menu_func(self, context): - self.layout.operator(DXFExporter.bl_idname, text="Autocad (.dxf)") + self.layout.operator(operator.DXFExporter.bl_idname, text="Autocad (.dxf)") + +classes = ( + operator.DXFExporter, +) def register(): - bpy.utils.register_module(__name__) bpy.types.INFO_MT_file_export.append(menu_func) + from bpy.utils import register_class + for cls in classes: + register_class(cls) + + def unregister(): - bpy.utils.unregister_module(__name__) bpy.types.INFO_MT_file_export.remove(menu_func) + from bpy.utils import unregister_class + for cls in reversed(classes): + unregister_class(cls) + if __name__ == "__main__": register() diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py index a17f50f2..b6e51531 100644 --- a/io_export_dxf/export_dxf.py +++ b/io_export_dxf/export_dxf.py @@ -1,3 +1,21 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program 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 2 +# of the License, or (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + import os import mathutils diff --git a/io_export_dxf/operator.py b/io_export_dxf/operator.py index 3ba7de60..a2d9dcf7 100644 --- a/io_export_dxf/operator.py +++ b/io_export_dxf/operator.py @@ -1,7 +1,27 @@ - +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program 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 2 +# of the License, or (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### import bpy -from bpy.props import StringProperty, EnumProperty, BoolProperty +from bpy.props import ( + BoolProperty, + EnumProperty, + StringProperty, +) class DXFExporter(bpy.types.Operator): """ |