nod.channels.base

class nod.channels.base.NodChannel(nod, attribute)

Bases: object

__add__(other)

Add the channel via utility node with the other channel or value

NOTE: If a string is added to the channel a new NodChannel object is created using the following logic:

NodChannel.attributeName + ‘_suffix’ results in NodChannel.attributeName_suffix

Example

node.tx + 3 (add 3 to translateX channel) node.translate + [1, 2, 3] (add 1, 2, 3 to tx, ty, tz channels respectively) node.translate + 3 (add 3 to each translate channel tx, ty and tz) node.translate + node2.rotate (Add each xyz translate channel to corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to add the current channel to

Returns

Output channel of the plusMinusAverage utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__contains__(channel)
__dict__ = mappingproxy({'__module__': 'nod.channels.base', '__init__': <function NodChannel.__init__>, 'byPlugName': <classmethod object>, '__repr__': <function NodChannel.__repr__>, '__str__': <function NodChannel.__str__>, '__contains__': <function NodChannel.__contains__>, '__lshift__': <function NodChannel.__lshift__>, '__rshift__': <function NodChannel.__rshift__>, '__ne__': <function NodChannel.__ne__>, '__eq__': <function NodChannel.__eq__>, '__add__': <function NodChannel.__add__>, '__radd__': <function NodChannel.__radd__>, '__sub__': <function NodChannel.__sub__>, '__rsub__': <function NodChannel.__rsub__>, '__mul__': <function NodChannel.__mul__>, '__rmul__': <function NodChannel.__rmul__>, '__div__': <function NodChannel.__div__>, '__rdiv__': <function NodChannel.__rdiv__>, '__pow__': <function NodChannel.__pow__>, '__rpow__': <function NodChannel.__rpow__>, 'visualizeOutput': <function NodChannel.visualizeOutput>, 'attributeShortName': <function NodChannel.attributeShortName>, 'attributeLongName': <function NodChannel.attributeLongName>, 'attributeType': <function NodChannel.attributeType>, 'isConnectable': <function NodChannel.isConnectable>, 'isConnectedTo': <function NodChannel.isConnectedTo>, 'depth': <function NodChannel.depth>, '_NodChannel__shift': <function NodChannel.__shift>, '_lockToggle': <function NodChannel._lockToggle>, 'disconnect': <function NodChannel.disconnect>, 'edit': <function NodChannel.edit>, 'delete': <function NodChannel.delete>, 'isLocked': <function NodChannel.isLocked>, 'lock': <function NodChannel.lock>, 'unlock': <function NodChannel.unlock>, '_hideToggle': <function NodChannel._hideToggle>, 'hide': <function NodChannel.hide>, 'unhide': <function NodChannel.unhide>, 'lockAndHide': <function NodChannel.lockAndHide>, 'unlockAndUnhide': <function NodChannel.unlockAndUnhide>, 'node': <function NodChannel.node>, 'parent': <function NodChannel.parent>, 'rename': <function NodChannel.rename>, 'set': <function NodChannel.set>, 'get': <function NodChannel.get>, 'setToDefault': <function NodChannel.setToDefault>, 'setKeyable': <function NodChannel.setKeyable>, 'setLimits': <function NodChannel.setLimits>, 'connections': <function NodChannel.connections>, 'input': <function NodChannel.input>, 'outputs': <function NodChannel.outputs>, '__dict__': <attribute '__dict__' of 'NodChannel' objects>, '__weakref__': <attribute '__weakref__' of 'NodChannel' objects>, '__doc__': None, '__hash__': None, '__annotations__': {}})
__div__(other)

Divide the channel via utility node with the other channel or value

Example

node.tx / 3 (divide translateX channel by 3) node.translate / [1, 2, 3] (divide tx by 1, ty by 2, tz by 3) Saves having to create multiple nodes. node.translate / 3 (divide each translate channel xyz by 3 ) node.translate / node2.rotate (divide each xyz translate channel by corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to divide the current channel by

Returns

Output channel of the multiplyDivide utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__eq__(other)

Checks if the current channel is identical to the one compared

Parameters

other (nod.channels.base.NodChannel) – Other channel to check

Returns

bool

__hash__ = None
__init__(nod, attribute)
__lshift__(otherOuts)

Connect to multiple outputs

i.e.:

locator.tx << (joint.tx, transform.tx)

Parameters

otherOuts (list/tuple) – List/tuple of channels to connect to

__module__ = 'nod.channels.base'
__mul__(other)

Multiply the channel via utility node with the other channel or value

Example

node.tx * 3 (multiply translateX channel by 3) node.translate * [1, 2, 3] (multiply tx by 1, ty by 2, tz by 3) Saves having to create multiple nodes. node.translate * 3 (multiply each translate channel xyz by 3 ) node.translate * node2.rotate (multiply each xyz translate channel by corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to multiply the current channel by

Returns

Output channel of the multiplyDivide utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__ne__(other)

Return self!=value.

__pow__(other, modulo=None)

Power the channel via utility node with the other channel or value

Example

node.tx ** 3 (power translateX channel by 3) node.tx ** 0.5 (sqrt translateX channel by 3) node.translate ** [1, 2, 3] (power tx by 1, ty by 2, tz by 3) Saves having to create multiple nodes. node.translate ** 3 (power each translate channel xyz by 3 ) node.translate ** node2.rotate (power each xyz translate channel by corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to power the current channel by

Returns

Output channel of the multiplyDivide utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__radd__(other)

Add the channel via utility node with the other channel or value

Example

node.tx + 3 (add 3 to translateX channel) node.translate + [1, 2, 3] (add 1, 2, 3 to tx, ty, tz channels respectively) node.translate + 3 (add 3 to each translate channel tx, ty and tz) node.translate + node2.rotate (Add each xyz translate channel to corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to add the current channel to

Returns

Output channel of the plusMinusAverage utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__rdiv__(other)

Divide the channel via utility node with the other channel or value

Example

3 / node.tx (divide 3 by translateX channel) [1, 2, 3] / node.translate (divide 1 by tx, 2 by ty, 3 by tz) Saves having to create multiple nodes. 3 / node.translate (divide 3 by each translate channel xyz) node.translate / node2.rotate (divide each xyz translate channel by corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to divide the current channel by

Returns

Output channel of the multiplyDivide utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__repr__()

Return repr(self).

__rmul__(other)

Multiply the channel via utility node with the other channel or value

Example

3 * node.tx (multiply translateX channel by 3) [1, 2, 3] * node.translate (multiply tx by 1, ty by 2, tz by 3) Saves having to create multiple nodes. 3 * node.translate (multiply each translate channel xyz by 3 ) node.translate * node2.rotate (multiply each xyz translate channel by corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to multiply the current channel by

Returns

Output channel of the multiplyDivide utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__rpow__(other, modulo=None)

Power the channel via utility node with the other channel or value

Example

3 ** node.tx (3 to the power of translateX channel) [1, 2, 3] ** node.translate (1 to the power of tx, 2 to ty, 3 to tz) Saves having to create multiple nodes. 3 ** node.translate (3 to the power of each translate channel xyz) node.translate ** node2.rotate (power each xyz translate channel by corresponding xyz rotate channel)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to power the current channel by

Returns

Output channel of the multiplyDivide utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__rshift__(otherIn)

Connect to a single output

i.e.:

locator.tx >> joint.tx

Parameters

otherIn (nod.channels.base.NodChannel) – Channel to connect to

__rsub__(other)

Subtract the channel via utility node from the other channel or value

Example

3 - node.tx (subtract translateX channel from constant value 3) [1, 2, 3] - node.translate (subtract tx, ty, tz from 1, 2, 3 values respectively) 3 - node.translate (subtract each translate channel tx, ty and tz from values = 3) node.translate - node2.rotate (subtract each xyz rotate channel from corresponding xyz translate channels)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to subtract the current channel from

Returns

Output channel of the plusMinusAverage utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__str__()

Return str(self).

__sub__(other)

Subtract the channel via utility node from the other channel or value

Example

node.tx - 3 (subtract 3 from translateX channel) node.translate - [1, 2, 3] (subtract 1, 2, 3 from tx, ty, tz channels respectively) node.translate - 3 (subtract 3 from each translate channel tx, ty and tz) node.translate - node2.rotate (subtract each xyz rotate channel from corresponding xyz translate channels)

Parameters

other (nod.channels.base.NodChannel/float) – Either another channel or value to subtract the current channel from

Returns

Output channel of the plusMinusAverage utility node.

The dimension of the output is determined by the dimension of the current channel

Return type

nod.channels.base.NodChannel

__weakref__

list of weak references to the object (if defined)

attributeLongName()

Current attribute name as attributeLongName

Returns

Long attribute name

Return type

str

attributeShortName()

Current attribute name as attributeShortName

Returns

Short attribute name

Return type

str

attributeType()
Returns

Maya attribute type

Maya attribute types and example channels:

addr : addr ambientLightShape1.objectId byte : byte AISEnvFacade1.isHistoricallyInteresting char : char ambientLightShape1.objectType compound : typeFailed aimConstraint1.objectGroups double : typeFailed AISEnvFacade1.extraLightShadowWidth double2 : TdataCompound texLattice1.latticePoint double3 : double3 aimConstraint1.boundingBoxMin double4 : double4 aimConstraint1.rotateQuaternion doubleAngle : TdataCompound blendDevice1.inputAngle doubleLinear : TdataCompound blendDevice1.inputLinear enum : enum AISEnvFacade1.nodeState float : typeFailed AISEnvFacade1.extraLightIntensity float2 : float2 ambientLightShape1.uvCoord float3 : float3 AISEnvFacade1.backgroundColor floatAngle : floatAngle animBlendNodeAdditiveFA1.inputA floatLinear : floatLinear animBlendNodeAdditiveFL1.inputA fltMatrix : matrix ambientLightShape1.matrixWorldToEye generic : mesh geoConnector1.localGeometry lightData : TdataCompound ambientLightShape1.lightData long : typeFailed aimConstraint1.objectGroupId long2 : TdataCompound subdivToPoly1.outSubdCVId long3 : long3 blendShape1.function matrix : typeFailed cMuscleCreator1.insertMatrix message : message AISEnvFacade1.message polyFaces : typeFailed polySurfaceShape1.face short : short AISEnvFacade1.antiAliasingQuality short2 : short2 greasePlaneShape1.coverage time : TdataCompound character1.timeValues typed : nurbsCurve bezierCurveToNurbs1.inputCurve

Return type

str

classmethod byPlugName(plugName)
Parameters

plugName (str) – Full plug name i.e.: “locator1.translateX”

Returns

NodChannel object

Return type

nod.channels.base.NodChannel

connections(*args, **kwargs)

Using maya.cmds.listConnections method

Returns

List of connections

Return type

(list)

delete()

Using the maya.cmds.deleteAttr()

depth()

Determine the depth of the channel typically [1-3]

Returns

Depth of the current channel

Return type

int

disconnect(inputs=True, outputs=True)

Disconnect channel from other connected channels :param inputs: If True disconnect incoming connections :type inputs: bool :param outputs: If True disconnect outgoing connections :type outputs: bool

Returns

Originally connected channels

Return type

list

edit(*args, **kwargs)

Overloading the maya.cmds.addAttr(e=True) mode

get(asVector=False)
hide()
input(type=None, exactType=False, skipConversionNodes=True)

Get the incoming connection channel object

Parameters
  • type (str) – Filter by provided type only i.e.: “joint”

  • exactType (bool) – When True, type only considers node of this exact type. Otherwise, derived types are also taken into account.

  • skipConversionNodes (bool) – If True, skip over unit conversion nodes and return the node connected to the conversion node on the other side. Default True.

Returns

Input channel

Return type

nod.channels.base.NodChannel

isConnectable()
Returns

Is the channel connectable

Return type

bool

isConnectedTo(other)

Returns True if both channels are connected

Parameters

other (nod.channels.base.NodChannel) – Other channel to check for connections

Returns

bool

isLocked()
lock()
lockAndHide()
node()
outputs(type=None)

Get list of outgoing connections channel objects

Returns

List of output channels

Return type

list

parent()
rename()
set(*args, **kwargs)
setKeyable(state)

Set the value :param state: If True attribute is set to keyable :type state: bool

setLimits(min=None, max=None)

Sets the attribute value limits :param min: Minimum value or None (no limit) :type min: float :param max: Maximum value or None (no limit) :type max: float

setToDefault()

Sets the attribute value to default value(s) If compound attribute is being called all children will be set to default

unhide()
unlock()
unlockAndUnhide()
visualizeOutput(attributeName)
Parameters

attributeName (str) –

Returns:

class nod.channels.base.NodChannelUtilityOperations(channel)

Bases: object

ADD = 'plus'
AVERAGE = 'average'
DIVIDE = 'divide'
MULTIPLY = 'multiply'
POWER = 'power'
SUBTRACT = 'minus'
__dict__ = mappingproxy({'__module__': 'nod.channels.base', 'MULTIPLY': 'multiply', 'DIVIDE': 'divide', 'POWER': 'power', 'ADD': 'plus', 'SUBTRACT': 'minus', 'AVERAGE': 'average', '__init__': <function NodChannelUtilityOperations.__init__>, 'multiply': <function NodChannelUtilityOperations.multiply>, '_rmultiply': <function NodChannelUtilityOperations._rmultiply>, 'divide': <function NodChannelUtilityOperations.divide>, '_rdivide': <function NodChannelUtilityOperations._rdivide>, 'power': <function NodChannelUtilityOperations.power>, '_rpower': <function NodChannelUtilityOperations._rpower>, '_multiplyDivide': <function NodChannelUtilityOperations._multiplyDivide>, 'add': <function NodChannelUtilityOperations.add>, '_radd': <function NodChannelUtilityOperations._radd>, 'subtract': <function NodChannelUtilityOperations.subtract>, '_rsubtract': <function NodChannelUtilityOperations._rsubtract>, 'average': <function NodChannelUtilityOperations.average>, '_plusMinusAverage': <function NodChannelUtilityOperations._plusMinusAverage>, '_plusMinusAverageConnections': <function NodChannelUtilityOperations._plusMinusAverageConnections>, '_multiplyDivideConnections': <function NodChannelUtilityOperations._multiplyDivideConnections>, 'blend': <function NodChannelUtilityOperations.blend>, 'clamp': <function NodChannelUtilityOperations.clamp>, 'condition': <function NodChannelUtilityOperations.condition>, '_setOrConnectConditionBool': <function NodChannelUtilityOperations._setOrConnectConditionBool>, 'remap': <function NodChannelUtilityOperations.remap>, 'reverse': <function NodChannelUtilityOperations.reverse>, 'isSingleValue': <classmethod object>, 'isMultiValue': <classmethod object>, 'isChannel': <classmethod object>, '_whichChannelXYZ': <function NodChannelUtilityOperations._whichChannelXYZ>, '_whichChannelRGB': <function NodChannelUtilityOperations._whichChannelRGB>, '_NodChannelUtilityOperations__utilityNodeName': <function NodChannelUtilityOperations.__utilityNodeName>, '_NodChannelUtilityOperations__plusMinusConnectionSlotIndexes': <function NodChannelUtilityOperations.__plusMinusConnectionSlotIndexes>, '_NodChannelUtilityOperations__multiplyDivideConnectionSlotIndexes': <function NodChannelUtilityOperations.__multiplyDivideConnectionSlotIndexes>, '__dict__': <attribute '__dict__' of 'NodChannelUtilityOperations' objects>, '__weakref__': <attribute '__weakref__' of 'NodChannelUtilityOperations' objects>, '__doc__': None, '__annotations__': {}})
__init__(channel)
Parameters

channel (nod.channels.base.NodChannel) – Channel to do operations on

Returns

Resulting utility node output channel

Return type

(nod.channels.base.NodChannel)

__module__ = 'nod.channels.base'
__weakref__

list of weak references to the object (if defined)

add(other, name=None)

Add the channel with a value(s) or another channel

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

PlusMinusAverage utility node output channel for further connections

Return type

nod.channels.base.NodChannel

average(other, name=None)

Average the channel with a value(s) or another channel

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

PlusMinusAverage utility node output channel for further connections

Return type

nod.channels.base.NodChannel

blend(other, driver=None, name=None)

Blending two attributes via blendTwoAttr node

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • driver (nod.channels.base.NodChannel) – Channel that serves as the blend driver (0-1)

Returns

Utility node output channel for further connections

Return type

nod.channels.base.NodChannel

clamp(min=None, max=None, name=None)

TODO: Make this a class Operations on the clamp node

Parameters
  • min (nod.channels.base.NodChannel/float/tuple) – Minimum value(s) either single (r), tuple(r, b), or tuple(r, g, b)

  • max (nod.channels.base.NodChannel/float/tuple) – Maximum value(s) either single (r), tuple(r, b), or tuple(r, g, b)

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

Clamp utility node output channel for further connections

Return type

nod.channels.base.NodChannel

condition(secondTerm, operationMode, ifTrue=None, ifFalse=None, name=None)

TODO: Make this a class Operations on the condition node

Parameters
  • secondTerm (nod.channels.base.NodChannel/float) – A driving channel or value

  • operationMode (int) – Compare operation mode following maya attributes 0: ‘equal’ 1: ‘not equal’ 2: ‘greater than’ 3: ‘greater or equal’ 4: ‘less than’ 5: ‘less or equal’

  • ifTrue (nod.channels.base.NodChannel/float/tuple) – A resulting channel or value(s) if condition is True

  • ifFalse (nod.channels.base.NodChannel/float/tuple) – A resulting channel or value(s) if condition is False

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

Condition node output channel

Return type

nod.channels.base.NodChannel

divide(other, name=None)

Divide the channel with a value(s) or another channel

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

MultiplyDivide utility node output channel for further connections

Return type

nod.channels.base.NodChannel

classmethod isChannel(other)
classmethod isMultiValue(other)
classmethod isSingleValue(other)
multiply(other, name=None)

Multiply the channel with a value(s) or another channel

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

MultiplyDivide utility node output channel for further connections

Return type

nod.channels.base.NodChannel

power(other, name=None)

Power the channel with a value(s) or another channel

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

MultiplyDivide utility node output channel for further connections

Return type

nod.channels.base.NodChannel

remap(inputRange=None, outputRange=None, positions=None, values=None, interpolations=None, name=None)
Parameters
  • channel (nod.channels.base.NodChannel) – Input Channel

  • inputRange (nod.channels.base.NodChannel/tuple) – Tuple of Min and Max input values (or NodChannel)

  • outputRange (nod.channels.base.NodChannel/tuple) – Tuple of Min and Max output values (or NodChannel)

  • positions (list) – List of positions for each value provided. Ignored if no values

  • values (list) – List of values for each position. Ignored if no positions

  • interpolations (list)) – List of interpolation modes for each position. If None, all use default Linear mode 0 - None 1 - Linear (default) 2 - Smooth 3 - Spline

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

Remap node output channel

Return type

nod.channels.base.NodChannel

reverse(name=None)
Returns

(NodChannel)

subtract(other, name=None)

Subtract the channel with a value(s) or another channel

Parameters
  • other (nod.channels.base.NodChannel/float/list) – Channel or values to operate with

  • name (str) – Utility node name. If not specified creates the name based on channel names

Returns

PlusMinusAverage utility node output channel for further connections

Return type

nod.channels.base.NodChannel

class nod.channels.base.Suffix

Bases: object

ADD = 'add'
AVERAGE = 'avg'
BLEND = 'blend'
CLAMP = 'clamp'
CONDITION = 'cond'
DISTANCE = 'dist'
DIVIDE = 'div'
MULTIPLY = 'mul'
POWER = 'pow'
REMAPVALUE = 'rmpv'
REVERSE = 'rev'
SUBTRACT = 'sub'
__dict__ = mappingproxy({'__module__': 'nod.channels.base', 'ADD': 'add', 'AVERAGE': 'avg', 'BLEND': 'blend', 'CLAMP': 'clamp', 'CONDITION': 'cond', 'DISTANCE': 'dist', 'DIVIDE': 'div', 'MULTIPLY': 'mul', 'POWER': 'pow', 'REMAPVALUE': 'rmpv', 'REVERSE': 'rev', 'SUBTRACT': 'sub', '__dict__': <attribute '__dict__' of 'Suffix' objects>, '__weakref__': <attribute '__weakref__' of 'Suffix' objects>, '__doc__': None, '__annotations__': {}})
__module__ = 'nod.channels.base'
__weakref__

list of weak references to the object (if defined)