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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Cote <cotejrp@gmail.com>2012-04-13 03:04:17 +0400
committerPhilip Cote <cotejrp@gmail.com>2012-04-13 03:04:17 +0400
commitd3e5e1b6c5054f6154868d961486b474aa81983f (patch)
tree22ff2b9dbea8b52f7cf1bd463cc97b5b7a3b1882 /add_mesh_extra_objects/add_mesh_pyramid.py
parenteb0b594d811a5840d67bcf8eb4845186695b6af9 (diff)
BMesh update.
Diffstat (limited to 'add_mesh_extra_objects/add_mesh_pyramid.py')
-rw-r--r--add_mesh_extra_objects/add_mesh_pyramid.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/add_mesh_extra_objects/add_mesh_pyramid.py b/add_mesh_extra_objects/add_mesh_pyramid.py
index 11875778..0b961b14 100644
--- a/add_mesh_extra_objects/add_mesh_pyramid.py
+++ b/add_mesh_extra_objects/add_mesh_pyramid.py
@@ -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 @@ bl_info = {
'''
import bpy
+import bmesh
+
from bpy.props import IntProperty, FloatProperty
from bpy_extras.object_utils import AddObjectHelper, object_data_add
@@ -100,11 +102,18 @@ def makePyramid(initial_size, step_height, step_width, number_steps):
def add_pyramid_object(self, context):
verts, faces = makePyramid(self.initial_size, self.step_height,
self.step_width, self.number_steps)
-
- 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)
+ 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)
class AddPyramid(bpy.types.Operator, AddObjectHelper):
@@ -150,4 +159,4 @@ def unregister():
if __name__ == "__main__":
register()
-'''
+''' \ No newline at end of file