Add access to UVs from python, patch python unwrap scripts to work wtih ngons

This commit is contained in:
2011-11-17 05:03:07 +00:00
parent 3ed866d2fc
commit 1038c76c55
9 changed files with 639 additions and 311 deletions

View File

@@ -140,8 +140,7 @@ def edge_loops_from_faces(mesh, faces=None, seams=()):
edges = {}
for f in faces:
# if len(f) == 4:
if f.vertices_raw[3] != 0:
if len(f.vertices) == 4:
edge_keys = f.edge_keys
for i, edkey in enumerate(f.edge_keys):
edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])

View File

@@ -442,6 +442,20 @@ class MeshFace(StructRNA):
ord_ind(verts[3], verts[0]),
)
class MeshPolygon(StructRNA):
__slots__ = ()
@property
def edge_keys(self):
verts = self.vertices[:]
vlen = len(self.vertices)
return [ord_ind(verts[i], verts[(i+1) % vlen]) for i in range(vlen)]
@property
def loops(self):
start = self.loop_start
end = start + self.loop_total
return range(start, end)
class Text(bpy_types.ID):
__slots__ = ()