unified nomenclature for connectivity data

This commit is contained in:
Stephen M. McQuay 2012-07-13 08:39:25 -06:00
parent 5e37668ecc
commit 3fb1c97403

View File

@ -1,5 +1,4 @@
import json
import bmesh
import bpy
from bpy_extras.io_utils import ExportHelper
@ -35,30 +34,30 @@ class SMBDumpMesh(bpy.types.Operator, ExportHelper):
data = {}
data['vertices'] = [list(vert.co) for vert in b.verts]
data['edges for vert'] = []
data['edges_for_vert'] = []
for vert in b.verts:
data['edges for vert'].append([e.index for e in vert.link_edges])
data['faces for vert'] = []
data['edges_for_vert'].append([e.index for e in vert.link_edges])
data['faces_for_vert'] = []
for vert in b.verts:
data['faces for vert'].append([e.index for e in vert.link_faces])
data['faces_for_vert'].append([e.index for e in vert.link_faces])
edges = []
for edge in b.edges:
edges.append([v.index for v in edge.verts])
data['edges'] = edges
data['faces for edge'] = []
data['faces_for_edge'] = []
for edge in b.edges:
data['faces for edge'].append([f.index for f in edge.link_faces])
data['faces_for_edge'].append([f.index for f in edge.link_faces])
faces = []
for face in b.faces:
faces.append([v.index for v in face.verts])
data['faces'] = faces
data['edges for face'] = []
data['edges_for_face'] = []
for face in b.faces:
data['edges for face'].append([e.index for e in face.edges])
data['edges_for_face'].append([e.index for e in face.edges])
json.dump(data, open(self.filepath, 'w'))
bpy.ops.object.mode_set(mode='OBJECT')