SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / Variable from the sum of two variables

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
25-06-2021, 03:53 AM   #1
gatopingado
Registered User
 
Join Date: Jun 2021
Posts: 1
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!

  Reply with quote
Reply

Tags
mel , variable

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable expansion in *.mod module files? meghaakash74 Maya Basics & Newbie Lounge 0 26-10-2020 09:34 AM
Maya remembering old variables... Memory Leak? junkyBob Programming 0 06-05-2012 02:24 PM
error: it is an undeclared variable, but...I've declared! laiamulet Programming 2 06-11-2006 01:51 PM
Variable names and variable names!!! Forlax Programming 1 30-01-2006 02:11 AM
local and global variables ?? lalamax3d Programming 4 08-05-2003 06:57 AM