BPython:
- Pontus Lidman contributed a new module: Blender.Key + access to key objects from NMesh, Lattice and Curve + docs (thanks and sorry for taking so long to check/commit the patch!) - Allowing EVENT spacehandlers to call the file selector (scriptlinks in general are not allowed, but this special case should be able to). Requested by Paolo Colombo (thanks!) - tiny doc update (Ken Hughes pointed an error in the space handlers example) I didn't have time to update the Key module to follow the current bpython design, will do that later and also test it better than I did.
This commit is contained in:
@@ -224,7 +224,7 @@ Introduction:
|
||||
# SPACEHANDLER.VIEW3D.EVENT
|
||||
|
||||
import Blender
|
||||
from Blender import DRAW
|
||||
from Blender import Draw
|
||||
evt = Blender.event
|
||||
return_it = False
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ class Curve:
|
||||
@ivar rot: The Curve Data rotation(from the center).
|
||||
@ivar size: The Curve Data size(from the center).
|
||||
@ivar bevob: The Curve Bevel Object
|
||||
@cvar key: The L{Key.Key} object associated with this Curve, if any.
|
||||
"""
|
||||
|
||||
def getName():
|
||||
@@ -382,6 +383,14 @@ class Curve:
|
||||
@rtype: integer
|
||||
"""
|
||||
|
||||
def getKey():
|
||||
"""
|
||||
Return the L{Key.Key} object containing the keyframes for this
|
||||
curve, if any.
|
||||
@rtype: L{Key.Key} object or None
|
||||
"""
|
||||
|
||||
|
||||
class CurNurb:
|
||||
"""
|
||||
The CurNurb Object
|
||||
|
||||
94
source/blender/python/api2_2x/doc/Key.py
Normal file
94
source/blender/python/api2_2x/doc/Key.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# Blender.Key module and the Key and KeyBlock PyType objects
|
||||
|
||||
"""
|
||||
The Blender.Key submodule.
|
||||
|
||||
This module provides access to B{Key} objects in Blender.
|
||||
|
||||
@type Types: readonly dictionary
|
||||
@var Types: The type of a key, indicating the type of data in the
|
||||
data blocks.
|
||||
- MESH - the key is a Mesh key; data blocks contain
|
||||
L{NMesh.NMVert} vertices.
|
||||
- CURVE - the key is a Curve key; data blocks contain
|
||||
L{Ipo.BezTriple} points.
|
||||
- LATTICE - the key is a Lattice key; data blocks contain
|
||||
BPoints, each point represented as a list of 4 floating point numbers.
|
||||
|
||||
"""
|
||||
|
||||
def Get(name = None):
|
||||
"""
|
||||
Get the named Key object from Blender. If the name is omitted, it
|
||||
will retrieve a list of all keys in Blender.
|
||||
@type name: string
|
||||
@param name: the name of the requested key
|
||||
@return: If name was given, return that Key object (or None if not
|
||||
found). If a name was not given, return a list of every Key object
|
||||
in Blender.
|
||||
"""
|
||||
|
||||
class Key:
|
||||
"""
|
||||
The Key object
|
||||
==============
|
||||
An object with keyframes (L{Lattice.Lattice}, L{NMesh.NMesh} or
|
||||
L{Curve.Curve}) will contain a Key object representing the
|
||||
keyframe data.
|
||||
@cvar blocks: A list of KeyBlocks.
|
||||
@cvar ipo: The L{Ipo.Ipo} object associated with this key.
|
||||
@cvar type: An integer from the L{Types} dictionary
|
||||
representing the Key type.
|
||||
"""
|
||||
|
||||
def getType():
|
||||
"""
|
||||
Get the type of this Key object. It will be one of the
|
||||
integers defined in the L{Types} dictionary.
|
||||
"""
|
||||
def getIpo():
|
||||
"""
|
||||
Get the L{Ipo.Ipo} object associated with this key.
|
||||
"""
|
||||
def getBlocks():
|
||||
"""
|
||||
Get a list of L{KeyBlock}s, containing the keyframes defined for
|
||||
this Key.
|
||||
"""
|
||||
|
||||
class KeyBlock:
|
||||
"""
|
||||
The KeyBlock object
|
||||
===================
|
||||
Each Key object has a list of KeyBlocks attached, each KeyBlock
|
||||
representing a keyframe.
|
||||
|
||||
@cvar data: The data of the KeyBlock (see L{getData}). This
|
||||
attribute is read-only.
|
||||
@cvar pos: The position of the keyframe (see L{getPos}). This
|
||||
attribute is read-only.
|
||||
"""
|
||||
def getData():
|
||||
"""
|
||||
Get the data of a KeyBlock, as a list of data items. Each item
|
||||
will have a different data type depending on the type of this
|
||||
Key.
|
||||
|
||||
Mesh keys have a list of L{NMesh.NMVert} objects in the data
|
||||
block.
|
||||
|
||||
Lattice keys have a list of BPoints in the data block. These
|
||||
don't have corresponding Python objects yet, so each BPoint is
|
||||
represented using a list of four floating-point numbers.
|
||||
|
||||
Curve keys have a list of L{Ipo.BezTriple} objects in the data
|
||||
block.
|
||||
"""
|
||||
|
||||
def getPos():
|
||||
"""
|
||||
Get the position of the keyframe represented by this KeyBlock,
|
||||
normally between 0.0 and 1.0. The time point when the Speed
|
||||
Ipo intersects the KeyBlock position is the actual time of the
|
||||
keyframe.
|
||||
"""
|
||||
@@ -76,6 +76,7 @@ class Lattice:
|
||||
@ivar depthType: The z dimension key type.
|
||||
@ivar mode: The current mode of the Lattice.
|
||||
@ivar latSize: The number of points in this Lattice.
|
||||
@cvar key: The L{Key.Key} object associated with this Lattice.
|
||||
"""
|
||||
|
||||
def getName():
|
||||
@@ -189,6 +190,13 @@ class Lattice:
|
||||
much probably an undesired effect.
|
||||
"""
|
||||
|
||||
def getKey():
|
||||
"""
|
||||
Returns the L{Key.Key} object associated with this Lattice.
|
||||
@rtype: L{Key.Key}
|
||||
@return: A key object representing the keyframes of the lattice or None.
|
||||
"""
|
||||
|
||||
def insertKey(frame):
|
||||
"""
|
||||
Inserts the current state of the Lattice as a new absolute keyframe
|
||||
|
||||
@@ -357,6 +357,7 @@ class NMesh:
|
||||
@ivar mode: The mode flags for this mesh. See L{setMode}.
|
||||
@ivar subDivLevels: The [display, rendering] subdivision levels in [1, 6].
|
||||
@ivar maxSmoothAngle: The max angle for auto smoothing. See L{setMode}.
|
||||
@cvar key: The L{Key.Key} object attached to this mesh, if any.
|
||||
"""
|
||||
|
||||
def addEdge(v1, v2):
|
||||
@@ -532,6 +533,13 @@ class NMesh:
|
||||
and its weight is a float value.
|
||||
"""
|
||||
|
||||
def getKey():
|
||||
"""
|
||||
Get the Key object representing the Vertex Keys (absolute or
|
||||
relative) assigned to this mesh.
|
||||
@rtype: L{Key.Key} object or None
|
||||
"""
|
||||
|
||||
def insertKey(frame = None, type = 'relative'):
|
||||
"""
|
||||
Insert a mesh key at the given frame. Remember to L{update} the nmesh
|
||||
|
||||
Reference in New Issue
Block a user