diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-07-28 12:59:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-07-28 12:59:44 +0400 |
commit | 093bc787830529768e4d782917760e31ce9fd0bd (patch) | |
tree | 40da3fc180426d89a28d996d594fad6af699c3e9 /release/scripts/flt_import.py | |
parent | a7a328523597d1160a546a6e9826c86e213e8ce8 (diff) |
fixed flt_import problem adding materials to the mesh, made untextured faces not go pink.
removed mesh_bbrush, Not worth maintaining anymore with recent developments.
Diffstat (limited to 'release/scripts/flt_import.py')
-rwxr-xr-x | release/scripts/flt_import.py | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/release/scripts/flt_import.py b/release/scripts/flt_import.py index b4aa9d04676..5e1621320f8 100755 --- a/release/scripts/flt_import.py +++ b/release/scripts/flt_import.py @@ -810,10 +810,10 @@ class InterNode(Node): self.isMesh = False self.matrix = None +EDGE_FGON= Blender.Mesh.EdgeFlags['FGON'] +FACE_TEX= Blender.Mesh.FaceModes['TEX'] class Face(Node): def blender_import_face(self, material_index, image): - FGON= Blender.Mesh.EdgeFlags['FGON'] - mesh = self.parent.mesh mesh_vert_len_orig= len(mesh.verts) mesh.verts.extend([ self.header.vert_pal.blender_verts[i] for i in self.indices]) @@ -847,7 +847,8 @@ class Face(Node): f.mat = material_index if image: f.image = image - + else: + f.mode &= ~FACE_TEX # FGon if face_len>4: @@ -867,9 +868,7 @@ class Face(Node): if i1>i2: i1,i2= i2,i1 - try: - edge_dict[i1,i2] # if this works its an edge vert - except: + if not edge_dict.has_key( (i1,i2) ): # if this works its an edge vert fgon_edges[i1,i2]= None @@ -880,14 +879,12 @@ class Face(Node): if i1>i2: i1,i2= i2,i1 - try: + if fgon_edges.has_key( (i1,i2) ): + # This is an edge tagged for fgonning? fgon_edges[i1, i2] - ed.flag |= FGON + ed.flag |= EDGE_FGON del fgon_edges[i1, i2] # make later searches faster? - except: - pass - if not fgon_edges: break @@ -950,24 +947,29 @@ class Face(Node): # Add material to mesh. mesh = self.parent.mesh - try: - mesh.materials= mesh.materials+[mat] # not exactly optmil - #material_index = len(mesh.materials)-1 # ??? best to a proper check - except AttributeError: - pass - except TypeError: - if global_prefs['verbose'] >= 1: - print 'Warning: Too many materials per mesh object. Only a maximum of 16 ' + \ - 'allowed. Using 16th material instead.' - mat = mesh.materials[-1] - + # Return where it is in the mesh for faces. #material_index = mesh.materials.index(mat) - for i,m in enumerate(mesh.materials): + mesh_materials= mesh.materials + + material_index= -1 + for i,m in enumerate(mesh_materials): if m.name==mat.name: material_index= i break + if material_index==-1: + material_index= len(mesh_materials) + if material_index==15: + material_index= 15 + if global_prefs['verbose'] >= 1: + print 'Warning: Too many materials per mesh object. Only a maximum of 16 ' + \ + 'allowed. Using 16th material instead.' + + else: + mesh_materials.append(mat) + mesh.materials= mesh_materials + return (material_index, image) @@ -979,15 +981,6 @@ class Face(Node): return material = self.create_blender_material() - ''' - if vert_count > 4: - tri_lst = self.triangulate() - else: - tri_lst = [self.indices] - - for tri in tri_lst: - self.blender_import_face(tri, material[0], material[1]) - ''' self.blender_import_face(material[0], material[1]) # Store comment info in parent. @@ -1094,6 +1087,8 @@ class Object(InterNode): self.props['type'] = 'Object' self.props['id'] = self.header.fw.read_string(8) + + class Group(InterNode): def __init__(self, parent): Node.__init__(self, parent, parent.header) |