paya.runtime.nodes.Transform#

class Transform(*args, **kwargs)#

Inheritance

Transform DagNode DagNode Entity Entity ContainerBase ContainerBase DependNode DependNode PyNode ProxyUnicode

classmethod create(dagPath=None, name=None, parent=None, displayLocalAxis=False, rotateOrder='xyz', worldMatrix=None)#

Creates transform nodes.

Parameters
  • dagPath/dp (None, str) – an explicit DAG path; if provided, the minimum number of nodes required to match this DAG path will be generated; displayLocalAxis, rotateOrder and worldMatrix will only be applied to the last (innermost) group; defaults to None

  • name/n (str) – the node name; defaults to None

  • parent/p (None, str, Transform) – an optional parent for the transform; if this is combined with dagPath, then this node’s DAG path will be prepended; defaults to None

  • displayLocalAxis/dla (bool) – display the transform’s local axes; defaults to False

  • rotateOrder/ro (int, str or None) – the transform’s rotate order; defaults to ‘xyz’

  • worldMatrix/wm (None, list, tuple or Matrix) – an optional world matrix for the transform, applied to the SRT channels; defaults to None

Returns

The transform.

Return type

Transform

toShape()#
Returns

If this node is a transform, its first shape child; otherwise, the node itself.

Return type

Shape or Transform

toTransform()#
Returns

If this node is a shape, its parent; otherwise, the node itself.

Return type

Shape or Transform

releaseSRT()#

Unlocks and disconnects every SRT channel, recursively.

Returns

self

closestAxisToVector(refVector, includeNegative=True)#
Parameters
  • refVector – the vector to compare against

  • includeNegative/ing (bool) – Consider negative axes; defaults to True

Returns

The most closely-aligned axis on this object to refVector, e.g. '-x'.

Return type

str

closestOf(elems)#

Returns the closest amongst ‘elems’ to this transform.

Parameters

elems – a list of Python objects that, when instantiated into PyNodes, implement getWorldPosition()

Returns

The closest amongst ‘elems’.

getWorldPosition(plug=False, useLocatorShape=True)#

Returns the world translation of this transform. Pivots are ignored.

Shorthand

gwp

Parameters
  • plug/p (bool) – return an attribute instead of a value; if ‘useLocatorShape’ is True then, where available, the locator shape’s ‘worldPosition’ attribute will be returned; otherwise, a ‘worldPosition’ attribute will be retrieved, or initialised, on the transform itself, with its input configured as self.t ^ self.pm[0]; defaults to False

  • useLocatorShape/uls (bool) – True

Returns

The position attribute or value.

Return type

Point or Vector

getWorldMatrix(plug=False, asOffset=False)#

The advantage of calling getWorldMatrix(plug=True, asOffset=True) instead of getWorldMatrix(plug=True).asOffset() is that, in the former case, the output will be cached for subsequent retrievals.

Parameters
  • plug/p (bool) – return a plug instead of a value; defaults to False

  • asOffset/ao (bool) – return the matrix as an identity matrix; defaults to False

Returns

The world matrix of this transform, as a value or plug.

Return type

paya.runtime.data.Matrix, paya.runtime.plugs.Matrix

getRotateAxisMatrix(plug=False)#

Returns the rotate axis as a rotation matrix.

Parameters

plug/p (bool) – return an attribute instead of a value; this will be cooked only once, and afterwards retrieved via a ‘rotateAxisMatrix’ attribute on the node; defaults to False

Returns

The rotate axis matrix.

Return type

paya.runtime.data.Matrix or paya.runtime.plugs.Matrix

makeIdentity(**kwargs)#

Convenience wrapper for pymel.internal.pmcmds.makeIdentity().

Parameters

**kwargs – passed along to pymel.internal.pmcmds.makeIdentity().

Returns

self

Return type

Transform

createOffsetGroups(*descriptors)#

Creates transformationally-matched offset (‘zero’) groups.

Parameters

*descriptors (str, [str]) – base names for the offset groups, from innermost to outermost; if omitted, defaults to 'offset'

Returns

The offset groups, from innermost to outermost.

Return type

[Transform]

conformShapeNames(includeIntermediateShapes=False, shapeList=None)#

Conforms the names of this transform’s shape children to the Maya convention.

Parameters
  • includeIntermediateShapes/iis (bool) – process intermediate shapes as well

  • shapeList/shl (None, [str, Shape]) – if this is provided, it will be used instead of scanning for the transform’s children; defaults to None

Returns

self

Return type

Transform

getHeroShapes()#
Returns

All non-intermediate shapes under this transform.

Return type

[Shape]

getIntermediateShapes()#
Returns

All intermediate shapes under this transform.

Return type

[Shape]

getCtShapes()#
Returns

Non-intermediate curve and locator shapes under this transform.

Return type

[NurbsCurve or Locator]

rotateCtShapes(rotation)#

Rotates control shapes in local space. Locator shapes won’t be rotated, but their localPosition will. Note that rotation is expected in degrees.

Parameters

rotation (list, tuple, Array) – an iterable of three rotation values, in degrees

Returns

self

scaleCtShapes(scale)#

Scales control shapes in local space.

Parameters

scale (list, tuple, Array) – an iterable of three scale values

Returns

self

setCtShapesFromLib(libKey, lineWidth=None, size=1.0)#

Sets control shapes to the named library entry.

Parameters
  • name (str) – the name of the library entry, e.g. ‘cube’

  • lineWidth/lw (float) – an override for the line width; defaults to None

  • size/siz (float) – the shape scale; defaults to 1.0

Returns

The newly-generated control shapes.

Return type

list of Shape

cycleCtShapes(backward=False)#

Steps through the library alphabetically and applies a different shape on each invocation. Useful for trying out different shapes quickly.

Parameters

backward/back (bool) – cycle backwards instead of forwards; defaults to False

Returns

The newly-generated control shapes.

Return type

list of Shape

clearCtShapes()#

Removes all non-intermediate curve or locator shapes under this transform.

Returns

self

Return type

Transform

colorCtShapes(*colorIndex, clearOverrides=True)#
Color shorthands
'white': 16,
'blue': 6,
'left': 6,
'right': 13,
'red': 13,
'center': 14,
'green': 14,
'yellow': 17,
'pink': 20
Parameters
  • *colorIndex (int or None) – if a color index is provided, it is used to set the override color on all control shapes; if None is passed, override colors are reset; if the argument is omitted, the first- encountered override color index is returned

  • clearOverrides/co (bool) – used only if colorIndex was set to None; set overrideEnabled to False as well; defaults to True

Returns

If colorIndex was provided, self is returned; otherwise, a color index.

Return type

Transform or int

addCtShapesToLib(entryName, normalize=True)#

Captures this control’s shapes into a new library entry for reuse via setCtShapes().

Parameters
  • entryName (str) – the name of the new library entry

  • normalize/nr (bool) – normalize points into a unit; defaults to True

Returns

self

Return type

Transform

getCtShapesLineWidth()#
Returns

The first encountered line width which is above 0.0 (i.e. not the Maya default of -1.0), or None

Return type

float, None

setCtShapesLineWidth(lineWidth)#

Sets the line width on NURBS control shapes.

Parameters

lineWidth (float, None) – the line width to set; if None is passed, the line width will be set to -1.0

Returns

self

Return type

Transform

createAnimSpace(labels, targets, slave=None, translate=None, rotate=None, scale=None, defaultValue=0)#
Parameters
  • slave/slv (str, Transform) – the transform to constrain; if omitted, defaults to the first available offset group

  • targets (str, Matrix, Transform) – the target transforms or matrices

  • labels (list [str]) – labels for the enum attribute

  • translate/t (bool) – drive translate channels; defaults to True

  • rotate/r (bool) – drive rotate channels; defaults to True

  • scale/s (bool) – drive scale channels; defaults to True

  • defaultValue/dv (int, str) – the default value for the enum attribute; defaults to 0

Returns

The system’s network node.

Return type

AnimSpaceSwitcher