paya.runtime.plugs.Math1D#

class Math1D(*args, **kwargs)#

Inheritance

Math Attribute Attribute PyNode ProxyUnicode

classmethod createAttr(attrName, node=None, attributeType=None, **kwargs)#

On Math1D subclasses, overloads paya.runtime.plugs.Attribute.create() to preload attributeType with a type appropriate for the class.

Parameters
  • attrName (str) – the name of the attribute

  • node (str, DependNode) – the node on which to create the attribute; if omitted, a free-standing network node will be created to hold the attribute; defaults to double for Math1D, doubleAngle for Angle, doubleLinear for Distance and time for Time

  • attributeType/at (str) – the type of the attribute to create; defaults to something sensible for this 1D class

  • **kwargs – forwarded to addAttr()

Returns

The generated attribute.

Return type

Attribute

convertUnit(*factor)#

Connects and configures a unitConversion node and returns its output.

Parameters

*factor – the conversion factor; if omitted, defaults to 1.0

Returns

The output of the unitConversion node.

Return type

Attribute

asAngle()#

If this attribute is of type ‘doubleAngle’, it is returned as-is. If it’s of any other type, it’s converted using Maya UI rules and a ‘doubleAngle’ output for it returned.

Returns

The angle output.

Return type

Angle

asRadians()#
Returns

A unitless (type ‘double’) output representing radians. Conversions are performed according to Maya rules.

Return type

Angle

__add__(other, swap=False)#

Implements addition (+).

Parameters

other – a value or plug of dimension 1, 2, 3 or 4

__radd__(other)#

Implements reflected addition (+). See __add__().

__sub__(other, swap=False)#

Implements subtraction (-).

Parameters

other – a value or plug of dimension 1, 2, 3

__rsub__(other)#

Implements reflected subtraction (-). See __sub__().

__mul__(other, swap=False)#

Implements multiplication (-).

Parameters

other – a value or plug of dimension 1 or 3

__rmul__(other)#

Implements reflected multiplication (-). See __mul__().

__truediv__(other, swap=False)#

Implements division (/).

Parameters

other – a value or plug of dimension 1 or 3

__rtruediv__(other)#

Implements reflected division (/). See __truediv__().

__pow__(other, modulo=None, swap=False)#

Implements power (**). The modulo keyword argument is ignored.

Parameters

other – a value or plug of dimension 1 or 3

__rpow__(other)#

Implements reflected power (**). See __pow__().

sqrt()#
Returns

The square root of self, equivalent to self ** 0.5.

Return type

:class:Math1D

__neg__()#

Implements unary negation (-). :return: self * -1.0

normal(scalar=True)#
Parameters

scalar/s (bool) – if this is True, normalization will be performed as self / self.get(); if it’s False, self - self.get() will be performed instead; defaults to True

Returns

A normalized output for this plug. Normalization will be skipped, and self will be returned, if the currrent value of this plug is already 1.0 (for scalar) or 0.0.

Return type

Math1D

setSign(positive)#
Parameters

positive (bool) – set the sign to positive

Returns

This scalar, with the sign forced to positive if positive is True, otherwise to negative

copySignFrom(other)#

Copies the sign from another scalar.

Parameters

other (float, int, Math1D) – the scalar from which to copy the sign

Returns

This scalar, with sign copied from other.

Return type

Math1D

abs()#
Returns

self, unsigned.

Return type

Math1D

trunc()#
Returns

The truncation of this float.

Type

Math1D

combine(*others, method='multiplication')#

Uses a combinationShape node to combine this scalar with *others.

Parameters
  • *others (int, float, Math1D) – unpacked scalars

  • method/m

    an enum for the ‘combinationMethod’ attribute of the node; can be specified as an index or label; one of:

    • 0: ‘multiplication’ (the default)

    • 1: ‘lowest weighting’

    • 2: ‘smooth’

Returns

The combined output.

Return type

Math1D

cycle(min, max)#

Cycles this value so that it remains within the specified range.

Parameters
  • min ([1D scalar value or Math1D]) – the range minimum

  • max ([1D scalar value or Math1D]) – the range maximum

Returns

The looped scalar output.

Return type

Math1D

__mod__(other, swap=False)#

Implements the % operator (modulo).

remap(oldMin, oldMax, newMin, newMax, clamp=True)#

Peforms simple linear remapping.

Parameters
  • oldMin (1D value type or Math1D) – the previous range minimum

  • oldMax (1D value type or Math1D) – the previous range maximum

  • newMin (1D value type or Math1D) – the new range minimum

  • newMax (1D value type or Math1D) – the new range maximum

  • clamp (bool) – clamp to the new range instead of extrapolating; defaults to True

Returns

The remapped output.

Return type

Math1D

clamp(min, max)#

Clamps this output

Parameters
  • min (1D scalar type or Math1D) – the range minimum

  • max (1D scalar type or Math1D) – the range maximum

Returns

The clamped output.

Return type

Math1D

minClamp(other)#

Clamps this value to a minimum of ‘other’.

Parameters

other (1D scalar type or Math1D) – the new range minimum

Returns

The min-clamped output.

Return type

Math1D

maxClamp(other)#

Clamps this value to a maximum of ‘other’.

Parameters

other (1D scalar type or Math1D) – the new range maximum

Returns

The max-clamped output.

Return type

Math1D

gatedClamp(floorOrCeiling, floorOpen, ceilingOpen)#

Useful for squash-and-stretch control.

Parameters
  • floorOrCeiling (float, Math1D) – acts as a floor or ceiling for this output, depending on floorOpen and ceilingOpen

  • floorOpen (float, Math1D) – when this is at 0.0, this output won’t dip below floorOrCeiling

  • ceilingOpen – when this is at 0.0, this output won’t rise above floorOrCeiling

Returns

The clamped output.

Return type

Math1D

min(*others)#

Returns the minimum amongst self and \*others.

Parameters

*others ([scalar value type of Math1D]) – unpacked list of scalar values or inputs to compare to

Returns

The maximum scalar.

Return type

Math1D

max(*others)#

Returns the maximum amongst self and \*others.

Parameters

*others ([scalar value type of Math1D]) – unpacked list of scalar values or inputs to compare to

Returns

The maximum scalar.

Return type

Math1D

_makeCompCondition(other, operation)#

Configures a condition node for comparisons.

eq(other)#

Returns an output for ‘equal’.

Parameters

other (scalar value type or Math1D) – the value or plug to compare to

Returns

A condition node output that can be evaluated as a gating bool.

Return type

Math1D

ne(other)#

Returns an output for ‘not equal’.

Parameters

other (scalar value type or Math1D) – the value or plug to compare to

Returns

A condition node output that can be evaluated as a gating bool.

Return type

Math1D

gt(other)#

Returns an output for ‘greater than’.

Parameters

other (scalar value type or Math1D) – the value or plug to compare to

Returns

A condition node output that can be evaluated as a gating bool.

Return type

Math1D

ge(other)#

Returns an output for ‘greater or equal’.

Parameters

other (scalar value type or Math1D) – the value or plug to compare to

Returns

A condition node output that can be evaluated as a gating bool.

Return type

Math1D

lt(other)#

Returns an output for ‘less than’.

Parameters

other (scalar value type or Math1D) – the value or plug to compare to

Returns

A condition node output that can be evaluated as a gating bool.

Return type

Math1D

le(other)#

Returns an output for ‘less or equal’.

Parameters

other (scalar value type or Math1D) – the value or plug to compare to

Returns

A condition node output that can be evaluated as a gating bool.

Return type

Math1D

inRange(minValue, maxValue)#
Parameters
  • minValue (float, int, str, Math1D) – the floor value

  • maxValue – the ceiling value

Returns

return

A condition node output that can be

evaluated as a gating bool.

Return type

Math1D

ifElse(outputIfTrue, outputIfFalse)#

If-then-else output selector.

Parameters
  • outputIfTrue (Attribute) – plug to return if this plug evaluates as True

  • outputIfFalse (Attribute) – plug to return if this plug evaluates as False

Returns

The selected output.

Return type

Attribute

blend(other, weight=0.5, swap=False)#

Blends this output towards other.

Parameters
  • other (1D value type, or Math1D) – The scalar value or plug towards which to blend

  • weight/w (1D value type or Math1D) – ‘other’ will be fully active at 1.0; defaults to 0.5

  • swap/sw (bool) – swap operands; defaults to False

Returns

The blended output.

Return type

Math1D

unaryExpr(operation, returnsRadians=False)#

Configures an expression node to run a unary expression on this plug, and returns its output.

Parameters
  • operation (str) – the expression operation, for example 'sin'

  • returnsRadians (bool) – interpret the output as a radian return (e.g. from a trigonometric function) and pipe into an angle output; defaults to False

Returns

the expression output

Return type

Math1D

cos()#

Returns the trigonometric cosine.

Return type

Math1D

sin()#

Returns the trigonometric sine.

Return type

Math1D

tan()#

Returns the trigonometric tangent.

Return type

Math1D

acos()#

Returns the inverse trigonometric cosine.

Return type

Angle

asin()#

Returns the inverse trigonometric sine.

Return type

Angle

atan()#

Returns the inverse trigonometric tangent.

Return type

Angle

atTime(time, relative=False)#

Returns this output either sampled at a particular time, or with a live time offset.

Parameters
  • time – the time at which to sample this output

  • relative (bool) – interpret ‘time’ as a relative offset; defaults to False

Returns

the sampled output

Return type

Math1D