Forcing a connection without a unitConversion


#1

Anyone know a way to connect attributes of different units without Maya helpfully creating a unitConversion?

I have code that creates a rotation attribute and wants to move all connections from a rotate attribute to it. This works fine, except for expression attributes set to unitConversion “none”: Maya adds a unitConversion and breaks the expression (since the unitConversion magic only happens when editing with the “expression” command, connectAttr doesn’t know about it). I don’t want Maya to do helpful clever things, I just want it to make the connection I’m telling it to.

It would also be useful when autogenerating complex node networks. I have node networks that are 40% unitConversion nodes, and I’d rather sacrifice intermediate results being in degrees for a lighter, easier to debug network.

I can’t find a way to do this with PyMel or MDGModifier. The file format does it (.ma files just do a connectAttr), but I think that’s load-time magic. Anyone have any ideas?


#2

Since maya is intent on adding these things when attribute units don’t match is there any reason you can just set the conversion value to 1 for those situations when you want the data to just pass though?

David


#3

That would work around that side of the problem (also checking if it was a unitConversion in the first place, to avoid stomping on connections that were converted in the first place). But I intentionally avoided the unitConversions in the first place when setting up the expressions and I was trying to preserve that…