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:
authormeta-androcto <meta.androcto1@gmail.com>2016-08-10 19:05:58 +0300
committermeta-androcto <meta.androcto1@gmail.com>2016-08-10 19:05:58 +0300
commita36c5cd168d917da46b6a6e773153adfeacf0bf7 (patch)
treece59445a3034ffe53fb0ef107c6b6cd32b949e1a /add_curve_extra_objects/add_curve_aceous_galore.py
parent69bda0309bbe6f63b08732955ad80ce51503cd4e (diff)
code cleanup: curve extra objects thanks @batfinger
Diffstat (limited to 'add_curve_extra_objects/add_curve_aceous_galore.py')
-rw-r--r--add_curve_extra_objects/add_curve_aceous_galore.py346
1 files changed, 174 insertions, 172 deletions
diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py
index 41bf4587..259660fb 100644
--- a/add_curve_extra_objects/add_curve_aceous_galore.py
+++ b/add_curve_extra_objects/add_curve_aceous_galore.py
@@ -31,8 +31,8 @@ bl_info = {
'''
-##------------------------------------------------------------
-#### import modules
+# ------------------------------------------------------------
+# import modules
import bpy
from bpy.props import (
BoolProperty,
@@ -51,11 +51,11 @@ from math import (
)
import mathutils.noise as Noise
from bpy.types import Operator
-###------------------------------------------------------------
-#### Some functions to use with others:
-###------------------------------------------------------------
+# ------------------------------------------------------------
+# Some functions to use with others:
+# ------------------------------------------------------------
-#------------------------------------------------------------
+# ------------------------------------------------------------
# Generate random number:
def randnum(low=0.0, high=1.0, seed=0):
"""
@@ -82,9 +82,9 @@ def randnum(low=0.0, high=1.0, seed=0):
return rnum
-#------------------------------------------------------------
+# ------------------------------------------------------------
# Make some noise:
-def vTurbNoise(x,y,z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0):
+def vTurbNoise(x, y, z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0):
"""
vTurbNoise((x,y,z), iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0 )
@@ -109,32 +109,34 @@ def vTurbNoise(x,y,z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0):
the generated turbulence vector.
(type=3-float list)
"""
- rand = randnum(-100,100,Seed)
- if Basis == 9: Basis = 14
+ rand = randnum(-100, 100, Seed)
+ if Basis == 9:
+ Basis = 14
vTurb = Noise.turbulence_vector((x/Size+rand, y/Size+rand, z/Size+rand), Depth, Hard, Basis)
tx = vTurb[0]*iScale
ty = vTurb[1]*iScale
tz = vTurb[2]*iScale
- return tx,ty,tz
+ return tx, ty, tz
#------------------------------------------------------------
# Axis: ( used in 3DCurve Turbulence )
-def AxisFlip(x,y,z, x_axis=1, y_axis=1, z_axis=1, flip=0 ):
+def AxisFlip(x, y, z, x_axis=1, y_axis=1, z_axis=1, flip=0):
if flip != 0:
flip *= -1
- else: flip = 1
+ else:
+ flip = 1
x *= x_axis*flip
y *= y_axis*flip
z *= z_axis*flip
- return x,y,z
+ return x, y, z
-###-------------------------------------------------------------------
-#### 2D Curve shape functions:
-###-------------------------------------------------------------------
+# -------------------------------------------------------------------
+# 2D Curve shape functions:
+# -------------------------------------------------------------------
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Profile: L, H, T, U, Z
def ProfileCurve(type=0, a=0.25, b=0.25):
"""
@@ -155,42 +157,42 @@ def ProfileCurve(type=0, a=0.25, b=0.25):
"""
newpoints = []
- if type ==1:
- ## H:
- a*=0.5
- b*=0.5
- newpoints = [ [ -1.0, 1.0, 0.0 ], [ -1.0+a, 1.0, 0.0 ],
- [ -1.0+a, b, 0.0 ], [ 1.0-a, b, 0.0 ], [ 1.0-a, 1.0, 0.0 ],
- [ 1.0, 1.0, 0.0 ], [ 1.0, -1.0, 0.0 ], [ 1.0-a, -1.0, 0.0 ],
- [ 1.0-a, -b, 0.0 ], [ -1.0+a, -b, 0.0 ], [ -1.0+a, -1.0, 0.0 ],
- [ -1.0, -1.0, 0.0 ] ]
- elif type ==2:
- ## T:
- a*=0.5
- newpoints = [ [ -1.0, 1.0, 0.0 ], [ 1.0, 1.0, 0.0 ],
- [ 1.0, 1.0-b, 0.0 ], [ a, 1.0-b, 0.0 ], [ a, -1.0, 0.0 ],
- [ -a, -1.0, 0.0 ], [ -a, 1.0-b, 0.0 ], [ -1.0, 1.0-b, 0.0 ] ]
- elif type ==3:
- ## U:
- a*=0.5
- newpoints = [ [ -1.0, 1.0, 0.0 ], [ -1.0+a, 1.0, 0.0 ],
- [ -1.0+a, -1.0+b, 0.0 ], [ 1.0-a, -1.0+b, 0.0 ], [ 1.0-a, 1.0, 0.0 ],
- [ 1.0, 1.0, 0.0 ], [ 1.0, -1.0, 0.0 ], [ -1.0, -1.0, 0.0 ] ]
- elif type ==4:
- ## Z:
- a*=0.5
- newpoints = [ [ -0.5, 1.0, 0.0 ], [ a, 1.0, 0.0 ],
- [ a, -1.0+b, 0.0 ], [ 1.0, -1.0+b, 0.0 ], [ 1.0, -1.0, 0.0 ],
- [ -a, -1.0, 0.0 ], [ -a, 1.0-b, 0.0 ], [ -1.0, 1.0-b, 0.0 ],
- [ -1.0, 1.0, 0.0 ] ]
+ if type == 1:
+ # H:
+ a *= 0.5
+ b *= 0.5
+ newpoints = [[-1.0, 1.0, 0.0], [-1.0+a, 1.0, 0.0],
+ [-1.0+a, b, 0.0], [1.0-a, b, 0.0], [1.0-a, 1.0, 0.0],
+ [1.0, 1.0, 0.0], [1.0, -1.0, 0.0], [1.0-a, -1.0, 0.0],
+ [1.0-a, -b, 0.0], [-1.0+a, -b, 0.0], [-1.0+a, -1.0, 0.0],
+ [-1.0, -1.0, 0.0]]
+ elif type == 2:
+ # T:
+ a *= 0.5
+ newpoints = [[-1.0, 1.0, 0.0], [1.0, 1.0, 0.0],
+ [1.0, 1.0-b, 0.0], [a, 1.0-b, 0.0], [a, -1.0, 0.0],
+ [-a, -1.0, 0.0], [-a, 1.0-b, 0.0], [-1.0, 1.0-b, 0.0]]
+ elif type == 3:
+ # U:
+ a *= 0.5
+ newpoints = [[-1.0, 1.0, 0.0], [-1.0+a, 1.0, 0.0],
+ [-1.0+a, -1.0+b, 0.0], [1.0-a, -1.0+b, 0.0], [1.0-a, 1.0, 0.0],
+ [1.0, 1.0, 0.0], [1.0, -1.0, 0.0], [-1.0, -1.0, 0.0]]
+ elif type == 4:
+ # Z:
+ a *= 0.5
+ newpoints = [[-0.5, 1.0, 0.0], [a, 1.0, 0.0],
+ [a, -1.0+b, 0.0], [1.0, -1.0+b, 0.0], [1.0, -1.0, 0.0],
+ [-a, -1.0, 0.0], [-a, 1.0-b, 0.0], [-1.0, 1.0-b, 0.0],
+ [-1.0, 1.0, 0.0]]
else:
- ## L:
- newpoints = [ [ -1.0, 1.0, 0.0 ], [ -1.0+a, 1.0, 0.0 ],
- [ -1.0+a, -1.0+b, 0.0 ], [ 1.0, -1.0+b, 0.0 ],
- [ 1.0, -1.0, 0.0 ], [ -1.0, -1.0, 0.0 ] ]
+ # L:
+ newpoints = [[-1.0, 1.0, 0.0], [-1.0+a, 1.0, 0.0],
+ [-1.0+a, -1.0+b, 0.0], [1.0, -1.0+b, 0.0],
+ [1.0, -1.0, 0.0], [-1.0, -1.0, 0.0]]
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Miscellaneous.: Diamond, Arrow1, Arrow2, Square, ....
def MiscCurve(type=1, a=1.0, b=0.5, c=1.0):
"""
@@ -214,28 +216,28 @@ def MiscCurve(type=1, a=1.0, b=0.5, c=1.0):
"""
newpoints = []
- a*=0.5
- b*=0.5
+ a *= 0.5
+ b *= 0.5
if type == 1:
- ## diamond:
- newpoints = [ [ 0.0, b, 0.0 ], [ a, 0.0, 0.0 ], [ 0.0, -b, 0.0 ], [ -a, 0.0, 0.0 ] ]
+ # diamond:
+ newpoints = [[0.0, b, 0.0], [a, 0.0, 0.0], [0.0, -b, 0.0], [-a, 0.0, 0.0]]
elif type == 2:
- ## Arrow1:
- newpoints = [ [ -a, b, 0.0 ], [ a, 0.0, 0.0 ], [ -a, -b, 0.0 ], [ 0.0, 0.0, 0.0 ] ]
+ # Arrow1:
+ newpoints = [[-a, b, 0.0], [a, 0.0, 0.0], [-a, -b, 0.0], [0.0, 0.0, 0.0]]
elif type == 3:
- ## Arrow2:
- newpoints = [ [ -1.0, b, 0.0 ], [ -1.0+a, b, 0.0 ],
- [ -1.0+a, 1.0, 0.0 ], [ 1.0, 0.0, 0.0 ],
- [ -1.0+a, -1.0, 0.0 ], [ -1.0+a, -b, 0.0 ],
- [ -1.0, -b, 0.0 ] ]
+ # Arrow2:
+ newpoints = [[-1.0, b, 0.0], [-1.0+a, b, 0.0],
+ [-1.0+a, 1.0, 0.0], [1.0, 0.0, 0.0],
+ [-1.0+a, -1.0, 0.0], [-1.0+a, -b, 0.0],
+ [-1.0, -b, 0.0]]
elif type == 4:
- ## Rounded square:
- newpoints = [ [ -a, b-b*0.2, 0.0 ], [ -a+a*0.05, b-b*0.05, 0.0 ], [ -a+a*0.2, b, 0.0 ],
- [ a-a*0.2, b, 0.0 ], [ a-a*0.05, b-b*0.05, 0.0 ], [ a, b-b*0.2, 0.0 ],
- [ a, -b+b*0.2, 0.0 ], [ a-a*0.05, -b+b*0.05, 0.0 ], [ a-a*0.2, -b, 0.0 ],
- [ -a+a*0.2, -b, 0.0 ], [ -a+a*0.05, -b+b*0.05, 0.0 ], [ -a, -b+b*0.2, 0.0 ] ]
+ # Rounded square:
+ newpoints = [[-a, b-b*0.2, 0.0], [-a+a*0.05, b-b*0.05, 0.0], [-a+a*0.2, b, 0.0],
+ [a-a*0.2, b, 0.0], [a-a*0.05, b-b*0.05, 0.0], [a, b-b*0.2, 0.0],
+ [a, -b+b*0.2, 0.0], [a-a*0.05, -b+b*0.05, 0.0], [a-a*0.2, -b, 0.0],
+ [-a+a*0.2, -b, 0.0], [-a+a*0.05, -b+b*0.05, 0.0], [-a, -b+b*0.2, 0.0]]
elif type == 5:
- ## Rounded Rectangle II:
+ # Rounded Rectangle II:
newpoints = []
x = a / 2
y = b / 2
@@ -246,27 +248,27 @@ def MiscCurve(type=1, a=1.0, b=0.5, c=1.0):
if r > y:
r = y - 0.0001
- if r>0:
- newpoints.append([-x+r,y,0])
- newpoints.append([x-r,y,0])
- newpoints.append([x,y-r,0])
- newpoints.append([x,-y+r,0])
- newpoints.append([x-r,-y,0])
- newpoints.append([-x+r,-y,0])
- newpoints.append([-x,-y+r,0])
- newpoints.append([-x,y-r,0])
+ if r > 0:
+ newpoints.append([-x+r, y, 0])
+ newpoints.append([x-r, y, 0])
+ newpoints.append([x, y-r, 0])
+ newpoints.append([x, -y+r, 0])
+ newpoints.append([x-r, -y, 0])
+ newpoints.append([-x+r, -y, 0])
+ newpoints.append([-x, -y+r, 0])
+ newpoints.append([-x, y-r, 0])
else:
- newpoints.append([-x,y,0])
- newpoints.append([x,y,0])
- newpoints.append([x,-y,0])
- newpoints.append([-x,-y,0])
+ newpoints.append([-x, y, 0])
+ newpoints.append([x, y, 0])
+ newpoints.append([x, -y, 0])
+ newpoints.append([-x, -y, 0])
else:
- ## Square:
- newpoints = [ [ -a, b, 0.0 ], [ a, b, 0.0 ], [ a, -b, 0.0 ], [ -a, -b, 0.0 ] ]
+ # Square:
+ newpoints = [[-a, b, 0.0], [a, b, 0.0], [a, -b, 0.0], [-a, -b, 0.0]]
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Star:
def StarCurve(starpoints=8, innerradius=0.5, outerradius=1.0, twist=0.0):
"""
@@ -295,14 +297,14 @@ def StarCurve(starpoints=8, innerradius=0.5, outerradius=1.0, twist=0.0):
t = (i*step)
x1 = cos(t*pi)*outerradius
y1 = sin(t*pi)*outerradius
- newpoints.append([x1,y1,0])
+ newpoints.append([x1, y1, 0])
x2 = cos(t*pi+(pi/starpoints+twist))*innerradius
y2 = sin(t*pi+(pi/starpoints+twist))*innerradius
- newpoints.append([x2,y2,0])
- i+=1
+ newpoints.append([x2, y2, 0])
+ i += 1
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Flower:
def FlowerCurve(petals=8, innerradius=0.5, outerradius=1.0, petalwidth=2.0):
"""
@@ -332,17 +334,17 @@ def FlowerCurve(petals=8, innerradius=0.5, outerradius=1.0, petalwidth=2.0):
t = (i*step)
x1 = cos(t*pi-(pi/petals))*innerradius
y1 = sin(t*pi-(pi/petals))*innerradius
- newpoints.append([x1,y1,0])
+ newpoints.append([x1, y1, 0])
x2 = cos(t*pi-pet)*outerradius
y2 = sin(t*pi-pet)*outerradius
- newpoints.append([x2,y2,0])
+ newpoints.append([x2, y2, 0])
x3 = cos(t*pi+pet)*outerradius
y3 = sin(t*pi+pet)*outerradius
- newpoints.append([x3,y3,0])
- i+=1
+ newpoints.append([x3, y3, 0])
+ i += 1
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Arc,Sector,Segment,Ring:
def ArcCurve(sides=6, startangle=0.0, endangle=90.0, innerradius=0.5, outerradius=1.0, type=3):
"""
@@ -371,34 +373,34 @@ def ArcCurve(sides=6, startangle=0.0, endangle=90.0, innerradius=0.5, outerradiu
newpoints = []
sides += 1
angle = (2.0*(1.0/360.0))
- endangle-=startangle
+ endangle -= startangle
step = ((angle*endangle)/(sides-1))
i = 0
while i < sides:
t = (i*step) + angle*startangle
x1 = sin(t*pi)*outerradius
y1 = cos(t*pi)*outerradius
- newpoints.append([x1,y1,0])
- i+=1
+ newpoints.append([x1, y1, 0])
+ i += 1
- #if type ==0:
+ # if type ==0:
# Arc: turn cyclic curve flag off!
# Segment:
- if type ==2:
- newpoints.append([0,0,0])
+ if type == 2:
+ newpoints.append([0, 0, 0])
# Ring:
- elif type ==3:
- j=sides-1
+ elif type == 3:
+ j = sides-1
while j > -1:
t = (j*step) + angle*startangle
x2 = sin(t*pi)*innerradius
y2 = cos(t*pi)*innerradius
- newpoints.append([x2,y2,0])
- j-=1
+ newpoints.append([x2, y2, 0])
+ j -= 1
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Cog wheel:
def CogCurve(theeth=8, innerradius=0.8, middleradius=0.95, outerradius=1.0, bevel=0.5):
"""
@@ -431,26 +433,26 @@ def CogCurve(theeth=8, innerradius=0.8, middleradius=0.95, outerradius=1.0, beve
t = (i*step)
x1 = cos(t*pi-(pi/theeth)-pet)*innerradius
y1 = sin(t*pi-(pi/theeth)-pet)*innerradius
- newpoints.append([x1,y1,0])
+ newpoints.append([x1, y1, 0])
x2 = cos(t*pi-(pi/theeth)+pet)*innerradius
y2 = sin(t*pi-(pi/theeth)+pet)*innerradius
- newpoints.append([x2,y2,0])
+ newpoints.append([x2, y2, 0])
x3 = cos(t*pi-pet)*middleradius
y3 = sin(t*pi-pet)*middleradius
- newpoints.append([x3,y3,0])
+ newpoints.append([x3, y3, 0])
x4 = cos(t*pi-(pet*bevel))*outerradius
y4 = sin(t*pi-(pet*bevel))*outerradius
- newpoints.append([x4,y4,0])
+ newpoints.append([x4, y4, 0])
x5 = cos(t*pi+(pet*bevel))*outerradius
y5 = sin(t*pi+(pet*bevel))*outerradius
- newpoints.append([x5,y5,0])
+ newpoints.append([x5, y5, 0])
x6 = cos(t*pi+pet)*middleradius
y6 = sin(t*pi+pet)*middleradius
- newpoints.append([x6,y6,0])
- i+=1
+ newpoints.append([x6, y6, 0])
+ i += 1
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: nSide:
def nSideCurve(sides=6, radius=1.0):
"""
@@ -475,12 +477,12 @@ def nSideCurve(sides=6, radius=1.0):
t = (i*step)
x = sin(t*pi)*radius
y = cos(t*pi)*radius
- newpoints.append([x,y,0])
- i+=1
+ newpoints.append([x, y, 0])
+ i += 1
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# 2DCurve: Splat:
def SplatCurve(sides=24, scale=1.0, seed=0, basis=0, radius=1.0):
"""
@@ -509,21 +511,21 @@ def SplatCurve(sides=24, scale=1.0, seed=0, basis=0, radius=1.0):
i = 0
while i < sides:
t = (i*step)
- turb = vTurbNoise(t,t,t, 1.0, scale, 6, 0, basis, seed )
+ turb = vTurbNoise(t, t, t, 1.0, scale, 6, 0, basis, seed)
turb = turb[2] * 0.5 + 0.5
x = sin(t*pi)*radius * turb
y = cos(t*pi)*radius * turb
- newpoints.append([x,y,0])
- i+=1
+ newpoints.append([x, y, 0])
+ i += 1
return newpoints
-###-----------------------------------------------------------
-#### 3D curve shape functions:
-###-----------------------------------------------------------
+# -----------------------------------------------------------
+# 3D curve shape functions:
+# -----------------------------------------------------------
-###------------------------------------------------------------
+# ------------------------------------------------------------
# 3DCurve: Helix:
-def HelixCurve( number=100, height=2.0, startangle=0.0, endangle=360.0, width=1.0, a=0.0, b=0.0 ):
+def HelixCurve(number=100, height=2.0, startangle=0.0, endangle=360.0, width=1.0, a=0.0, b=0.0):
"""
HelixCurve( number=100, height=2.0, startangle=0.0, endangle=360.0, width=1.0, a=0.0, b=0.0 )
@@ -554,20 +556,20 @@ def HelixCurve( number=100, height=2.0, startangle=0.0, endangle=360.0, width=1.
step = angle/(number-1)
h = height/angle
start = (startangle*2.0/360.0)
- a/=angle
+ a /= angle
i = 0
while i < number:
- t = ( i*step+start )
- x = sin( (t*pi) ) * ( 1.0 + cos( t * pi * a - ( b * pi ) ) ) * ( 0.25 * width )
- y = cos( (t*pi) ) * ( 1.0 + cos( t * pi * a - ( b * pi ) ) ) * ( 0.25 * width )
- z = ( t * h ) -h*start
- newpoints.append([x,y,z])
- i+=1
+ t = (i*step+start)
+ x = sin((t*pi)) * (1.0 + cos(t * pi * a - (b * pi))) * (0.25 * width)
+ y = cos((t*pi)) * (1.0 + cos(t * pi * a - (b * pi))) * (0.25 * width)
+ z = (t * h) - h*start
+ newpoints.append([x, y, z])
+ i += 1
return newpoints
-###------------------------------------------------------------ ?
+# ------------------------------------------------------------ ?
# 3DCurve: Cycloid: Cycloid, Epicycloid, Hypocycloid
-def CycloidCurve( number=24, length=2.0, type=0, a=1.0, b=1.0, startangle=0.0, endangle=360.0 ):
+def CycloidCurve(number=24, length=2.0, type=0, a=1.0, b=1.0, startangle=0.0, endangle=360.0):
"""
CycloidCurve( number=24, length=2.0, type=0, a=1.0, b=1.0, startangle=0.0, endangle=360.0 )
@@ -591,39 +593,39 @@ def CycloidCurve( number=24, length=2.0, type=0, a=1.0, b=1.0, startangle=0.0, e
#h = height/angle
d = length
start = (startangle*2.0/360.0)
- a/=angle
+ a /= angle
i = 0
- if type == 0: # Epitrochoid
+ if type == 0: # Epitrochoid
while i < number:
- t = ( i*step+start )
+ t = (i*step+start)
x = ((a + b) * cos(t*pi)) - (d * cos(((a+b)/b)*t*pi))
y = ((a + b) * sin(t*pi)) - (d * sin(((a+b)/b)*t*pi))
- z = 0 # ( t * h ) -h*start
- newpoints.append([x,y,z])
- i+=1
+ z = 0 # ( t * h ) -h*start
+ newpoints.append([x, y, z])
+ i += 1
else:
- newpoints = [[-1,-1,0], [-1,1,0], [1,1,0], [1,-1,0]]
+ newpoints = [[-1, -1, 0], [-1, 1, 0], [1, 1, 0], [1, -1, 0]]
return newpoints
-##------------------------------------------------------------
+# ------------------------------------------------------------
# calculates the matrix for the new object
# depending on user pref
def align_matrix(context):
loc = Matrix.Translation(context.scene.cursor_location)
obj_align = context.user_preferences.edit.object_align
if (context.space_data.type == 'VIEW_3D'
- and obj_align == 'VIEW'):
+ and obj_align == 'VIEW'):
rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
else:
rot = Matrix()
align_matrix = loc * rot
return align_matrix
-##------------------------------------------------------------
-#### Curve creation functions
+# ------------------------------------------------------------
+# Curve creation functions
# sets bezierhandles to auto
-def setBezierHandles(obj, mode = 'AUTOMATIC'):
+def setBezierHandles(obj, mode='AUTOMATIC'):
scene = bpy.context.scene
if obj.type != 'CURVE':
return
@@ -648,8 +650,8 @@ def vertsToPoints(Verts, splineType):
for v in Verts:
vertArray += v
if splineType == 'NURBS':
- vertArray.append(1) #for nurbs w=1
- else: #for poly w=0
+ vertArray.append(1) # for nurbs w=1
+ else: # for poly w=0
vertArray.append(0)
return vertArray
@@ -661,8 +663,8 @@ def createCurve(context, vertArray, self, align_matrix):
# create curve
scene = context.scene
- newCurve = bpy.data.curves.new(name, type = 'CURVE') # curvedatablock
- newSpline = newCurve.splines.new(type = splineType) # spline
+ newCurve = bpy.data.curves.new(name, type='CURVE') # curvedatablock
+ newSpline = newCurve.splines.new(type=splineType) # spline
# create spline from vertarray
if splineType == 'BEZIER':
@@ -680,11 +682,11 @@ def createCurve(context, vertArray, self, align_matrix):
newSpline.order_u = self.order_u
# create object with newCurve
- new_obj = bpy.data.objects.new(name, newCurve) # object
- scene.objects.link(new_obj) # place in active scene
- new_obj.select = True # set as selected
+ new_obj = bpy.data.objects.new(name, newCurve) # object
+ scene.objects.link(new_obj) # place in active scene
+ new_obj.select = True # set as selected
scene.objects.active = new_obj # set as active
- new_obj.matrix_world = align_matrix # apply matrix
+ new_obj.matrix_world = align_matrix # apply matrix
# set bezierhandles
if splineType == 'BEZIER':
@@ -692,7 +694,7 @@ def createCurve(context, vertArray, self, align_matrix):
return
-##------------------------------------------------------------
+# ------------------------------------------------------------
# Main Function
def main(context, self, align_matrix):
# deselect all objects
@@ -781,7 +783,7 @@ class Curveaceous_galore(Operator):
# align_matrix for the invoke
align_matrix = None
- #### general properties
+ # general properties
ProfileTypes = [
('Profile', 'Profile', 'Profile'),
('Miscellaneous', 'Miscellaneous', 'Miscellaneous'),
@@ -804,7 +806,7 @@ class Curveaceous_galore(Operator):
description="Type of splines to output",
items=SplineTypes)
- #### Curve Options
+ # Curve Options
shapeItems = [
('2D', '2D', '2D'),
('3D', '3D', '3D')]
@@ -829,7 +831,7 @@ class Curveaceous_galore(Operator):
description="bezier handles type",
items=bezHandles)
- #### ProfileCurve properties
+ # ProfileCurve properties
ProfileCurveType = IntProperty(name="Type",
min=1, soft_min=1,
max=5, soft_max=5,
@@ -842,7 +844,7 @@ class Curveaceous_galore(Operator):
default=0.25,
description="var2 of ProfileCurve")
- #### MiscCurve properties
+ # MiscCurve properties
MiscCurveType = IntProperty(name="Type",
min=1, soft_min=1,
max=6, soft_max=6,
@@ -859,7 +861,7 @@ class Curveaceous_galore(Operator):
min=0, soft_min=0,
description="var3 of MiscCurve")
- #### Common properties
+ # Common properties
innerRadius = FloatProperty(name="Inner radius",
default=0.5,
min=0, soft_min=0,
@@ -873,7 +875,7 @@ class Curveaceous_galore(Operator):
min=0, soft_min=0,
description="Outer radius")
- #### Flower properties
+ # Flower properties
petals = IntProperty(name="Petals",
default=8,
min=2, soft_min=2,
@@ -883,7 +885,7 @@ class Curveaceous_galore(Operator):
min=0.01, soft_min=0.01,
description="Petal width")
- #### Star properties
+ # Star properties
starPoints = IntProperty(name="Star points",
default=8,
min=2, soft_min=2,
@@ -892,7 +894,7 @@ class Curveaceous_galore(Operator):
default=0.0,
description="Twist")
- #### Arc properties
+ # Arc properties
arcSides = IntProperty(name="Arc sides",
default=6,
min=1, soft_min=1,
@@ -909,7 +911,7 @@ class Curveaceous_galore(Operator):
max=3, soft_max=3,
description="Sides of arc")
- #### Cogwheel properties
+ # Cogwheel properties
teeth = IntProperty(name="Teeth",
default=8,
min=2, soft_min=2,
@@ -920,13 +922,13 @@ class Curveaceous_galore(Operator):
max=1, soft_max=1,
description="Bevel")
- #### Nsided property
+ # Nsided property
Nsides = IntProperty(name="Sides",
default=8,
min=3, soft_min=3,
description="Number of sides")
- #### Splat properties
+ # Splat properties
splatSides = IntProperty(name="Splat sides",
default=24,
min=3, soft_min=3,
@@ -945,7 +947,7 @@ class Curveaceous_galore(Operator):
max=14, soft_max=14,
description="Basis")
- #### Helix properties
+ # Helix properties
helixPoints = IntProperty(name="resolution",
default=100,
min=3, soft_min=3,
@@ -970,7 +972,7 @@ class Curveaceous_galore(Operator):
default=0.0,
description="Helix var2")
- #### Cycloid properties
+ # Cycloid properties
cycloPoints = IntProperty(name="Resolution",
default=100,
min=3, soft_min=3,
@@ -1035,10 +1037,10 @@ class Curveaceous_galore(Operator):
elif self.ProfileType == 'Arc':
box.prop(self, 'arcSides')
- box.prop(self, 'arcType') # has only one Type?
+ box.prop(self, 'arcType') # has only one Type?
box.prop(self, 'startAngle')
box.prop(self, 'endAngle')
- box.prop(self, 'innerRadius') # doesn't seem to do anything
+ box.prop(self, 'innerRadius') # doesn't seem to do anything
box.prop(self, 'outerRadius')
elif self.ProfileType == 'Cogwheel':
@@ -1070,7 +1072,7 @@ class Curveaceous_galore(Operator):
elif self.ProfileType == 'Cycloid':
box.prop(self, 'cycloPoints')
- #box.prop(self, 'cycloType') # needs the other types first
+ # box.prop(self, 'cycloType') # needs the other types first
box.prop(self, 'cycloStart')
box.prop(self, 'cycloEnd')
box.prop(self, 'cyclo_a')
@@ -1102,7 +1104,7 @@ class Curveaceous_galore(Operator):
##### POLL #####
@classmethod
def poll(cls, context):
- return context.scene != None
+ return context.scene is not None
##### EXECUTE #####
def execute(self, context):
@@ -1113,8 +1115,8 @@ class Curveaceous_galore(Operator):
# deal with 2D - 3D curve differences
if self.ProfileType in ['Helix', 'Cycloid']:
self.shape = '3D'
- #else:
- #self.shape = '2D' # someone decide if we want this
+ # else:
+ # self.shape = '2D' # someone decide if we want this
if self.ProfileType in ['Helix']:
self.use_cyclic_u = False