Replace expressions with a node network problem


#1

With the more recent versions of maya, optimizations have speed up node networks a lot to a point where a node network can be 100 times faster then a expression.

Because of this I’ve been replacing some of my expressions with node networks, but I’ve now hit a problem that I’m not sure can be fixed.

In a expression I can take a attribute value, do something with it and then replace it with a new value.
When I try to do this in a node network I get a cycle error because the network loops back in a circle.

For example, take a simplified wheel rotation expression like this;

float $Rot = pTorus1.translateZ - pTorus1.Offset;
pTorus1.rotateX += ($Rot * 38.215); // 38.215 is 360/(diameter * 3.14)
pTorus1.Offset = pTorus1.translateZ;

The first line gets a extra attribute called Offset, but then the last line sets this attribute after it’s been used.
This would cause a cycle error with a node network.

Does anyone know if there is a way to avoid this and re-create the above expression in a node network?