paya.runtime.plugs.Math1D#
- class Math1D(*args, **kwargs)#
 Inheritance
MathAttributeAttributePyNodeProxyUnicode- classmethod createAttr(attrName, node=None, attributeType=None, **kwargs)#
 On
Math1Dsubclasses, overloadspaya.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-standingnetworknode will be created to hold the attribute; defaults todoubleforMath1D,doubleAngleforAngle,doubleLinearforDistanceandtimeforTimeattributeType/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
unitConversionnode and returns its output.- Parameters
 *factor – the conversion factor; if omitted, defaults to 1.0
- Returns
 The output of the
unitConversionnode.- Return type
 
- 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
 
- asRadians()#
 - Returns
 A unitless (type ‘double’) output representing radians. Conversions are performed according to Maya rules.
- Return type
 
- __add__(other, swap=False)#
 Implements addition (
+).- Parameters
 other – a value or plug of dimension 1, 2, 3 or 4
- __sub__(other, swap=False)#
 Implements subtraction (
-).- Parameters
 other – a value or plug of dimension 1, 2, 3
- __mul__(other, swap=False)#
 Implements multiplication (
-).- Parameters
 other – a value or plug of dimension 1 or 3
- __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
- sqrt()#
 - Returns
 The square root of
self, equivalent toself ** 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 asself / self.get(); if it’sFalse,self - self.get()will be performed instead; defaults to True- Returns
 A normalized output for this plug. Normalization will be skipped, and
selfwill be returned, if the currrent value of this plug is already 1.0 (for scalar) or 0.0.- Return type
 
- 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.
- combine(*others, method='multiplication')#
 Uses a combinationShape node to combine this scalar with *others.
- Parameters
 *others (int, float,
Math1D) – unpacked scalarsmethod/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 minimummax ([1D scalar value or
Math1D]) – the range maximum
- Returns
 The looped scalar output.
- Return type
 
- __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 minimumoldMax (1D value type or
Math1D) – the previous range maximumnewMin (1D value type or
Math1D) – the new range minimumnewMax (1D value type or
Math1D) – the new range maximumclamp (bool) – clamp to the new range instead of extrapolating; defaults to
True
- Returns
 The remapped output.
- Return type
 
- clamp(min, max)#
 Clamps this output
- Parameters
 min (1D scalar type or
Math1D) – the range minimummax (1D scalar type or
Math1D) – the range maximum
- Returns
 The clamped output.
- Return type
 
- 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
 
- 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
 
- gatedClamp(floorOrCeiling, floorOpen, ceilingOpen)#
 Useful for squash-and-stretch control.
- Parameters
 - Returns
 The clamped output.
- Return type
 
- min(*others)#
 Returns the minimum amongst
selfand\*others.- Parameters
 *others ([scalar value type of
Math1D]) – unpacked list of scalar values or inputs to compare to- Returns
 The maximum scalar.
- Return type
 
- max(*others)#
 Returns the maximum amongst
selfand\*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
conditionnode output that can be evaluated as a gatingbool.- 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
conditionnode output that can be evaluated as a gatingbool.- 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
conditionnode output that can be evaluated as a gatingbool.- 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
conditionnode output that can be evaluated as a gatingbool.- 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
conditionnode output that can be evaluated as a gatingbool.- 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
conditionnode output that can be evaluated as a gatingbool.- Return type
 Math1D
- inRange(minValue, maxValue)#
 - Parameters
 minValue (float, int, str,
Math1D) – the floor valuemaxValue – the ceiling value
- Returns
 - return
 A
conditionnode output that can be
evaluated as a gating
bool.- Return type
 Math1D
- ifElse(outputIfTrue, outputIfFalse)#
 If-then-else output selector.
- blend(other, weight=0.5, swap=False)#
 Blends this output towards
other.
- unaryExpr(operation, returnsRadians=False)#
 Configures an expression node to run a unary expression on this plug, and returns its output.