namoi
11-10-2010, 12:48 PM
I have a strange problem with a macroscript which basically call a scripted render effect : monochrome.
The render effect is in the startup script directory and is visible in the add effect window.
The macroscript is executed via a toolbar button.
In the mcr I call the effect via the addeffect (monochrome()) command in the on execute event handler.
I launch max to be sure all variable are reseted.
When i run the script i receive :
Error Exception: -- Type error: Call needs function or class, got: undefined
OK, i can understand that the function monochrome() is undefined in the scope of the macroscript, but as the scripted effect is in the startup directory, the monochrome() should be global ?
Funny things : if i relaunch max (to reset again the variables), open the mcr in the editor and Evaluate it, after i can run it and evrything is fine.
After diging a while i came with this nasty workaround :
I create a simple script which contains the addeffect (monochrome()) command and call it in the mcr (instead of the command) with getfilein and again evry thing works like a charm except that i must create this nasty little script.
So why this strange behaviour which for sure is related to scope of variables ?
Thanks
The render effect is in the startup script directory and is visible in the add effect window.
The macroscript is executed via a toolbar button.
In the mcr I call the effect via the addeffect (monochrome()) command in the on execute event handler.
I launch max to be sure all variable are reseted.
When i run the script i receive :
Error Exception: -- Type error: Call needs function or class, got: undefined
OK, i can understand that the function monochrome() is undefined in the scope of the macroscript, but as the scripted effect is in the startup directory, the monochrome() should be global ?
Funny things : if i relaunch max (to reset again the variables), open the mcr in the editor and Evaluate it, after i can run it and evrything is fine.
After diging a while i came with this nasty workaround :
I create a simple script which contains the addeffect (monochrome()) command and call it in the mcr (instead of the command) with getfilein and again evry thing works like a charm except that i must create this nasty little script.
So why this strange behaviour which for sure is related to scope of variables ?
Thanks
