From 9018d515d7a6d35718aa122509443c70523bb061 Mon Sep 17 00:00:00 2001 From: Florian Meyer Date: Sat, 18 Dec 2010 09:33:42 +0000 Subject: cleanup, set api nr --- add_curve_torus_knots.py | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'add_curve_torus_knots.py') diff --git a/add_curve_torus_knots.py b/add_curve_torus_knots.py index 9e6af7cb..3500642b 100644 --- a/add_curve_torus_knots.py +++ b/add_curve_torus_knots.py @@ -21,10 +21,10 @@ bl_addon_info = { "name": "Torus Knots", "author": "testscreenings", "version": (0,1), - "blender": (2, 5, 3), - "api": 32411, + "blender": (2, 5, 5), + "api": 33754, "location": "View3D > Add > Curve", - "description": "Adds many types of knots", + "description": "Adds many types of (torus) knots", "warning": "", "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\ "Scripts/Curve/Torus_Knot", @@ -37,24 +37,9 @@ bl_addon_info = { #### import modules import bpy from bpy.props import * -#from mathutils import * -from math import * +from math import sin, cos, pi from add_utils import * -##------------------------------------------------------------ -#### Curve creation functions - -def create_curve_data(verts): - curve_data = bpy.data.curves.new(name='Torus Knot', type='CURVE') - spline = curve_data.splines.new(type='NURBS') - spline.points.add(int(len(verts)*0.25 - 1)) - spline.points.foreach_set('co', verts) - spline.use_endpoint_u = True - spline.use_cyclic_u = True - spline.order_u = 4 - curve_data.dimensions = '3D' - - return curve_data ######################################################################## ####################### Knot Definitions ############################### @@ -92,7 +77,14 @@ def Torus_Knot(self): def create_torus_knot(self, context): verts = Torus_Knot(self) - curve_data = create_curve_data(verts) + curve_data = bpy.data.curves.new(name='Torus Knot', type='CURVE') + spline = curve_data.splines.new(type='NURBS') + spline.points.add(int(len(verts)*0.25 - 1)) + spline.points.foreach_set('co', verts) + spline.use_endpoint_u = True + spline.use_cyclic_u = True + spline.order_u = 4 + curve_data.dimensions = '3D' if self.geo_surf: curve_data.bevel_depth = self.geo_bDepth -- cgit v1.2.3