[Bf-extensions-cvs] [7c873a0] master: Removing Quake3 map support

Campbell Barton noreply at git.blender.org
Fri May 9 02:35:56 CEST 2014


Commit: 7c873a00e9751fd172f57227f668cceb4ef80a72
Author: Campbell Barton
Date:   Fri May 9 10:33:40 2014 +1000
https://developer.blender.org/rBA7c873a00e9751fd172f57227f668cceb4ef80a72

Removing Quake3 map support

The format is old and each engine seems to have different versions of the spec,
which makes it hard to support well.

===================================================================

D	io_scene_map/__init__.py
D	io_scene_map/export_map.py

===================================================================

diff --git a/io_scene_map/__init__.py b/io_scene_map/__init__.py
deleted file mode 100644
index a589e76..0000000
--- a/io_scene_map/__init__.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# ##### 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 #####
-
-# <pep8 compliant>
-
-bl_info = {
-    "name": "Quake MAP format",
-    "author": "Campbell Barton",
-    "blender": (2, 57, 0),
-    "location": "File > Export",
-    "description": "Export MAP brushes, nurbs surfaces, "
-                   "lamps and empties as map nodes",
-    "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
-                "Scripts/Import-Export/Quake_MAP",
-    "tracker_url": "",
-    "support": 'OFFICIAL',
-    "category": "Import-Export"}
-
-# To support reload properly, try to access a package var, if it's there, reload everything
-if "bpy" in locals():
-    import imp
-    if "export_map" in locals():
-        imp.reload(export_map)
-
-
-import bpy
-from bpy.props import StringProperty, FloatProperty, BoolProperty
-from bpy_extras.io_utils import ExportHelper
-
-
-class ExportMAP(bpy.types.Operator, ExportHelper):
-    """Export selection to a quake map"""
-    bl_idname = "export_scene.quake_map"
-    bl_label = "Export MAP"
-    bl_options = {'PRESET'}
-
-    filename_ext = ".map"
-    filter_glob = StringProperty(default="*.map", options={'HIDDEN'})
-
-    face_thickness = FloatProperty(
-            name="Face Thickness",
-            description=("Thickness given to geometry which can't be "
-                         "converted into a brush"),
-            min=0.0001, max=10.0,
-            default=0.1,
-            )
-    global_scale = FloatProperty(
-            name="Scale",
-            description="Scale everything by this value",
-            min=0.01, max=1000.0,
-            default=100.0,
-            )
-    grid_snap = BoolProperty(
-            name="Grid Snap",
-            description="Round to whole numbers",
-            default=False,
-            )
-    texture_null = StringProperty(
-            name="Tex Null",
-            description="Texture used when none is assigned",
-            default="NULL",
-            )
-    texture_opts = StringProperty(
-            name="Tex Opts",
-            description="Brush texture options",
-            default='0 0 0 1 1 0 0 0',
-            )
-
-    def execute(self, context):
-        # import math
-        # from mathutils import Matrix
-        if not self.filepath:
-            raise Exception("filepath not set")
-
-        '''
-        global_matrix = Matrix()
-        global_matrix[0][0] = global_matrix[1][1] = global_matrix[2][2] = self.global_scale
-        global_matrix = global_matrix * axis_conversion(to_forward=self.axis_forward, to_up=self.axis_up).to_4x4()
-
-        keywords = self.as_keywords(ignore=("axis_forward", "axis_up", "global_scale", "check_existing", "filter_glob"))
-        keywords["global_matrix"] = global_matrix
-        '''
-
-        keywords = self.as_keywords(ignore=("check_existing", "filter_glob"))
-
-        from . import export_map
-        return export_map.save(self, context, **keywords)
-
-
-def menu_func(self, context):
-    self.layout.operator(ExportMAP.bl_idname, text="Quake MAP (.map)")
-
-
-def register():
-    bpy.utils.register_module(__name__)
-
-    bpy.types.INFO_MT_file_export.append(menu_func)
-
-
-def unregister():
-    bpy.utils.unregister_module(__name__)
-
-    bpy.types.INFO_MT_file_export.remove(menu_func)
-
-if __name__ == "__main__":
-    register()
diff --git a/io_scene_map/export_map.py b/io_scene_map/export_map.py
deleted file mode 100644
index 2b40798..0000000
--- a/io_scene_map/export_map.py
+++ /dev/null
@@ -1,508 +0,0 @@
-# ##### 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 #####
-
-# <pep8-80 compliant>
-
-import bpy
-import os
-
-# TODO, make options
-PREF_SCALE = 100
-PREF_FACE_THICK = 0.1
-PREF_GRID_SNAP = False
-# Quake 1/2?
-# Quake 3+?
-PREF_DEF_TEX_OPTS = '0 0 0 1 1 0 0 0'  # not user settable yet
-
-PREF_NULL_TEX = 'NULL'  # not user settable yet
-PREF_INVIS_TEX = 'common/caulk'
-
-
-def face_uv_get(face):
-    """ Workaround 2.5x change.
-    """
-    me = face.id_data
-    uv_faces = me.uv_textures.active
-    if uv_faces:
-        return uv_faces.data[face.index]
-    else:
-        return None
-
-
-def face_material_get(face):
-    me = face.id_data
-    try:
-        return me.materials[face.material_index]
-    except:
-        return None
-
-
-def write_cube2brush(file, faces):
-    """
-    Takes 6 faces and writes a brush,
-    these faces can be from 1 mesh, 1 cube within a mesh of larger cubes
-    Faces could even come from different meshes or be contrived.
-    """
-    # comment only
-    # file.write('// brush "%s", "%s"\n' % (ob.name, ob.data.name))
-    file.write('// brush from cube\n{\n')
-
-    if PREF_GRID_SNAP:
-        format_vec = '( %d %d %d ) '
-    else:
-        format_vec = '( %.8f %.8f %.8f ) '
-
-    for f in faces:
-        # from 4 verts this gets them in reversed order and only 3 of them
-        # 0,1,2,3 -> 2,1,0
-        me = f.id_data  # XXX25
-        for v in f.vertices[:][2::-1]:
-            file.write(format_vec % me.vertices[v].co[:])
-
-        material = face_material_get(f)
-
-        if material and material.game_settings.invisible:
-            file.write(PREF_INVIS_TEX)
-        else:
-            uf = face_uv_get(f)
-
-            image = uf.image if uf else None
-
-            if image:
-                file.write(os.path.splitext(
-                        bpy.path.basename(image.filepath))[0])
-            else:
-                file.write(PREF_NULL_TEX)
-
-        # Texture stuff ignored for now
-        file.write(" %s\n" % PREF_DEF_TEX_OPTS)
-    file.write('}\n')
-
-
-def round_vec(v):
-    if PREF_GRID_SNAP:
-        return v.to_tuple(0)
-    else:
-        return v[:]
-
-
-def write_face2brush(file, face):
-    """
-    takes a face and writes it as a brush
-    each face is a cube/brush
-    """
-
-    if PREF_GRID_SNAP:
-        format_vec = '( %d %d %d ) '
-    else:
-        format_vec = '( %.8f %.8f %.8f ) '
-
-    image_text = PREF_NULL_TEX
-
-    material = face_material_get(face)
-
-    if material and material.game_settings.invisible:
-        image_text = PREF_INVIS_TEX
-    else:
-        uf = face_uv_get(face)
-
-        image = uf.image if uf else None
-
-        if image:
-            image_text = os.path.splitext(bpy.path.basename(image.filepath))[0]
-
-    # reuse face vertices
-    _v = face.id_data.vertices  # XXX25
-    f_vertices = [_v[vi] for vi in face.vertices]
-    del _v  # XXX25
-
-    # original verts as tuples for writing
-    orig_vco = [v.co[:] for v in f_vertices]
-
-    # new verts that give the face a thickness
-    dist = PREF_SCALE * PREF_FACE_THICK
-    new_vco = [round_vec(v.co - (v.normal * dist)) for v in f_vertices]
-    #new_vco = [round_vec(v.co - (face.no * dist)) for v in face]
-
-    file.write('// brush from face\n{\n')
-    # front
-    for co in orig_vco[2::-1]:
-        file.write(format_vec % co)
-    file.write(image_text)
-    # Texture stuff ignored for now
-    file.write(" %s\n" % PREF_DEF_TEX_OPTS)
-
-    for co in new_vco[:3]:
-        file.write(format_vec % co)
-    if uf and uf.use_twoside:
-        file.write(image_text)
-    else:
-        file.write(PREF_INVIS_TEX)
-
-    # Texture stuff ignored for now
-    file.write(" %s\n" % PREF_DEF_TEX_OPTS)
-
-    # sides.
-    if len(orig_vco) == 3:  # Tri, it seemms tri brushes are supported.
-        index_pairs = ((0, 1), (1, 2), (2, 0))
-    else:
-        index_pairs = ((0, 1), (1, 2), (2, 3), (3, 0))
-
-    for i1, i2 in index_pairs:
-        for co in orig_vco[i1], orig_vco[i2], new_vco[i2]:
-            file.write(format_vec % co)
-        file.write(PREF_INVIS_TEX)
-        file.write(" %s\n" % PREF_DEF_TEX_OPTS)
-
-    file.write('}\n')
-
-
-def is_cube_facegroup(faces):
-    """
-    Returns a bool, true if the faces make up a cube
-    """
-    # cube must have 6 faces
-    if len(faces) != 6:
-        # print('1')
-        return False
-
-    # Check for quads and that there are 6 unique verts
-    verts = {}
-    for f in faces:
-        f_v = f.vertices[:]
-        if len(f_v) != 4:
-            return False
-
-        for v in f_v:
-            verts[v] = 0
-
-    if len(verts) != 8:
-        return False
-
-    # Now check that each vert has 3 face users
-    for f in faces:
-        f_v = f.vertices[:]
-        for v in f_v:
-            verts[v] += 1
-
-    for v in verts.values():
-        if v != 3:  # vert has 3 users?
-            return False
-
-    # Could we check for 12 unique edges??, probably not needed.
-    return True
-
-
-def is_tricyl_fa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list