Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / -cc & -ec wont write the variable?
  RSS 2.0 ATOM  

-cc & -ec wont write the variable?
Rate this thread
 
63953
 
Permlink of this thread  
avatar
  • J.D.
  • Posted: 27 January 2012 09:58 PM
  • Location: Berlin
  • Total Posts: 65
  • Joined: 17 November 2010 04:53 AM

Here’s what I have (within my window )

textField -w 200 -tx $gVar_ccAttr_specFootAttr[0] -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[0] .");
  
$gVar_ccAttr_specFootAttr[0] = `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[0] = `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! :)



AutoWalk script out on CreativeCrash!
http://www.creativecrash.com/may...gins/animation/c/autowalk
Jeeves Simple Biped Rig:
http://www.creativecrash.com/maya/downloads/character-rigs/c/jeeves
Dload, test & share! Feedback very much appreciated!

Replies: 0
avatar
  • ldunham1
  • Posted: 29 January 2012 05:16 AM

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[0] -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[0] .");
    
$gVar_ccAttr_specFootAttr[0] = `textField -query -tx $tField`;
    print 
“Update procedure Complete.;
}


Lee Dunham | Character TD
ldunham.blogspot.com

Replies: 1
/img/forum/dark/default_avatar.png

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. :P
But I’ll give it a shot if it works like that. Thx lee :)

Author: J.D.

Replied: 22 February 2012 12:19 AM