[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1023] trunk/py/scripts/addons/ add_curve_torus_knots.py: == Torus Knot ==
Florian Meyer
florianfelix at web.de
Sat Sep 11 23:39:45 CEST 2010
Revision: 1023
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1023
Author: testscreenings
Date: 2010-09-11 23:39:44 +0200 (Sat, 11 Sep 2010)
Log Message:
-----------
== Torus Knot ==
- fixed the previously mentioned bug
- somehow setting the Curve.offset screwed things up
- simply removed it, wasn't used anyway
- updated api revision number
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-09-11 14:27:23 UTC (rev 1022)
+++ trunk/py/scripts/addons/add_curve_torus_knots.py 2010-09-11 21:39:44 UTC (rev 1023)
@@ -22,7 +22,7 @@
"author": "testscreenings",
"version": (0,1),
"blender": (2, 5, 3),
- "api": 31847,
+ "api": 31885,
"location": "View3D > Add > Curve",
"description": "Adds many types of knots",
"warning": "",
@@ -68,7 +68,7 @@
return vertArray
# create new CurveObject from vertarray and splineType
-def createCurve(vertArray, self, align_matrix):
+def createCurve(vertArray, props, align_matrix):
# options to vars
splineType = 'NURBS'
name = 'Torus_Knot'
@@ -89,14 +89,14 @@
newSpline.use_endpoint_u = True
newSpline.order_u = 4
- if self.geo_surf:
- newCurve.bevel_depth = self.geo_bDepth
- newCurve.bevel_resolution = self.geo_bRes
+ if props.geo_surf:
+ newCurve.bevel_depth = props.geo_bDepth
+ newCurve.bevel_resolution = props.geo_bRes
newCurve.use_fill_front = False
newCurve.use_fill_back = False
- newCurve.extrude = self.geo_extrude
- newCurve.offset = self.geo_width
- newCurve.resolution_u = self.geo_res
+ newCurve.extrude = props.geo_extrude
+ #newCurve.offset = props.geo_width # removed, somehow screws things up all of a sudden
+ newCurve.resolution_u = props.geo_res
# create object with newCurve
new_obj = bpy.data.objects.new(name, newCurve) # object
@@ -132,26 +132,26 @@
##------------------------------------------------------------
# Main Function
-def main(context, self, align_matrix):
+def main(context, props, align_matrix):
# deselect all objects
bpy.ops.object.select_all(action='DESELECT')
# get verts
- verts = Torus_Knot_Curve(self.torus_p,
- self.torus_q,
- self.torus_w,
- self.torus_res,
- self.torus_formula,
- self.torus_h,
- self.torus_u,
- self.torus_v,
- self.torus_rounds)
+ verts = Torus_Knot_Curve(props.torus_p,
+ props.torus_q,
+ props.torus_w,
+ props.torus_res,
+ props.torus_formula,
+ props.torus_h,
+ props.torus_u,
+ props.torus_v,
+ props.torus_rounds)
# turn verts into array
vertArray = vertsToPoints(verts)
# create object
- createCurve(vertArray, self, align_matrix)
+ createCurve(vertArray, props, align_matrix)
return
@@ -238,37 +238,38 @@
##### DRAW #####
def draw(self, context):
+ props = self.properties
layout = self.layout
# general options
col = layout.column()
- #col.prop(self.properties, 'KnotType') waits for more knottypes
+ #col.prop(props, 'KnotType') waits for more knottypes
col.label(text="Torus Knot Parameters")
# Parameters
box = layout.box()
- box.prop(self.properties, 'torus_res')
- box.prop(self.properties, 'torus_w')
- box.prop(self.properties, 'torus_h')
- box.prop(self.properties, 'torus_p')
- box.prop(self.properties, 'torus_q')
- box.prop(self.properties, 'options_plus')
- if self.options_plus:
- box.prop(self.properties, 'torus_u')
- box.prop(self.properties, 'torus_v')
- box.prop(self.properties, 'torus_rounds')
+ box.prop(props, 'torus_res')
+ box.prop(props, 'torus_w')
+ box.prop(props, 'torus_h')
+ box.prop(props, 'torus_p')
+ box.prop(props, 'torus_q')
+ box.prop(props, 'options_plus')
+ if props.options_plus:
+ box.prop(props, 'torus_u')
+ box.prop(props, 'torus_v')
+ box.prop(props, 'torus_rounds')
# surface Options
col = layout.column()
col.label(text="Geometry Options")
box = layout.box()
- box.prop(self.properties, 'geo_surf')
- if self.geo_surf:
- box.prop(self.properties, 'geo_bDepth')
- box.prop(self.properties, 'geo_bRes')
- box.prop(self.properties, 'geo_extrude')
- #box.prop(self.properties, 'geo_width') # not really good
- box.prop(self.properties, 'geo_res')
+ box.prop(props, 'geo_surf')
+ if props.geo_surf:
+ box.prop(props, 'geo_bDepth')
+ box.prop(props, 'geo_bRes')
+ box.prop(props, 'geo_extrude')
+ #box.prop(props, 'geo_width') # not really good
+ box.prop(props, 'geo_res')
##### POLL #####
@classmethod
@@ -281,12 +282,13 @@
undo = bpy.context.user_preferences.edit.use_global_undo
bpy.context.user_preferences.edit.use_global_undo = False
-
+ props = self.properties
+
if not self.options_plus:
self.torus_rounds = self.torus_p
# main function
- main(context, self, self.align_matrix)
+ main(context, props, self.align_matrix)
# restore pre operator undo state
bpy.context.user_preferences.edit.use_global_undo = undo
@@ -315,4 +317,4 @@
bpy.types.INFO_MT_curve_add.remove(torus_knot_plus_button)
if __name__ == "__main__":
- register()
+ register()
\ No newline at end of file
More information about the Bf-extensions-cvs
mailing list