paya.lib.skel#
- class Chain(*joints)#
-
- classmethod getFromStartEnd(startJoint, endJoint)#
- classmethod getFromRoot(rootJoint)#
- classmethod createFromMatrices(matrices, parent=None)#
Creates a chain from matrices. The joints will match the matrices exactly; no attempt is made to orient the chain.
- Parameters
matrices – the matrices to use
parent/p – an optional parent for the chain; defaults to None
- Returns
- classmethod createFromPoints(points, upVector, downAxis=<undefined>, upAxis=<undefined>, parent=None, tolerance=1e-07, tipMatrix=None)#
Builds a chain from points. The side (‘up’) axis will be calculated using cross products, but those will be biased towards the reference up vector.
- Parameters
points (
list
[list
[float
] |Point
|Vector
]) – a world position for each jointdownAxis (str) – the ‘bone’ axis; defaults to
paya.config.downAxis
upAxis (str) – the axis to map to the up vector; defaults to
paya.config.upAxis
upVector (tuple, list,
Vector
, [tuple, list,Vector
]) – one up vector hint, or one vector per pointparent/p – an optional parent for the chain; defaults to None
tolerance/tol (float) – see
paya.lib.mathops.getChainedAimMatrices()
tipMatrix/tm (
None
,list
[float
],Matrix
) – an optional rotation matrix override for the tip (end) joint; if provided, only orientation information will be used; defaults toNone
- Returns
The constructed chain.
- Return type
- classmethod createFromCurve(curve, numberOrFractions, downAxis, upAxis, upVectorOrCurve, tolerance=1e-07)#
Draws a chain (once) along a curve. Either ‘aimCurve’ or ‘upVector’ must be provided.
- Parameters
numberOrFractions – this can either be a list of length fractions, or a number
curve (str or
PyNode
) – the curve along which to distribute jointsdownAxis (str) – the ‘bone’ axis
upAxis (str) – the axis to map to the up vector(s)
upVectorOrCurve (list,
Vector
, str,DagNode
) – either an up vector, or an up curvetolerance/tol (float) – see
paya.lib.mathops.getChainedAimMatrices()
- Returns
The constructed chain.
- Return type
- orient(downAxis, upAxis, upVector, tolerance=1e-07)#
Orients this chain.
- points(plug=False)#
- vectors(plug=False)#
- isContiguous()#
- Returns
True if every member of this chain is a child of its predecessor, otherwise False.
- Return type
- isInline()#
- Returns
True
if this chain is in-line (in any direction), otherwiseFalse
.- Return type
- roots()#
- Returns
The first joint, and any member which is not a child of its predecessor.
- Return type
- length(plug=False)#
- skinClusters()#
- Returns
Any skinClusters associated with any joint in this chain, in no particular order.
- Return type
- ratios()#
- Returns
A length ratio for reach joint in this chain.
- Return type
list of float
- insertJoints(*numberOrRatios, perBone=False)#
Inserts joints into this chain. This is an in-place operation.
- Parameters
*numberOrRatios (int, float, list, tuple) – this can be passed either as a single integer or one or more floats; if an integer is passed, this number of joints will be uniformly distributed along the length of this chain; if floats are passed, then joints will be inserted at those length ratios
perBone/pb (bool) – perform the operation per bone in the chain; defaults to False
- Returns
The newly-generated joints.
- Return type
list of
Joint
- subdivide(*iterations)#
Recursively inserts joints to ‘subdivide’ this chain. This is an in place operation. The chain will be edited and its membership updated.
- duplicate(startNumber=1)#
Duplicates this chain. Joints will be renamed with contextual. Use
Name
blocks to modify.
- compose()#
Ensures that every member of this chain is a child of its predecessor.
- explode()#
Reparents every joint under the parent of the first joint.
- appendChain(otherChain, replaceTip=True)#
This is an in-place operation. Splices
otherChain
to the bottom of this chain and updates the membership.
- reset()#
Sets rotations on every joint of this chain to [0.0, 0.0, 0.0].
- Returns
self
- getPolePoint(distance=1.0)#
This method creates a temporary IK handle and samples its default
poleVector
value. For this reason it will be affected by anypreferredAngle
values.- Parameters
distance/d (float or int) – the pole point’s distance from the chain’s chord vector axis; defaults to 1.0
- Returns
An inert world-position point target for a pole vector constraint or
setPolePoint()
.- Return type
- createIkHandle(jitter=False, upVector=None, **kwargs)#
Creates an IK handle for this chain.
- Parameters
jitter (bool) – if this chain is in-line, auto-configures preferred angles to prevent lockout; upAxis will be required for this; defaults to
False
upVector – used by jitter; a reference up vector to indicate the wind direction of the jitter; defaults to
None
**kwargs –
forwarded to
paya.runtime.nodes.IkHandle.create()
with the following modifications:startJoint
andendJoint
are overriden to the start and end joints of this chain, respectivelyUnless specified, the solver defaults to
ikSCsolver
if there are only two joints in this chain, andikRPsolver
otherwise
- Returns
The IK handle.
- Return type
- autoPreferredAngle(upVector)#
If this chain is in-line, auto-configures a slight value in the preferred angle of the bending (‘up’) axis of the internal joints in anticipation of an IK handle.
- createIkHandles()#
Creates one IK handle per bone in this chain. The IK handles will all use a single-chain solver. The IK handles will be numbered. Prefixes and padding can be specified using a
Name
block.
- getTwistMap(twistChain)#
Returns a list of sublists, where each sublist comprises:
bone on this chain, subdivided bone (chain) on twist chain
- driveTwistChain(twistChain, upAxis, globalScale=1.0, downAxis=None, startUpMatrix=None, endUpMatrix=None, useOffsetParentMatrix=<undefined>, skipEnd=False, squashStretch=False)#
Drives a chain derived by duplicating this one and calling
insertJoints()
orsubdivide()
on the copy.- Parameters
upAxis (str) – this chain’s ‘up’ axis, e.g.
x
globalScale/gs (
float
,str
,Attribute
) – if this is a plug, it will be normalized; if it’s not a plug, it will be overriden to1.0
; defaults to1.0
downAxis/da (str) – if you know this chain’s ‘down’ axis, specify if here to prevent extraneous checks; defaults to
None
startUpMatrix/sum (
str
,Matrix
) – an optional matrix to override the transformation of the vector at the very start of this chain; useful for things like shoulders etc.; defaults toNone
endUpMatrix/eum (
str
,Matrix
) – an optional matrix to override the transformation of the vector at the very end of this chain; defaults toNone
useOffsetParentMatrix/uop (bool) – use offset parent matrix to drive the slave joints; defaults to the namesake configuration flag
skipEnd/ske (bool) – don’t drive the final joint; defaults to
False
squashStretch/ss (bool) – apply bone scale; defaults to
False