[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3704] trunk/py/scripts/addons: merge of torus knots plus, curveaceous_galore & spirals addons.
Brendon Murphy
meta.androcto1 at gmail.com
Tue Sep 4 02:02:39 CEST 2012
Revision: 3704
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3704
Author: meta-androcto
Date: 2012-09-04 00:02:38 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
merge of torus knots plus, curveaceous_galore & spirals addons.
this merge groups the main add curve object types under the one folder
Added Paths:
-----------
trunk/py/scripts/addons/add_curve_extra_objects/
trunk/py/scripts/addons/add_curve_extra_objects/__init__.py
trunk/py/scripts/addons/add_curve_extra_objects/add_curve_aceous_galore.py
trunk/py/scripts/addons/add_curve_extra_objects/add_curve_spirals.py
trunk/py/scripts/addons/add_curve_extra_objects/add_curve_torus_knots.py
Removed Paths:
-------------
trunk/py/scripts/addons/add_curve_aceous_galore.py
trunk/py/scripts/addons/add_curve_torus_knots.py
Deleted: trunk/py/scripts/addons/add_curve_aceous_galore.py
===================================================================
--- trunk/py/scripts/addons/add_curve_aceous_galore.py 2012-09-03 23:57:21 UTC (rev 3703)
+++ trunk/py/scripts/addons/add_curve_aceous_galore.py 2012-09-04 00:02:38 UTC (rev 3704)
@@ -1,1142 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-bl_info = {
- 'name': 'Curveaceous Galore!',
- 'author': 'Jimmy Hazevoet, testscreenings',
- 'version': (0,2),
- "blender": (2, 5, 9),
- 'location': 'View3D > Add > Curve',
- 'description': 'Adds many different types of Curves',
- 'warning': '', # used for warning icon and text in addons panel
- 'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.6/Py/' \
- 'Scripts/Curve/Curves_Galore',
- 'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
- 'func=detail&aid=22404',
- 'category': 'Add Curve'}
-
-
-##------------------------------------------------------------
-#### import modules
-import bpy
-from bpy.props import *
-from mathutils import *
-from math import *
-import mathutils.noise as Noise
-###------------------------------------------------------------
-#### Some functions to use with others:
-###------------------------------------------------------------
-
-#------------------------------------------------------------
-# Generate random number:
-def randnum(low=0.0, high=1.0, seed=0):
- """
- randnum( low=0.0, high=1.0, seed=0 )
-
- Create random number
-
- Parameters:
- low - lower range
- (type=float)
- high - higher range
- (type=float)
- seed - the random seed number, if seed is 0, the current time will be used instead
- (type=int)
- Returns:
- a random number
- (type=float)
- """
-
- Noise.seed_set(seed)
- rnum = Noise.random()
- rnum = rnum*(high-low)
- rnum = rnum+low
- return rnum
-
-
-#------------------------------------------------------------
-# Make some noise:
-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 )
-
- Create randomised vTurbulence noise
-
- Parameters:
- xyz - (x,y,z) float values.
- (type=3-float tuple)
- iScale - noise intensity scale
- (type=float)
- Size - noise size
- (type=float)
- Depth - number of noise values added.
- (type=int)
- Hard - noise hardness: 0 - soft noise; 1 - hard noise
- (type=int)
- basis - type of noise used for turbulence
- (type=int)
- Seed - the random seed number, if seed is 0, the current time will be used instead
- (type=int)
- Returns:
- the generated turbulence vector.
- (type=3-float list)
- """
- 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
-
-
-#------------------------------------------------------------
-# Axis: ( used in 3DCurve Turbulence )
-def AxisFlip(x,y,z, x_axis=1, y_axis=1, z_axis=1, flip=0 ):
- if flip != 0:
- flip *= -1
- else: flip = 1
- x *= x_axis*flip
- y *= y_axis*flip
- z *= z_axis*flip
- return x,y,z
-
-
-###-------------------------------------------------------------------
-#### 2D Curve shape functions:
-###-------------------------------------------------------------------
-
-##------------------------------------------------------------
-# 2DCurve: Profile: L, H, T, U, Z
-def ProfileCurve(type=0, a=0.25, b=0.25):
- """
- ProfileCurve( type=0, a=0.25, b=0.25 )
-
- Create profile curve
-
- Parameters:
- type - select profile type, L, H, T, U, Z
- (type=int)
- a - a scaling parameter
- (type=float)
- b - b scaling parameter
- (type=float)
- Returns:
- a list with lists of x,y,z coordinates for curve points, [[x,y,z],[x,y,z],...n]
- (type=list)
- """
-
- 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 ] ]
- 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 ] ]
- return newpoints
-
-##------------------------------------------------------------
-# 2DCurve: Miscellaneous.: Diamond, Arrow1, Arrow2, Square, ....
-def MiscCurve(type=1, a=1.0, b=0.5, c=1.0):
- """
- MiscCurve( type=1, a=1.0, b=0.5, c=1.0 )
-
- Create miscellaneous curves
-
- Parameters:
- type - select type, Diamond, Arrow1, Arrow2, Square
- (type=int)
- a - a scaling parameter
- (type=float)
- b - b scaling parameter
- (type=float)
- c - c scaling parameter
- (type=float)
- doesn't seem to do anything
- Returns:
- a list with lists of x,y,z coordinates for curve points, [[x,y,z],[x,y,z],...n]
- (type=list)
- """
-
- newpoints = []
- 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 ] ]
- elif type == 2:
- ## 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 ] ]
- 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 ] ]
- elif type == 5:
- ## Rounded Rectangle II:
- newpoints = []
- x = a / 2
- y = b / 2
- r = c / 2
-
- if r > x:
- r = x - 0.0001
- 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])
- else:
- 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 ] ]
- return newpoints
-
-##------------------------------------------------------------
-# 2DCurve: Star:
-def StarCurve(starpoints=8, innerradius=0.5, outerradius=1.0, twist=0.0):
- """
- StarCurve( starpoints=8, innerradius=0.5, outerradius=1.0, twist=0.0 )
-
- Create star shaped curve
-
- Parameters:
- starpoints - the number of points
- (type=int)
- innerradius - innerradius
- (type=float)
- outerradius - outerradius
- (type=float)
- twist - twist amount
- (type=float)
- Returns:
- a list with lists of x,y,z coordinates for curve points, [[x,y,z],[x,y,z],...n]
- (type=list)
- """
-
- newpoints = []
- step = (2.0/(starpoints))
- i = 0
- while i < starpoints:
- 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
- newpoints.append([x2,y2,0])
- i+=1
- return newpoints
-
-##------------------------------------------------------------
-# 2DCurve: Flower:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list