[Bf-extensions-cvs] [3156ef6] master: Add curve extra objects: update curves galore, spirofit, thanks Jimmy Haze
meta-androcto
noreply at git.blender.org
Fri Apr 21 15:11:18 CEST 2017
Commit: 3156ef67b748827dd3d273c7c96465b5328780d9
Author: meta-androcto
Date: Fri Apr 21 23:10:46 2017 +1000
Branches: master
https://developer.blender.org/rBA3156ef67b748827dd3d273c7c96465b5328780d9
Add curve extra objects: update curves galore, spirofit, thanks Jimmy Haze
===================================================================
M add_curve_extra_objects/add_curve_aceous_galore.py
M add_curve_extra_objects/add_curve_spirofit_bouncespline.py
===================================================================
diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py
index 649bf55..a20dbd6 100644
--- a/add_curve_extra_objects/add_curve_aceous_galore.py
+++ b/add_curve_extra_objects/add_curve_aceous_galore.py
@@ -33,6 +33,7 @@ bl_info = {
# ------------------------------------------------------------
# import modules
+
import bpy
from bpy.props import (
BoolProperty,
@@ -44,13 +45,14 @@ from mathutils import (
Matrix,
Vector,
)
+from bpy.types import Operator
from math import (
sin,
cos,
pi
)
import mathutils.noise as Noise
-from bpy.types import Operator
+
# ------------------------------------------------------------
# Some functions to use with others:
@@ -78,8 +80,8 @@ def randnum(low=0.0, high=1.0, seed=0):
Noise.seed_set(seed)
rnum = Noise.random()
- rnum = rnum*(high-low)
- rnum = rnum+low
+ rnum = rnum * (high - low)
+ rnum = rnum + low
return rnum
@@ -111,12 +113,12 @@ def vTurbNoise(x, y, z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0)
(type=3-float list)
"""
rand = randnum(-100, 100, Seed)
- if Basis == 9:
+ if Basis is 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
+ 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
# -------------------------------------------------------------------
@@ -144,39 +146,49 @@ def ProfileCurve(type=0, a=0.25, b=0.25):
"""
newpoints = []
- if type == 1:
+ if type is 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:
+ 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 is 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:
+ 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 is 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:
+ 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 is 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]]
+ 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]]
+ 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
# ------------------------------------------------------------
@@ -200,15 +212,17 @@ def ArrowCurve(type=1, a=1.0, b=0.5):
"""
newpoints = []
- if type == 0:
+ if type is 0:
# Arrow1:
a *= 0.5
b *= 0.5
- 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 == 1:
+ 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 is 1:
# Arrow2:
newpoints = [[-a, b, 0.0], [a, 0.0, 0.0], [-a, -b, 0.0], [0.0, 0.0, 0.0]]
else:
@@ -216,6 +230,7 @@ def ArrowCurve(type=1, a=1.0, b=0.5):
newpoints = [[0.0, b, 0.0], [a, 0.0, 0.0], [0.0, -b, 0.0], [-a, 0.0, 0.0]]
return newpoints
+
# ------------------------------------------------------------
# 2DCurve: Square / Rectangle
def RectCurve(type=1, a=1.0, b=0.5, c=1.0):
@@ -239,13 +254,15 @@ def RectCurve(type=1, a=1.0, b=0.5, c=1.0):
"""
newpoints = []
- if type == 1:
+ if type is 1:
# Rounded Rectangle:
- 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 == 2:
+ 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 is 2:
# Rounded Rectangle II:
newpoints = []
x = a
@@ -256,14 +273,14 @@ def RectCurve(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])
+ 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])
@@ -274,6 +291,7 @@ def RectCurve(type=1, a=1.0, b=0.5, c=1.0):
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):
@@ -297,15 +315,15 @@ def StarCurve(starpoints=8, innerradius=0.5, outerradius=1.0, twist=0.0):
"""
newpoints = []
- step = (2.0/(starpoints))
+ step = 2.0 / starpoints
i = 0
while i < starpoints:
- t = (i*step)
- x1 = cos(t*pi)*outerradius
- y1 = sin(t*pi)*outerradius
+ t = i * step
+ x1 = cos(t * pi) * outerradius
+ y1 = sin(t * pi) * outerradius
newpoints.append([x1, y1, 0])
- x2 = cos(t*pi+(pi/starpoints+twist))*innerradius
- y2 = sin(t*pi+(pi/starpoints+twist))*innerradius
+ x2 = cos(t * pi + (pi / starpoints + twist)) * innerradius
+ y2 = sin(t * pi + (pi / starpoints + twist)) * innerradius
newpoints.append([x2, y2, 0])
i += 1
return newpoints
@@ -333,23 +351,24 @@ def FlowerCurve(petals=8, innerradius=0.5, outerradius=1.0, petalwidth=2.0):
"""
newpoints = []
- step = (2.0/(petals))
- pet = (step/pi*2)*petalwidth
+ step = 2.0 / petals
+ pet = (step / pi * 2) * petalwidth
i = 0
while i < petals:
- t = (i*step)
- x1 = cos(t*pi-(pi/petals))*innerradius
- y1 = sin(t*pi-(pi/petals))*innerradius
+ t = i * step
+ x1 = cos(t * pi - (pi / petals)) * innerradius
+ y1 = sin(t * pi - (pi / petals)) * innerradius
newpoints.append([x1, y1, 0])
- x2 = cos(t*pi-pet)*outerradius
- y2 = sin(t*pi-pet)*outerradius
+ x2 = cos(t * pi - pet) * outerradius
+ y2 = sin(t * pi - pet) * outerradius
newpoints.append([x2, y2, 0])
- x3 = cos(t*pi+pet)*outerradius
- y3 = sin(t*pi+pet)*outerradius
+ x3 = cos(t * pi + pet) * outerradius
+ y3 = sin(t * pi + pet) * outerradius
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, ou
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list