-cc & -ec wont write the variable?

-cc & -ec wont write the variable?

Anonymous
Not applicable
567 Views
2 Replies
Message 1 of 3

-cc & -ec wont write the variable?

Anonymous
Not applicable
Here's what I have (within my window )
textField -w 200 -tx $gVar_ccAttr_specFootAttr -ec wv_ccAttr_heelUpDown ccAttr_heelUpDown_txField; 



the proc being called is in a .mel file with all the other wv_ procs (around 21 of them, all the same layout as this one;other ones wont work properly either)


global proc wv_ccAttr_heelUpDown()
{
global string $gVar_ccAttr_heelUpDown_txField;
global string $gVar_ccAttr_specFootAttr[];
print ("Variable updated; New value applied to $gVar_ccAttr_specFootAttr .");
$gVar_ccAttr_specFootAttr = `textField -query -tx $gVar_ccAttr_heelUpDown_txField`;
print "Update procedure Complete.";
}


The odd thing is: when I do change the textfield, the print commands are executed just fine. sourcing the scripts isnt a problem either.

But the variable simply isn't being updated. -.-*

It works just fine when I run the
$gVar_ccAttr_specFootAttr = `textField -query -tx $gVar_ccAttr_heelUpDown_txField`;
when the window is open. But somehow MEL wont do that if its triggered by the -ec nor the -cc flags of the textfield.

I dont want to break up my pretty UI with a bunch of ugly buttons again to execute the procs. :<

Any help's appreciated! 🙂
0 Likes
568 Views
2 Replies
Replies (2)
Message 2 of 3

lee.dunham
Collaborator
Collaborator
hmm sounds like Maya doesnt know what textField to query, so the steps between calling the proc and the proc sourcing the global var
global string $gVar_ccAttr_heelUpDown_txField;

Where are you telling maya the name of the textField?

Personally, unless I absolutely had to, I wouldnt bother using global vars to store the name of entryFields I want to query or edit, and I cant think of a reason you'd need to.
Instead i'd pass their name as through an argument.

textField -w 200 -tx $gVar_ccAttr_specFootAttr -ec "wv_ccAttr_heelUpDown "\ccAttr_heelUpDown_txField"\" ccAttr_heelUpDown_txField;

global proc wv_ccAttr_heelUpDown(string $tField)
{
global string $gVar_ccAttr_specFootAttr[];
print ("Variable updated; New value applied to $gVar_ccAttr_specFootAttr .");
$gVar_ccAttr_specFootAttr = `textField -query -tx $tField`;
print “Update procedure Complete.”;
}
0 Likes
Message 3 of 3

Anonymous
Not applicable
I store them in gVars cuz I know how I tend to rename stuff every other release, so this way I only have to change it in the init script, where I tell maya the name of the fields. 😛
But I'll give it a shot if it works like that. Thx lee 🙂
0 Likes