===Python API===

Additions to BezTriple API: complete get/set access to all BezTriple settings
(knot and handles points, handle types, tilt/alfa, hide, weight and selection
status).
This commit is contained in:
Ken Hughes
2006-03-10 21:39:14 +00:00
parent 2a4dc7654c
commit c35e8426fe
2 changed files with 429 additions and 212 deletions

View File

@@ -22,6 +22,14 @@ Example::
print ipo.getRctf()
ipo.setRctf(1,2,3,4)
@type HandleTypes: readonly dictionary
@var HandleTypes: The available BezTriple handle types.
- FREE - handle has no constrints
- AUTO - completely constrain handle based on knot position
- VECT - constraint handle to line between current and neighboring knot
- ALIGN - constrain handle to lie in a straight line with knot's other
handle
- AUTOANIM - constrain IPO handles to be horizontal on extremes
"""
def New (type, name):
@@ -406,18 +414,39 @@ class IpoCurve:
@return: the Y value of the curve at the given time
"""
class BezTriple:
"""
The BezTriple object
====================
This object gives access to generic data from all beztriple objects in Blender. If an attribute is listed as being 'read-only' that means you cannot write to it. Use the set*() methods instead.
@ivar pt : the [x,y] coordinates for knot point of this BezTriple. Read-only.
@type pt: list of floats
@ivar vec : a list of the 3 points [ handle, knot, handle ] that comprise a BezTriple. See the getTriple() method for an example of the format. Read-only.
This object gives access to generic data from all BezTriple objects in
Blender.
@ivar pt : the [x,y] coordinates for knot point of this BezTriple. After
changing coordinates of a Ipo curve, it is advisable to call
L{IpoCurve.recalc()} to update the curve.
@type pt: list of two floats
@ivar vec : a list of the 3 points [ handle, knot, handle ] that comprise a
BezTriple, with each point composed of a list [x,y,z] of floats. The list
looks like [ [H1x, H1y, H1z], [Px, Py, Pz], [H2x, H2y, H2z] ].
Example::
# where bt is of type BezTriple
# and h1, p, and h2 are lists of 3 floats
h1, p, h2 = bt.vec
@type vec: list of points
@ivar hide: the visibility status of the control point.
@ivar tilt: the tilt/alpha value for the point
@type tilt: float
@ivar hide: the visibility status of the knot. B{Note}: true/nonzero means
I{not} hidden. B{Note}: primarily intended for curves; not a good idea to
hide IPO control points.
@type hide: int
@ivar handleTypes: the types of the point's two handles. See
L{HandleTypes} for a complete description.
@type handleTypes list of two ints
@ivar selects: the select status for [handle, knot, handle]. True/nonzero
if the point is selected.
@type selects: list of three ints
@ivar weight: the weight assigned to the control point. Useful for
softbodies and possibly others.
@type weight: float
"""
def __init__(coords):
@@ -433,16 +462,16 @@ class BezTriple:
def getPoints():
"""
Returns the xy coordinates of the Bezier knot point.
Returns the x,y coordinates of the Bezier knot point (B{deprecated}).
See the L{BezTriple.pt} attribute.
@rtype: list of floats
@return: list of the x and y coordinates of the Bezier point.
"""
def setPoints(newval):
"""
Sets the point xy coordinates of the Bezier knot point. After changing
coordinates, it is advisable to call L{IpoCurve.recalc()} to update the
Ipo curves.
Sets the x,y coordinates of the Bezier knot point (B{deprecated}).
See the L{BezTriple.pt} attribute.
@type newval: tuple of 2 floats
@param newval: the x and y coordinates of the new Bezier point.
@rtype: None
@@ -452,16 +481,7 @@ class BezTriple:
def getTriple():
"""
Returns the x,y,z coordinates for each of the three points that make up
a BezierTriple.
The return list looks like this [ [H1x, H1y, H1z], [Px, Py, Pz],
[H2x, H2y, H2z] ] .
Example::
# where bt is of type BezierTriple
# and h1, p, and h2 are lists of 3 floats
h1, p, h2 = bt.getTriple()
a BezierTriple (B{deprecated}). See the L{BezTriple.vec} attribute.
@rtype: list consisting of 3 lists of 3 floats
@return: handle1, knot, handle2
"""