Thanks Sven,
I've come up with a work around and would love to know what you think before I release it into the wild:
My purpose for putting the #include inside the embedded script was to use the same functions in each button (functions inside the "file.grg") while having different buttons pass different arguments to the functions. So for a complete picture, if file.grg looks like this
Code: Select all
PARAM none
tv_nop
EXIT
FUNCTION doStuff(X)
//stuff...
tv_warn X
RETURN
END
The following would be the embedded script of a button:
Code: Select all
doStuff("I feel INCLUDED!")
#INCLUDE "file.grg"
another button might have
Code: Select all
doStuff("I feel EMBEDDED!")
#INCLUDE "file.grg"
etc...
Since it is really only to pass an argument to a function I don't want to put directly inside the action and it looks like #INCLUDE is sketchy at best for a shareable tvpx - i turn to the userstring and tv_runscript. file.grg gets modified:
Code: Select all
PARAM none
tv_readuserstring "MyScriptSettings" "VariableString"
doStuff(result)
EXIT
FUNCTION doStuff(X)
//stuff...
tv_warn X
RETURN
END
and the embedded script now looks like:
Code: Select all
tv_writeuserstring "MyScriptSettings" "VariableString" "I might just be crazy enough to work!" //define string value specific to the button where this is embedded
tv_getPath config
tv_runscript result"george/file.grg"
Basically I am passing the argument to the desired function via the user string. Make sense? Can you see any reason this wouldn't work as a shared tvpx?
One more step must be taken to ensure the script are actually installed where they are needed. In another action I would add a command:
Code: Select all
tv_writeuserstring "MyScriptSettings" ""
to reset the variable string to null. and then add a "Set Script" command that points to "file.grg" to ensure that the tvpx export grabs it. Of course pushing that dummy button would simply do nothing.
One more thing I wanted to ask:
A word of caution on using any data stored in the "default" folders, for instance:
/Users/Me/Library/tvp animation 11/default/george/file.grg
I'm pretty sure all that data is from your LAST TVPaint session. All current data is mainained in TVPaint memory as it is continually updated while TVPaint is running.
If the user has just installed my tvpx, can count on file.grg being found in the george folder - assuming I've taken the precaution described above? Should I ask them to restart TVPaint?
This was a long one. Thanks for reading!