diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-03-27 13:10:05 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-03-27 13:10:05 +0400 |
commit | b37387d3b04bdee8a262378282b94c86988eece9 (patch) | |
tree | 17c1778e564e574f70501e172264e4cdb93cecc4 /release | |
parent | 730e2f582f391770dfeedd95e790758afd5c4d53 (diff) |
Port Setup Tracking scene to bmesh api
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/clip.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 422a6279cb4..a049195fd89 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -716,11 +716,16 @@ class CLIP_OT_setup_tracking_scene(Operator): mesh.vertices.add(len(vertices)) mesh.vertices.foreach_set("co", unpack_list(vertices)) - # BMESH_TODO - use polygons - mesh.tessfaces.add(len(faces)) - mesh.tessfaces.foreach_set("vertices_raw", unpack_face_list(faces)) + nbr_loops = len(faces) + nbr_polys = nbr_loops // 4 + mesh.loops.add(nbr_loops) + mesh.polygons.add(nbr_polys) - mesh.update(calc_edges=True) + mesh.polygons.foreach_set("loop_start", range(0, nbr_loops, 4)) + mesh.polygons.foreach_set("loop_total", (4,) * nbr_polys) + mesh.loops.foreach_set("vertex_index", faces) + + mesh.update() ob = bpy.data.objects.new(name=name, object_data=mesh) @@ -738,7 +743,7 @@ class CLIP_OT_setup_tracking_scene(Operator): def _createGround(self, scene): vertices = self._getPlaneVertices(4.0, 0.0) - faces = [(0, 1, 2, 3)] + faces = [0, 1, 2, 3] ob = self._createMesh(scene, "Ground", vertices, faces) ob["is_ground"] = True @@ -776,12 +781,12 @@ class CLIP_OT_setup_tracking_scene(Operator): def _createSampleObject(self, scene): vertices = self._getPlaneVertices(1.0, -1.0) + \ self._getPlaneVertices(1.0, 1.0) - faces = ((0, 1, 2, 3), - (4, 7, 6, 5), - (0, 4, 5, 1), - (1, 5, 6, 2), - (2, 6, 7, 3), - (3, 7, 4, 0)) + faces = (0, 1, 2, 3, + 4, 7, 6, 5, + 0, 4, 5, 1, + 1, 5, 6, 2, + 2, 6, 7, 3, + 3, 7, 4, 0) return self._createMesh(scene, "Cube", vertices, faces) |