Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-02-19 23:12:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-02-19 23:12:36 +0400
commitb2956ecd00c37836b72637bcda0fbb2c05f35888 (patch)
tree73b975d85262b9f3dc31b0ac611b3e266a8d0f14 /release/scripts/modules
parentafc56a0b10b52d2c8bdfd44257624d776db72f79 (diff)
parentdc68210c7e432cf313721541e639426dd94f2dfb (diff)
BMesh Merge
=========== initial merge from BMesh branch, this replaces the existing mesh format and editmode data structures, for more info see: http://wiki.blender.org/index.php/Dev:2.6/Source/Modeling/BMesh this is the work of quite a few developers over the years. Key Contributors ================ * Geoffrey Bantle (aka) Briggs, original author. * Joe Eager (aka) joeedh More recently * Howard Trickey * Ender79 aka Ender79 :) What to Expect ============== In general blender shouldnt crash on files or totally fail to load scenes, painting tools etc have been tested to work. * its quite easy to make the tesselator fail (show holes, missing faces), with non planer ngons. * most modifiers are working fine but a few had to be re-written - bevel, array - array is much slower, bevel will probably be changed to match trunk soon. * NavMesh BGE feature isn't functional yet. * Some UV sticth tools still need porting. * hair doesnt work right on ngons yet. * many python scripts will break. * a python api to BMesh needs to be written still. (for todo's in code do a searh for BMESH_TODO)
Diffstat (limited to 'release/scripts/modules')
-rw-r--r--release/scripts/modules/bpy_types.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 088e239e9a5..c5dc07e493a 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -373,7 +373,8 @@ class Mesh(bpy_types.ID):
"""
self.vertices.add(len(vertices))
self.edges.add(len(edges))
- self.faces.add(len(faces))
+ self.loops.add(sum((len(f) for f in faces)))
+ self.polygons.add(len(faces))
vertices_flat = [f for v in vertices for f in v]
self.vertices.foreach_set("co", vertices_flat)
@@ -383,19 +384,15 @@ class Mesh(bpy_types.ID):
self.edges.foreach_set("vertices", edges_flat)
del edges_flat
- def treat_face(f):
- if len(f) == 3:
- if f[2] == 0:
- return f[2], f[0], f[1], 0
- else:
- return f[0], f[1], f[2], 0
- elif f[2] == 0 or f[3] == 0:
- return f[2], f[3], f[0], f[1]
- return f
-
- faces_flat = [v for f in faces for v in treat_face(f)]
- self.faces.foreach_set("vertices_raw", faces_flat)
- del faces_flat
+ # this is different in bmesh
+ loop_index = 0
+ for i, p in enumerate(self.polygons):
+ f = faces[i]
+ loop_len = len(f)
+ p.loop_start = loop_index
+ p.loop_total = loop_len
+ p.vertices = f
+ loop_index += loop_len
@property
def edge_keys(self):
@@ -445,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__ = ()