[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1288] trunk/py/scripts/addons/ add_curve_torus_knots.py: cleanup, set api nr

Florian Meyer florianfelix at web.de
Sat Dec 18 10:33:42 CET 2010


Revision: 1288
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1288
Author:   testscreenings
Date:     2010-12-18 10:33:42 +0100 (Sat, 18 Dec 2010)

Log Message:
-----------
cleanup, set api nr

Modified Paths:
--------------
    trunk/py/scripts/addons/add_curve_torus_knots.py

Modified: trunk/py/scripts/addons/add_curve_torus_knots.py
===================================================================
--- trunk/py/scripts/addons/add_curve_torus_knots.py	2010-12-17 22:57:12 UTC (rev 1287)
+++ trunk/py/scripts/addons/add_curve_torus_knots.py	2010-12-18 09:33:42 UTC (rev 1288)
@@ -21,10 +21,10 @@
     "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,25 +37,10 @@
 #### 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 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




More information about the Bf-extensions-cvs mailing list