[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3253] trunk/py/scripts/addons/ add_mesh_extra_objects/add_mesh_pyramid.py: BMesh update.

Philip Cote cotejrp at gmail.com
Fri Apr 13 01:04:18 CEST 2012


Revision: 3253
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3253
Author:   cotejrp1
Date:     2012-04-12 23:04:17 +0000 (Thu, 12 Apr 2012)
Log Message:
-----------
BMesh update.

Modified Paths:
--------------
    trunk/py/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py

Modified: trunk/py/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py	2012-04-12 14:35:08 UTC (rev 3252)
+++ trunk/py/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py	2012-04-12 23:04:17 UTC (rev 3253)
@@ -22,8 +22,8 @@
 bl_info = {
     'name': 'Mesh Pyramid',
     'author': 'Phil Cote, cotejrp1, (http://www.blenderaddons.com)',
-    'version': (0, 3),
-    "blender": (2, 5, 8),
+    'version': (0, 4),
+    "blender": (2, 6, 3),
     'location': 'View3D > Add > Mesh',
     'description': 'Create an egyption-style step pyramid',
     'warning': '',  # used for warning icon and text in addons panel
@@ -31,6 +31,8 @@
 '''
 
 import bpy
+import bmesh
+
 from bpy.props import IntProperty, FloatProperty
 from bpy_extras.object_utils import AddObjectHelper, object_data_add
 
@@ -100,13 +102,20 @@
 def add_pyramid_object(self, context):
     verts, faces = makePyramid(self.initial_size, self.step_height,
                             self.step_width, self.number_steps)
+    bm = bmesh.new()
+    mesh = bpy.data.meshes.new(name="Pyramid")
+    
+    for vert in verts:
+        bm.verts.new(vert)
+    
+    for face in faces:
+        bm.faces.new([bm.verts[i] for i in face])
+    
+    bm.to_mesh(mesh)
+    mesh.update()
+    res = object_data_add(context, mesh, operator=self)
 
-    mesh_data = bpy.data.meshes.new(name="Pyramid")
-    mesh_data.from_pydata(verts, [], faces)
-    mesh_data.update()
-    res = object_data_add(context, mesh_data, operator=self)
 
-
 class AddPyramid(bpy.types.Operator, AddObjectHelper):
     """Add a Mesh Object"""
     bl_idname = "mesh.primitive_steppyramid_add"
@@ -150,4 +159,4 @@
 
 if __name__ == "__main__":
     register()
-'''
+'''
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list