From d3e5e1b6c5054f6154868d961486b474aa81983f Mon Sep 17 00:00:00 2001 From: Philip Cote Date: Thu, 12 Apr 2012 23:04:17 +0000 Subject: BMesh update. --- add_mesh_extra_objects/add_mesh_pyramid.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'add_mesh_extra_objects/add_mesh_pyramid.py') 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 -- cgit v1.2.3