View Single Post
# 1 25-06-2021 , 03:53 AM
Registered User
Join Date: Jun 2021
Posts: 2

Variable from the sum of two variables

Hi folks, I'm learning MEL and having trouble understating what's going on here.

I'm trying to get a variable from the sum of another two variables defined by object attributes, for example:

float $scaleY = `getAttr "pCube1.scaleY"`;
float $scaleX = `getAttr "pCube1.scaleX"`;
float $sum = ($scaleY + $scaleX);
print $sum;

This gives me the correct result, but I'm getting this warning:

// Warning: float $scaleX = `getAttr "pCube1.scaleX"`; //
// Warning: Line 2.42 : Redeclaration of variable "$scaleX" shadows previous declaration at line 1. Previous value will be overwritten by explicit initializer. //

Where exactly I'm redeclaring variable $scaleX? Is the syntax wrong? If anyone have any suggestions it would be highly appreciated. Thanks!

user added image