|
1 | | -# This script is licensed as public domain. |
2 | | - |
3 | | -# grouping to surfaces must done by UV maps |
| 1 | +# This program is free software: you can redistribute it and/or modify |
| 2 | +# it under the terms of the GNU General Public License as published by |
| 3 | +# the Free Software Foundation, either version 3 of the License, or |
| 4 | +# (at your option) any later version. |
| 5 | +# |
| 6 | +# This program is distributed in the hope that it will be useful, |
| 7 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 | +# GNU General Public License for more details. |
| 10 | +# |
| 11 | +# You should have received a copy of the GNU General Public License |
| 12 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 13 | + |
| 14 | + |
| 15 | +# grouping to surfaces must done by UV maps also, not only normals |
4 | 16 | # TODO: merge surfaces with same uv maps and texture |
5 | | -# TODO: add assertions on maxcounts (vertex, tris, etc) |
6 | | - |
7 | | -bl_info = { |
8 | | - "name": "Export Quake 3 Model (.md3)", |
9 | | - "author": "Vitalik Verhovodov", |
10 | | - "version": (0, 1, 0), |
11 | | - "blender": (2, 6, 9), |
12 | | - "location": "File > Export > Quake 3 Model", |
13 | | - "description": "Export to the Quake 3 Model format (.md3)", |
14 | | - "warning": "", |
15 | | - "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/MD3", |
16 | | - "tracker_url": "https://github.com/neumond/blender-md3/issues", |
17 | | - "category": "Import-Export"} |
| 17 | +# TODO: check bounding sphere calculation |
| 18 | + |
18 | 19 |
|
19 | 20 | import bpy |
20 | 21 | import mathutils |
21 | 22 | import struct |
22 | | -from bpy_extras.io_utils import ExportHelper |
23 | 23 | from math import atan2, acos, pi, sqrt |
24 | 24 | import re |
25 | 25 |
|
@@ -366,36 +366,3 @@ def exportMD3(context, filename): |
366 | 366 | raise Exception('Not all delayed write resolved: {}'.format(ctx['delayed'])) |
367 | 367 |
|
368 | 368 | print('nFrames={} nSurfaces={}'.format(nFrames, len(ctx['surfNames']))) |
369 | | - |
370 | | - |
371 | | -class ExportMD3(bpy.types.Operator, ExportHelper): |
372 | | - '''Export a Quake 3 Model MD3 file''' |
373 | | - bl_idname = "export.md3" |
374 | | - bl_label = 'Export MD3' |
375 | | - filename_ext = ".md3" |
376 | | - |
377 | | - def execute(self, context): |
378 | | - exportMD3(context, self.properties.filepath) |
379 | | - return {'FINISHED'} |
380 | | - |
381 | | - def check(self, context): |
382 | | - filepath = bpy.path.ensure_ext(self.filepath, '.md3') |
383 | | - if filepath != self.filepath: |
384 | | - self.filepath = filepath |
385 | | - return True |
386 | | - return False |
387 | | - |
388 | | - |
389 | | -def menu_func(self, context): |
390 | | - self.layout.operator(ExportMD3.bl_idname, text="Quake 3 Model (.md3)") |
391 | | - |
392 | | -def register(): |
393 | | - bpy.utils.register_module(__name__) |
394 | | - bpy.types.INFO_MT_file_export.append(menu_func) |
395 | | - |
396 | | -def unregister(): |
397 | | - bpy.utils.unregister_module(__name__) |
398 | | - bpy.types.INFO_MT_file_export.remove(menu_func) |
399 | | - |
400 | | -if __name__ == "__main__": |
401 | | - register() |
0 commit comments