unified nomenclature for connectivity data
This commit is contained in:
parent
5e37668ecc
commit
3fb1c97403
@ -1,5 +1,4 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import bmesh
|
import bmesh
|
||||||
import bpy
|
import bpy
|
||||||
from bpy_extras.io_utils import ExportHelper
|
from bpy_extras.io_utils import ExportHelper
|
||||||
@ -35,30 +34,30 @@ class SMBDumpMesh(bpy.types.Operator, ExportHelper):
|
|||||||
data = {}
|
data = {}
|
||||||
data['vertices'] = [list(vert.co) for vert in b.verts]
|
data['vertices'] = [list(vert.co) for vert in b.verts]
|
||||||
|
|
||||||
data['edges for vert'] = []
|
data['edges_for_vert'] = []
|
||||||
for vert in b.verts:
|
for vert in b.verts:
|
||||||
data['edges for vert'].append([e.index for e in vert.link_edges])
|
data['edges_for_vert'].append([e.index for e in vert.link_edges])
|
||||||
data['faces for vert'] = []
|
data['faces_for_vert'] = []
|
||||||
for vert in b.verts:
|
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 = []
|
edges = []
|
||||||
for edge in b.edges:
|
for edge in b.edges:
|
||||||
edges.append([v.index for v in edge.verts])
|
edges.append([v.index for v in edge.verts])
|
||||||
data['edges'] = edges
|
data['edges'] = edges
|
||||||
|
|
||||||
data['faces for edge'] = []
|
data['faces_for_edge'] = []
|
||||||
for edge in b.edges:
|
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 = []
|
faces = []
|
||||||
for face in b.faces:
|
for face in b.faces:
|
||||||
faces.append([v.index for v in face.verts])
|
faces.append([v.index for v in face.verts])
|
||||||
data['faces'] = faces
|
data['faces'] = faces
|
||||||
|
|
||||||
data['edges for face'] = []
|
data['edges_for_face'] = []
|
||||||
for face in b.faces:
|
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'))
|
json.dump(data, open(self.filepath, 'w'))
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
|
Loading…
Reference in New Issue
Block a user