Global /Local Proc. Clearification

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2012
Global /Local Proc. Clearification

right now I have created a script file.. call it script.mel for now.

right now it looks closely too:


myGui;

global proc myGui(){
makes the gui;
}

proc buttnChck(){
checks the state of elements in the gui and enables/disables certain portions of the gui
}

proc Names(){
Contains Arrays of Names and suf/prefixes to be used throgh out the script.
}
proc Positions(){
contains a matrix with default x, y ,z positions and a loop to get the positions of certain elements
}
....


The Problem I'm experiencing is that; out side of the GUI proc, if I don't declare the procedure's as global... the script breaks with the error of "cannot find procedure /Name/". Right now its ButtnChck.. but if I change it to global the next non-global proc causes the error. Any one have an idea as to the solution, besides making everything global- I'd like to avoid that for now.

In a second question: Is it possible to declare a matrix of lets say 0,0 and have its size updated- let say have 3 arrays representing x,y,z cordinates?
 
  02 February 2012
In this case you need to declare your local procs before they are called, so before the global proc. Maya does not allow you to forward reference locally scoped procedures.

http://download.autodesk.com/global...er=d28 e667493
 
  02 February 2012
Zero- I did that as well.

Moved the Gui proc to the the last procedure declared, and every thing else it refrences to be above it:
Looks like:
 
myGui;

proc Names(){
}

proc Positions(){
}

proc buttnChck(){
}

global proc myGui(){
}


Still get the error of cannot find procedure ButtnChck (gets called when a texfieldButtonGrp's command is pressed).

Wood moving the call to the gui (currently at the begining of the file) to the end of the file change things?

Last edited by th3m3nt4l : 02 February 2012 at 02:05 PM.
 
  02 February 2012
GUI controls or callbacks cannot reference local procs. Anything on a button -command, or a slider -dragCommand or a textField -updateOnKeyPress, or tabLayout -changeTabCmd, or -dropControl, etc, etc, etc, must be a global proc.
local procs can only be called directly from the single script file they exist in, not from UI and not from any kind of deferred evaluation.
 
  02 February 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:46 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.