#include <CVEX_Context.h>
Public Member Functions | |
| CVEX_Context () | |
| ~CVEX_Context () | |
| void | clear () |
| bool | addInput (const char *name, CVEX_Type type, bool varying) |
| bool | addInput (const char *name, CVEX_Type type, void *data, int array_size) |
| bool | addInput (const char *name, UT_StringArray &strings) |
| void | setTime (fpreal time) |
| bool | load (int argc, char *argv[]) |
| bool | load (int argc, char *argv[], int threadid) |
| Load the function for a specific thread. | |
| bool | isLoaded () const |
| Quick test to see if the function has been loaded. | |
| CVEX_ValueList & | getInputList () |
| CVEX_Value * | findInput (const char *name, CVEX_Type type) |
| Find an input by name/type. | |
| CVEX_ValueList & | getOutputList () |
| CVEX_Value * | findOutput (const char *name, CVEX_Type type) |
| Find an output by name/type. | |
| void | setOpCaller (UT_OpCaller *caller) |
| bool | getFlag (int flag) const |
| void | clearFlag (int flag) |
| Clear the VEX_Instance flag (see getFlag()). | |
| bool | run (int array_size, bool interruptable) |
Static Public Member Functions | |
| static void | clearAllFunctions () |
The CVEX_Context class provides the main interface to let C++ code call VEX to perform computations. This allows users to modify algorithms by performing computations in VEX.
CVEX/cvexsample.C, CVEX/simple.C, SOP/SOP_PrimVOP.C, and SOP/SOP_PrimVOP.h.
Definition at line 35 of file CVEX_Context.h.
| CVEX_Context::CVEX_Context | ( | ) |
| CVEX_Context::~CVEX_Context | ( | ) |
| bool CVEX_Context::addInput | ( | const char * | name, | |
| UT_StringArray & | strings | |||
| ) |
Add an "string <name>" input. An array length of 1 makes the variable uniform.
| bool CVEX_Context::addInput | ( | const char * | name, | |
| CVEX_Type | type, | |||
| void * | data, | |||
| int | array_size | |||
| ) |
If you know the value beforehand, you can add the symbol and it's value at the same time.
| bool CVEX_Context::addInput | ( | const char * | name, | |
| CVEX_Type | type, | |||
| bool | varying | |||
| ) |
Add possible input parameters to the function. These are parameters whose values are overridden by values you pass in. If the user's VEX function has these parameters the C++ code should assign the values after calling load(), but before calling run().
Calling this version of addInput() allows you to defer computing the value of the variable until you know whether it will actually be used by the VEX function.
| void CVEX_Context::clear | ( | ) |
clearing the context will allow you to set up the input and output parameters again.
| static void CVEX_Context::clearAllFunctions | ( | ) | [static] |
calling clearAllFunctions() will force all CVEX object code to be flushed out of memory and to be reloaded. Be cautioned that this may have side-effects, and should only be called at a safe time.
| void CVEX_Context::clearFlag | ( | int | flag | ) |
| CVEX_Value* CVEX_Context::findInput | ( | const char * | name, | |
| CVEX_Type | type | |||
| ) | [inline] |
Find an input by name/type.
Definition at line 101 of file CVEX_Context.h.
| CVEX_Value* CVEX_Context::findOutput | ( | const char * | name, | |
| CVEX_Type | type | |||
| ) | [inline] |
Find an output by name/type.
Definition at line 113 of file CVEX_Context.h.
| bool CVEX_Context::getFlag | ( | int | flag | ) | const |
Gets and clears the VEX_Instance flags on the underlying instance. This can only be done after the vex function has been successfully loaded.
| CVEX_ValueList& CVEX_Context::getInputList | ( | ) | [inline] |
The list of input parameters to the function. It's possible that these values may be shared between the input and output lists.
Definition at line 99 of file CVEX_Context.h.
| CVEX_ValueList& CVEX_Context::getOutputList | ( | ) | [inline] |
The list of output parameters from the function. After the function has been run, the output parameters will have their values written to by VEX.
If the output has not had CVEX_Value::setData() called, then the data will have been written to internal storage and can be retrieved calling CVEX_Value::getData().
Definition at line 111 of file CVEX_Context.h.
| bool CVEX_Context::isLoaded | ( | ) | const [inline] |
| bool CVEX_Context::load | ( | int | argc, | |
| char * | argv[], | |||
| int | threadid | |||
| ) |
Load the function for a specific thread.
| bool CVEX_Context::load | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Load the VEX function. Inputs must be specified before this function is called. After loading, the input list will have flags set telling you whether the input parameter is used. At this point, you should set the data for all used inputs.
The list of outputs will also be defined, meaning that you can figure out what's going to be written by the VEX function.
If errors occured in loading they are added to the current vex error manager.
| bool CVEX_Context::run | ( | int | array_size, | |
| bool | interruptable | |||
| ) |
Run the VEX function given a list of input variables and a list of output parameters. Each input/output parameter under your control should have an array size of either 1 or at least the array_size given to the run() method. It's possible to run on fewer array elements than have been allocated, but an error will be returned if there are input parameters which don't have enough allocation.
Pass in true for interruptable when running from within Houdini.
The run() function may be called multiple times, provided that the input parameters don't change. So, if you need to evaluate the data in chunks, you can do this by re-initializing the input parameter data between calls to run(). However, you should not change the uniform/varying state of any input parameters without doing a re-load of the VEX function.
| array_size | The size of varying arrays. All varying arrays must be this size. | |
| interruptable | If true, VEX will check the state of the UT_Interrupt. This should be enabled when called from within Houdini. If interruptable is false, then the user will not be able to break out of endless loops in VEX. It's better to leave it true if you are unsure. |
| void CVEX_Context::setOpCaller | ( | UT_OpCaller * | caller | ) |
Sets the OP callback. This is used to setup dependencies on any referenced op: expressions. Can be applied to the context at any time.
| void CVEX_Context::setTime | ( | fpreal | time | ) |
Set the evaluation time. This is what will be used by op: references triggered by VEX commands like volumesample. If not set, the current channel time is used instead (if an OP_Director is available).
1.5.9