[Maya] - Expression giving unexpected results. Possible Maya 2016bug?

Hey all,

I have an odd expression issue currently and I’m not sure what’s going on. If you have any idea I’d love to hear your thoughts.

Below is the expression that’s not working in Maya 2016-

//////////////////
vector $pointA = pointPosition curve1.cv[1];
vector $pointB = pointPosition curve1.cv[0];
vector $distV = $pointA - $pointB;
float $TransValue = (mag($distV)/25)-1;
if ($TransValue > 1) $TransValue = 1;
if ($TransValue < 0) $TransValue = 0;
print $TransValue;
brush2.transparency1R = $TransValue;
brush2.transparency1G = $TransValue;
brush2.transparency1B = $TransValue;
//////////////////

when running this expression I get this error -

// Error: An execution error occured in the expression expression1. //
// Error: line 0: No object matches name: curve1.cv[1] //

Now I know for a fact that object curve1.cv[1] exists… I can select it with both melscript and python… The interesting part about all of this is if I turn off setting the brush transparency, everything works fine… “$TransValue” get’s calculated fine, no errors, and I can even set the transparency values of “brush2” with static integers and everything works fine…

but when driving the brush2.transparency with the $TransValue variable, Maya flips a tit. Any ideas?

I’m just confused because it either should not work at all or work in this instance… I shouldn’t be able to set the values of the “brush2.transparency” with static numbers OR “$TransValue” shouldn’t calculate correctly when I comment out the last 3 lines of the transparency setting.

Thanks guys and gals.

Figured it out (or at least how to get it to work… I still don’t know what was wrong with the script). I’ve modified the expression with the setAttr which seems to be working fine. The end result looks like this -

//////
vector $pointA = pointPosition curve8.cv[1];
vector $pointB = pointPosition curve8.cv[0];
vector $distV = $pointA - $pointB;
float $TransValue = (mag($distV)/25)-1;
if ($TransValue > 1) $TransValue = 1;
if ($TransValue < 0) $TransValue = 0;
setAttr “brush9.transparency1” -type double3 $TransValue $TransValue $TransValue;

////

Cheers!