PDA

View Full Version : calling addFunction without creating a new instance of a Class


asma
31st August 2007, 13:48
Hello,

I have a pluging that builds information to construct a set of clips. Once this function is called then one of the clips is returned and information in saved is some vector..

Now I need to add a new function that once called, it uses this vector to construct specific clip based on the passed parameters.. For that, I need to work with the same instance of the class that was constructed before..

the idea is to have addFunction twice.. the first for building the information and the other for using this information to return the clip wanted at any time in the same script..

How can I call addFunction without creating a new instance of a Class and using the one already created..

I hope I was clear..

thank you in advance..

gzarkadas
31st August 2007, 23:36
env->AddFunction just registers a function with Avisynth's internal function table. The function needs not only create a filter class instance and return; it can execute arbitrary code sequences as long as it returns at the end an AVSValue.

A possible implementation in your example would be to have a static variable as a flag (as well as others to hold the needed information) and branch code execution inside the function body depending on the flag's value.