|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| Functions in an executed script ( execfile() )
|
|
|
Hi all,
I’m running scripts with the execfile() function, via this “MainScript” I posted here (3rd post):
http://area.autodesk.com/for...parsing-a-windows-folder/
Though the scripts work well alone (when I import and run them independently), I’m facing a problem when these scripts are “executed” via my MainScript:
All the functions in these scripts seem not to be aware of all variables declared outside of them.
As these functions are called via a Tool ( Button.OnClick.Add(MyFunction) ), I can’t give them variables ( like : MyFunction(X,Y,Z) ).
So these functions can’t call other function too.
Don’t hesitate to ask for more details.
Thx
|
|
|
|
This seems to be a limitation of the way you have set your scripts unfortunately, since this limitation exists maybe using less seperate scripts, and global variables…
My computer prof. would hate me for even typing these words, but with the way callbacks work in MotionBuilder since you can’t pass paramater correctly, you need to change it up a little bit.
~Kristine
KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn
|
|
|
|
You could try to use the lambda command. It is in the standard python documents, and it will let you pass in variables and such.
|
|
|
|
|
|