paya.runtime.plugs.Matrix#
- class Matrix(*args, **kwargs)#
Inheritance
Math
Attribute
Attribute
PyNode
ProxyUnicode
- createLocator(size=1.0, name=None)#
Creates a locator and drives its SRT channels using this matrix.
- __add__(other, swap=False)#
Implements addition (
+
).- Parameters
other – a 16D value or plug
- mul(*others)#
Multiplies this matrix in a chained manner with
*others
.
- __mul__(other, swap=False)#
Implements multiplication (
*
).- Parameters
other – a value or plug of dimension 3 (left only) or 16.
- __rxor__(other)#
Uses the exclusive-or operator (
^
) to implement point-matrix multiplication (reflected only).- Parameters
other – a 3D value or plug
- pick(translate=None, rotate=None, scale=None, shear=None, default=None)#
Filters this matrix through one or more pickMatrix nodes, depending on combinations with ‘default’. Flags are defined by omission, Maya-style.
- Shorthand
pk
- Parameters
- Returns
The filtered matrix.
- Return type
- asOffset()#
Inverts this matrix once, to create an offset matrix. Equivalent to:
self.get().inverse() * self
- Returns
The offset matrix.
- Return type
- getAxis(axis, normalize=False)#
Extracts the specified axis from this matrix as a vector output. If this is the output attribute of a fourByFourMatrix node, the method will defer to methods in
FourByFourMatrix
.Used to implement the following properties: x, y, z and translate/t. The property versions will always return non-normalized outputs.
- getX(normalize=False)#
Extracts the X vector. Used to implement the x property.
- getY(normalize=False)#
Extracts the Y vector. Used to implement the y property.
- getZ(normalize=False)#
Extracts the Z vector. Used to implement the z property.
- getTranslate(normalize=False)#
Extracts the translation component. Used to implement the translate / t property.
- Parameters
normalize (bool) – normalize the output; defaults to False
- Returns
the extracted translation
- Return type
Math3D
- decompose(rotateOrder='xyz')#
Connects and configures a
decomposeMatrix
node.
- decomposeAndApply(*slaves, translate=None, rotate=None, scale=None, shear=None, compensatePivots=False, compensateJointOrient=True, compensateRotateAxis=False, compensateJointScale=True, worldSpace=False, maintainOffset=False)#
Decomposes and applies this matrix to one or more slave transforms.
- Parameters
translate/t (bool) – apply translation
rotate/r (bool) – apply rotation
scale/s (bool) – apply scale
shear/sh (bool) – apply shear
maintainOffset/mo (bool) – maintain relative pose; defaults to
False
worldSpace/ws (bool) – premultiply this matrix with
parentInverseMatrix
on the transform to negate the parent stack; defaults toFalse
compensateJointScale/cjs (bool) – account for segmentScaleCompensate on joints; defaults to
True
compensateJointOrient/cjo (bool) – account for
jointOrient
on joints; defaults toTrue
compensateRotateAxis/cra (bool) – account for
rotateAxis
; defaults toFalse
compensatePivots/cp (bool) – compensate for pivots (non-joint transforms only); this is expensive, so defaults to
False
- Returns
self
- Return type
- applyViaOpm(*slaves, worldSpace=False, persistentCompensation=False, preserveInheritsTransform=False, maintainOffset=False)#
Uses this matrix to drive one or more transforms via connections into
offsetParentMatrix
, with compensations against the transforms’ SRT channels.Warning
When worldSpace is combined with preserveInheritsTransform, the matrix will only be localised against the current parent. The solution will break if the transform is subsequently reparented.
- Parameters
worldSpace/ws (bool) – drive the slaves in world-space; defaults to
False
maintainOffset/mo (bool) – preserve relative pose on application; defaults to
False
persistentCompensation/pc (bool) – compensate for the transform’s SRT channels persistently, so that the world pose will remain the same even if they change; defaults to
False
preserveInheritsTransform/pit – when worldSpace is requested, don’t edit the
inheritsTransform
attribute on the transform; instead, localise against the current parent; defaults toFalse
- Returns
self
- Return type
- drive(*slaves, worldSpace=False, maintainOffset=False, useOffsetParentMatrix=<undefined>, preserveInheritsTransform=False)#
Drives one or more slaves using this matrix.
- Parameters
worldSpace/ws (bool) – drive the slaves in world-space; defaults to
False
preserveInheritsTransform/pit – when worldSpace is requested, don’t edit the
inheritsTransform
attribute on the slave; instead, localise against its current parent; defaults toFalse
maintainOffset/mo (bool) – preserve relative pose on application; defaults to
False
useOffsetParentMatrix/uop (bool) – connect into
offsetParentMatrix
instead of decomposing into SRT channels; defaults to namesake configuration flag; it that’s omitted too, defaults toTrue
if Maya >= 2022, otherwiseFalse
- Returns
self
- Return type
- hold()#
Connects a holdMatrix node and returns its output.
This is useful in situations where a method such as pick() has nothing to do, but must return a new output to protect code branching.
- Returns
The output of a holdMatrix node.
- Return type
HoldMatrix
- blend(other, weight=0.5)#
Blends this matrix towards other. When weight is at
1.0
, other will take over completely.
- asEulerRotation(rotateOrder='xyz')#
Returns the euler decomposition of this matrix.
- asQuaternion()#
Returns a quaternion output for this matrix’s rotation.
- Returns
The quaternion.
- Return type