### Get Parameter Value Example Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxParameterSuiteV1.html Demonstrates how to retrieve the value of a double parameter and a color parameter. Use this function within kOfxActionInstanceChanged or interact actions, not render actions. ```c OfxParamHandle myDoubleParam, *myColourParam; ofxHost->paramGetHandle(instance, "myDoubleParam", &myDoubleParam); double myDoubleValue; ofxHost->paramGetValue(myDoubleParam, &myDoubleValue); ofxHost->paramGetHandle(instance, "myColourParam", &myColourParam); double myR, myG, myB; ofxHost->paramGetValue(myColourParam, &myR, &myG, &myB); ``` -------------------------------- ### Choice Parameter Options and Order Example Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex.html Demonstrates how to set options and their display order for a choice parameter in different plugin versions. This affects UI display but not the stored index. ```c++ Plugin v1: Option = {"OptA", "OptB", "OptC"} Order = {1, 2, 3} Plugin v2: // will be shown as OptA / OptB / NewOpt / OptC Option = {"OptA", "OptB", "OptC", NewOpt"} Order = {1, 2, 4, 3} ``` -------------------------------- ### OpenFX Pixel Processing Setup Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample2_Invert.html Fetches input and output image information, including row bytes, bounds, and data pointers. Throws an exception if essential pointers are null. ```cpp // fetch output image info from the property handle int dstRowBytes; OfxRectI dstBounds; void *dstPtr = NULL; gPropertySuite->propGetInt(outputImg, kOfxImagePropRowBytes, 0, &dstRowBytes); gPropertySuite->propGetIntN(outputImg, kOfxImagePropBounds, 4, &dstBounds.x1); gPropertySuite->propGetPointer(outputImg, kOfxImagePropData, 0, &dstPtr); if(dstPtr == NULL) { throw "Bad destination pointer"; } // fetch input image info from the property handle int srcRowBytes; OfxRectI srcBounds; void *srcPtr = NULL; gPropertySuite->propGetInt(sourceImg, kOfxImagePropRowBytes, 0, &srcRowBytes); gPropertySuite->propGetIntN(sourceImg, kOfxImagePropBounds, 4, &srcBounds.x1); gPropertySuite->propGetPointer(sourceImg, kOfxImagePropData, 0, &srcPtr); if(srcPtr == NULL) { throw "Bad source pointer"; } ``` -------------------------------- ### kOfxImageEffectPropColourManagementAvailableConfigs Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex.html Specifies the native mode colour management configurations supported by the host or plug-in. This allows for negotiation of compatible colour management setups. ```APIDOC ## kOfxImageEffectPropColourManagementAvailableConfigs ### Description What native mode configs are supported? This property must be set by both plug-ins and hosts specifying the list of native mode configs that are available on each side. ### Valid Values A list of config identifiers. The only currently supported value is ` ofx-native-v1.5_aces-v1.3_ocio-v2.3`. ``` -------------------------------- ### Set Parameter Value Example Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxParam_8h.html Shows how to set the current value of a parameter. This function should only be called from within kOfxActionInstanceChanged or interact actions. ```cpp ofxHost->paramSetValue(instance, "myDoubleParam", double(10)); ofxHost->paramSetValue(instance, "myColourParam", double(pix.r), double(pix.g), double(pix.b)); ``` -------------------------------- ### Get Host Name and Copy String Source: https://openfx.readthedocs.io/en/main/Reference/ofxCoreAPI.html Demonstrates how to retrieve a string property from the host and the necessity of copying it before the next API call, as the original pointer's validity is limited. ```c // pointer to store the returned value of the host name char *returnedHostName; // get the host name propSuite->propGetString(hostHandle, kOfxPropName, 0, &returnedHostName); // now make a copy of that before the next API call, as it may not be valid after it char *hostName = strdup(returnedHostName); paramSuite->getParamValue(instance, "myParam", &value); ``` -------------------------------- ### Initialize Host and Fetch Suites (C++) Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample1_Basics.html This C++ code demonstrates how a plugin initializes its host pointer and fetches essential suites like the Property Suite and Image Effect Suite from the host application. It's typically called during the plugin's load action. ```cpp // The anonymous namespace is used to hide symbols from export. namespace { OfxHost *gHost; OfxPropertySuiteV1 *gPropertySuite = 0; OfxImageEffectSuiteV1 *gImageEffectSuite = 0; //////////////////////////////////////////////////////////////////////////////// /// call back passed to the host in the OfxPlugin struct to set our host pointer void SetHostFunc(OfxHost *hostStruct) { gHost = hostStruct; } //////////////////////////////////////////////////////////////////////////////// /// the first action called OfxStatus LoadAction(void) { gPropertySuite = (OfxPropertySuiteV1 *) gHost->fetchSuite(gHost->host, kOfxPropertySuite, 1); gImageEffectSuite = (OfxImageEffectSuiteV1 *) gHost->fetchSuite(gHost->host, kOfxImageEffectSuite, 1); return kOfxStatOK; } } ``` -------------------------------- ### Get Standard OFX Plugin Path (Windows) Source: https://openfx.readthedocs.io/en/main/Reference/ofxPackaging.html Retrieves the default installation directory for OFX plug-ins on Windows systems. This function is used to locate plug-ins when the OFX_PLUGIN_PATH environment variable is not set. ```c #include "shlobj.h" #include "tchar.h" const TCHAR *getStdOFXPluginPath(void) { static TCHAR buffer[MAX_PATH]; static int gotIt = 0; if(!gotIt) { gotIt = 1; SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, SHGFP_TYPE_CURRENT, buffer); _tcscat(buffer, __T("\OFX\Plugins")); } return buffer; } ``` -------------------------------- ### Create Instance Action (C++) Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample3_Gain.html Handles the creation of a plugin instance by allocating and caching a MyInstanceData struct. It fetches and stores handles for source/output clips and gain/applyToAlpha parameters. ```cpp //////////////////////////////////////////////////////////////////////////////// /// instance construction OfxStatus CreateInstanceAction( OfxImageEffectHandle instance) { OfxPropertySetHandle effectProps; gImageEffectSuite->getPropertySet(instance, &effectProps); // To avoid continual lookup, put our handles into our instance // data, those handles are guaranteed to be valid for the duration // of the instance. MyInstanceData *myData = new MyInstanceData; // Set my private instance data gPropertySuite->propSetPointer(effectProps, kOfxPropInstanceData, 0, (void *) myData); // Cache the source and output clip handles gImageEffectSuite->clipGetHandle(instance, "Source", &myData->sourceClip, 0); gImageEffectSuite->clipGetHandle(instance, "Output", &myData->outputClip, 0); // Cache away the param handles OfxParamSetHandle paramSet; gImageEffectSuite->getParamSet(instance, ¶mSet); gParameterSuite->paramGetHandle(paramSet, GAIN_PARAM_NAME, &myData->gainParam, 0); gParameterSuite->paramGetHandle(paramSet, APPLY_TO_ALPHA_PARAM_NAME, &myData->applyToAlphaParam, 0); return kOfxStatOK; } ``` -------------------------------- ### Get String Property Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex.html Retrieves a single value from a string property. This function is used to get a string stored within a property. ```APIDOC ## propGetString ### Description Get a single value of a string property. ### Parameters * `properties` (OfxPropertySetHandle) - handle of the thing holding the property * `property` (const char *) - string labelling the property * `index` (int) - refers to the index of a multi-dimensional property * `value` (char **) - pointer the return location ### Return * kOfxStatOK * kOfxStatErrBadHandle * kOfxStatErrUnknown * kOfxStatErrBadIndex ``` -------------------------------- ### Get Pointer Property Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex.html Retrieves a single value from a pointer property. This function is used to get a pointer stored within a property. ```APIDOC ## propGetPointer ### Description Get a single value from a pointer property. ### Parameters * `properties` (OfxPropertySetHandle) - handle of the thing holding the property * `property` (const char *) - string labelling the property * `index` (int) - refers to the index of a multi-dimensional property * `value` (void **) - pointer the return location ### Return * kOfxStatOK * kOfxStatErrBadHandle * kOfxStatErrUnknown * kOfxStatErrBadIndex ``` -------------------------------- ### Getting Pointer Property Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxProperty_8h.html Retrieves a single value from a pointer property. This function is used to get memory addresses or references stored in properties. ```APIDOC ## propGetPointer ### Description Get a single value from a pointer property. ### Signature ```c OfxStatus (*propGetPointer)(OfxPropertySetHandle properties, const char *property, int index, void **value) ``` ### Parameters * `properties` (OfxPropertySetHandle) - Handle of the object holding the property. * `property` (const char *) - String identifier for the property. * `index` (int) - Index of the property (for multi-dimensional properties). * `value` (void **) - Pointer to a location where the retrieved pointer value will be stored. ### Return * `kOfxStatOK` - Success. * `kOfxStatErrBadHandle` - Invalid handle. * `kOfxStatErrUnknown` - Unknown property. * `kOfxStatErrBadIndex` - Invalid index. ``` -------------------------------- ### OfxSetHost Source: https://openfx.readthedocs.io/en/main/Reference/ofxCoreAPI.html This function is called by the host as the very first step after loading a plug-in binary. It allows the plug-in to receive a pointer to the host and potentially decide which effects to expose. Hosts must check for its existence as it was introduced in 2020. ```APIDOC ## OfxSetHost ### Description Called by the host after loading the plug-in binary to provide host information. ### Signature `OfxStatus OfxSetHost(const OfxHost *host)` ### Parameters * **host** (*const OfxHost **) - A pointer to the OfxHost struct. ### Return Value * **OfxStatus** - Returns `kOfxStatFailed` if the plug-in should be skipped for this host. ``` -------------------------------- ### progressStart Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxProgress_8h.html Initiates the display of a progress bar associated with a specific plugin instance. ```APIDOC ## progressStart ### Description Initiate a progress bar display. Call this to initiate the display of a progress bar. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Parameters - **effectInstance** (void *) - The instance of the plugin this progress bar is associated with. It cannot be NULL. - **label** (const char *) - A text label to display in any message portion of the progress object’s user interface. A UTF8 string. ### Return - **kOfxStatOK** - the handle is now valid for use - **kOfxStatFailed** - the progress object failed for some reason - **kOfxStatErrBadHandle** - effectInstance was invalid ``` -------------------------------- ### propGetString Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxPropertySuiteV1.html Get a single value from a string property. ```APIDOC ## propGetString ### Description Get a single value from a string property. ### Parameters #### Path Parameters - **properties** (OfxPropertySetHandle) - Description: handle of the thing holding the property - **property** (const char *) - Description: string labelling the property - **index** (int) - Description: refers to the index of a multi-dimensional property - **value** (char **) - Description: pointer the return location ### Return - kOfxStatOK - kOfxStatErrBadHandle - kOfxStatErrUnknown - kOfxStatErrBadIndex ``` -------------------------------- ### propGetPointer Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxPropertySuiteV1.html Get a single value from a pointer property. ```APIDOC ## propGetPointer ### Description Get a single value from a pointer property. ### Parameters #### Path Parameters - **properties** (OfxPropertySetHandle) - Description: handle of the thing holding the property - **property** (const char *) - Description: string labelling the property - **index** (int) - Description: refers to the index of a multi-dimensional property - **value** (void **) - Description: pointer the return location ### Return - kOfxStatOK - kOfxStatErrBadHandle - kOfxStatErrUnknown - kOfxStatErrBadIndex ``` -------------------------------- ### Main Entry Point Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxCore_8h.html The `mainEntry` function serves as the primary entry point for plug-ins. Its specific actions depend on the implemented plug-in API, but it's the gateway for all plug-in operations as defined in OFX Actions. ```APIDOC ## Main Entry Point ### Description This is the main entry point for plug-ins, directing control flow based on the specific OFX Actions being implemented. ### Function Pointer `OfxPluginEntryPoint *mainEntry` ### Preconditions - `setHost` has been called. ``` -------------------------------- ### progressStart Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxProgress_8h.html Initiates a progress bar display for a given plugin instance. It takes an effect instance, a message string, and an optional message ID. ```APIDOC ## progressStart ### Description Initiate a progress bar display. Call this to initiate the display of a progress bar. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - `effectInstance` (void *) - Required - The instance of the plugin this progress bar is associated with. It cannot be NULL. - `message` (const char *) - Required - A text label to display in any message portion of the progress object’s user interface. A UTF8 string. - `messageId` (const char *) - Optional - Plugin-specified id to associate with this message. If overriding the message in an XML resource, the message is identified with this, this may be NULL, or “”, in which case no override will occur. New in V2 of this suite. ### Request Example ```c OfxStatus status = ofxProgressSuite->progressStart(effectInstance, "Processing...", "my_progress_id"); ``` ### Response #### Success Response (kOfxStatOK) - The handle is now valid for use. #### Error Responses - kOfxStatFailed - The progress object failed for some reason. - kOfxStatErrBadHandle - `effectInstance` was invalid. #### Response Example ```c // Returns kOfxStatOK on success ``` ``` -------------------------------- ### OfxTimeLineSuiteV1::getTimeBounds Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxTimeLineSuiteV1.html Gets the current bounds on a timeline. ```APIDOC ## getTimeBounds ### Description Gets the current bounds on a timeline. ### Method `OfxStatus (*getTimeBounds)(void *instance, double *firstTime, double *lastTime)` ### Parameters #### Path Parameters - `instance` (void *) - The instance of the effect changing the timeline, cast to a void *. - `firstTime` (double *) - The first time on the timeline. This is in the temporal coordinate system of the effect. - `lastTime` (double *) - The last time on the timeline. This is in the temporal coordinate system of the effect. ### Return - `kOfxStatOK` - The time enquiry was successful. - `kOfxStatFailed` - The enquiry failed for some host specific reason. - `kOfxStatErrBadHandle` - The effect handle was invalid. ``` -------------------------------- ### paramGetIntegral Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxParameterSuiteV1.html Gets the integral of a parameter over a specific time range. ```APIDOC ## paramGetIntegral ### Description Gets the integral of a parameter over a specific time range. ### Method (Implicitly a function call within the OpenFX API) ### Parameters #### Path Parameters - **paramHandle** (OfxParamHandle) - The parameter handle to fetch the integral from. - **time1** (OfxTime) - The start time for evaluating the integral. - **time2** (OfxTime) - The end time for evaluating the integral. - **...** - One or more pointers to variables of the relevant type to hold the parameter’s integral value. ### Return - kOfxStatOK - All was OK. - kOfxStatErrBadHandle - If the parameter handle was invalid. ``` -------------------------------- ### Clip Instance Properties (Same FPS) Source: https://openfx.readthedocs.io/en/main/Reference/ofxCoordSystem.html Shows the reported frame ranges and frame rates for output and source clip instances in the first example. The output ranges from 0 to 9 at 25 FPS, and the source ranges from -4 to 15 at 25 FPS. ```text range[0] range[1] FPS Output 0 9 25 Source -4 15 25 ``` -------------------------------- ### OpenFX: Get Parameter Integral Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex Gets the integral of a parameter over a specific time range. The varargs argument must be pointers to C variables of the parameter's type. Only double and color parameters can be integrated. ```C OfxStatus(*paramGetIntegral)(OfxParamHandleparamHandle,OfxTimetime1,OfxTimetime2,...) ``` -------------------------------- ### OFX Plugin Main Entry Point Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample2_Invert.html This C++ code defines the main entry point for an OFX plugin, handling core actions like loading, describing, and rendering. It uses strcmp to match incoming actions with specific handler functions. ```cpp //////////////////////////////////////////////////////////////////////////////// // The main entry point function, the host calls this to get the plugin to do things. OfxStatus MainEntryPoint(const char *action, const void *handle, OfxPropertySetHandle inArgs, OfxPropertySetHandle outArgs) { // cast to appropriate type OfxImageEffectHandle effect = (OfxImageEffectHandle) handle; OfxStatus returnStatus = kOfxStatReplyDefault; if(strcmp(action, kOfxActionLoad) == 0) { // The very first action called on a plugin. returnStatus = LoadAction(); } else if(strcmp(action, kOfxDescribe) == 0) { // the first action called to describe what the plugin does returnStatus = DescribeAction(effect); } else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) { // the second action called to describe what the plugin does returnStatus = DescribeInContextAction(effect, inArgs); } else if(strcmp(action, kOfxImageEffectActionRender) == 0) { // action called to render a frame returnStatus = RenderAction(effect, inArgs, outArgs); } /// other actions to take the default value return returnStatus; } } // end of anonymous namespace ``` -------------------------------- ### clipGetImage Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxImageEffect_8h.html Gets a handle for an image in a clip at the indicated time and region. ```APIDOC ## clipGetImage ### Description Gets a handle for an image in a clip at the indicated time and indicated region. An image is fetched from a clip at the indicated time for the given region and returned in the imageHandle. If called twice with the same parameters, two separate image handles will be returned, each of which must be released. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method Not applicable (function signature provided) ### Endpoint Not applicable (function signature provided) ### Function Signature `OfxStatus (*clipGetImage)(OfxImageClipHandle clip, OfxTime time, const OfxRectD *region, OfxPropertySetHandle *imageHandle)` ### Parameters * `clip` (OfxImageClipHandle) - Clip to extract the image from. * `time` (OfxTime) - Time to fetch the image at. * `region` (const OfxRectD *) - Region to fetch the image from (optional, set to NULL to get a ‘default’ region). This is in the CanonicalCoordinates. * `imageHandle` (OfxPropertySetHandle *) - Property set containing the image’s data. ### Return * `OfxStatus` - Status code indicating success or failure. Possible values include `kOfxStatOK`, `kOfxStatFailed`, `kOfxStatErrBadHandle`, `kOfxStatErrMemory`. ### Preconditions * `clip` was returned by `clipGetHandle`. ### Postconditions * `imageHandle` is only valid for the duration of the action `clipGetImage` is called in. * `imageHandle` to be disposed of by `clipReleaseImage` before the action returns. ``` -------------------------------- ### OfxSetHost Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxCore_8h.html This is the first function a host should call to communicate with a plug-in. It establishes the initial connection and passes a host pointer. Plug-ins should check for its existence as it was added in a later API version. ```APIDOC ## OfxStatus OfxSetHost(const OfxHost *host) ### Description First thing host should call. This host call, added in 2020, is not specified in earlier implementation of the API. Therefore host must check if the plugin implemented it and not assume symbol exists. The order of calls is then: 1) OfxSetHost, 2) OfxGetNumberOfPlugins, 3) OfxGetPlugin The host pointer is only assumed valid until OfxGetPlugin where it might get reset. Plug-in can return kOfxStatFailed to indicate it has nothing to do here, it’s not for this Host and it should be skipped silently. ``` -------------------------------- ### OfxInteractSuiteV1::interactGetPropertySet Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex.html Gets the property set handle for this interact handle. ```APIDOC ## OfxStatus interactGetPropertySet(OfxInteractHandle interactInstance, OfxPropertySetHandle *property) ### Description Gets the property set handle for this interact handle. ### Parameters #### Path Parameters - **interactInstance** (OfxInteractHandle) - Description: The interact instance to get the property set from. - **property** (OfxPropertySetHandle *) - Description: Pointer to store the retrieved property set handle. ``` -------------------------------- ### Describe Plugin In Context (C++) Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample1_Basics.html Implement kOfxImageEffectActionDescribeInContext to define clips and their properties for a specific context. This action is called for each context the host supports for the plugin. ```cpp OfxStatus DescribeInContextAction(OfxImageEffectHandle descriptor, OfxPropertySetHandle inArgs) { // check state ERROR_ABORT_IF(gDescribeCalled == false, "DescribeInContextAction called before DescribeAction"); gDescribeCalled = true; // get the context from the inArgs handle char *context; gPropertySuite->propGetString(inArgs, kOfxImageEffectPropContext, 0, &context); ERROR_IF(strcmp(context, kOfxImageEffectContextFilter) != 0, "DescribeInContextAction called on unsupported context %s", context); OfxPropertySetHandle props; // define the mandated single output clip gImageEffectSuite->clipDefine(descriptor, "Output", &props); // set the component types we can handle on out output gPropertySuite->propSetString(props, kOfxImageEffectPropSupportedComponents, 0, kOfxImageComponentRGBA); gPropertySuite->propSetString(props, kOfxImageEffectPropSupportedComponents, 1, kOfxImageComponentAlpha); // define the mandated single source clip gImageEffectSuite->clipDefine(descriptor, "Source", &props); // set the component types we can handle on our main input gPropertySuite->propSetString(props, kOfxImageEffectPropSupportedComponents, 0, kOfxImageComponentRGBA); gPropertySuite->propSetString(props, kOfxImageEffectPropSupportedComponents, 1, kOfxImageComponentAlpha); return kOfxStatOK; } ``` -------------------------------- ### OpenFX: Get Parameter Derivative Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex Gets the derivative of a parameter at a specific time. The varargs argument must be pointers to C variables of the parameter's type. Only double and color parameters support derivative calculation. ```C OfxStatus(*paramGetDerivative)(OfxParamHandleparamHandle,OfxTimetime,...) ``` -------------------------------- ### Setting Choice Parameter Order (OFX v1.5+) Source: https://openfx.readthedocs.io/en/main/Reference/ofxParameter.html Demonstrates how to specify the display order of choice parameter options using kOfxParamPropChoiceOrder. This allows plugins to maintain backward compatibility when reordering or inserting new options. ```cpp // Plugin v1: Option = {"OptA", "OptB", "OptC"} Order = {0, 1, 2} // default, or explicit // Plugin v2: // add NewOpt at the end of the list, but specify order so it comes one before the end in the UI // Will display OptA / OptB / NewOpt / OptC Option = {"OptA", "OptB", "OptC", "NewOpt"} Order = {0, 1, 3, 2} // or anything that sorts the same, e.g. {1, 100, 300, 200} ``` -------------------------------- ### Fetch Host Suite in OpenFX Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex.html Use this function to obtain API suites from the host. It's recommended that hosts return the same host and suite pointers to all plugins in the same shared library or bundle. The returned API is valid while the plugin binary is loaded. ```c const void *(*fetchSuite)(OfxPropertySetHandle host, const char *suiteName, int suiteVersion) ``` -------------------------------- ### Get Clip Image - OpenFX Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex Gets a handle for an image within a clip at a specified time and region. The image data is contained within the returned property set. A NULL region fetches the default region. ```c OfxStatus(*clipGetImage)(OfxImageClipHandle clip, OfxTime time, const OfxRectD* region, OfxPropertySetHandle* imageHandle) { // Get a handle for an image in a clip at the indicated time and indicated region. // ... implementation details ... return kOfxStatOK; // or other status codes } ``` -------------------------------- ### OFX Plugin Entry Point Source: https://openfx.readthedocs.io/en/main/Reference/ofxStructure.html The main entry point for OFX plug-ins, handling various actions requested by the host. The 'action' parameter specifies the task, and 'inArgs'/'outArgs' provide data. ```c OfxStatus() OfxPluginEntryPoint (const char *action, const void *handle, OfxPropertySetHandle inArgs, OfxPropertySetHandle outArgs) Entry point for plug-ins. * `action` ASCII c string indicating which action to take * `instance` object to which action should be applied, this will need to be cast to the appropriate blind data type depending on the _action_ * `inData` handle that contains action specific properties * `outData` handle where the plug-in should set various action specific properties ``` -------------------------------- ### OfxOpenCLProgramSuiteV1 Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxGPURender_8h.html OFX suite that allows a plug-in to get OpenCL programs compiled. ```APIDOC ## OfxOpenCLProgramSuiteV1 ### Description OFX suite that allows a plug-in to get OpenCL programs compiled. This is an optional suite the host can provide for building OpenCL programs for the plug-in, as an alternative to calling clCreateProgramWithSource / clBuildProgram. There are two advantages to doing this: The host can add flags (such as -cl-denorms-are-zero) to the build call, and may also cache program binaries for performance (however, if the source of the program or the OpenCL environment changes, the host must recompile so some mechanism such as hashing must be used). ``` -------------------------------- ### OfxTimeLineSuiteV1::getTime Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxTimeLineSuiteV1.html Gets the current time value of the timeline associated with the effect instance. ```APIDOC ## getTime ### Description Gets the current time value of the timeline associated with the effect instance. ### Method `OfxStatus (*getTime)(void *instance, double *time)` ### Parameters #### Path Parameters - `instance` (void *) - The instance of the effect changing the timeline, cast to a void *. - `time` (double *) - Pointer through which the timeline value should be returned. ### Return - `kOfxStatOK` - The time enquiry was successful. - `kOfxStatFailed` - The enquiry failed for some host specific reason. - `kOfxStatErrBadHandle` - The effect handle was invalid. ``` -------------------------------- ### paramGetValue Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxParam_8h.html Gets the current value of a parameter. This function should only be called from within a kOfxActionInstanceChanged or interact action. ```APIDOC ## paramGetValue ### Description Gets the current value of a parameter. The varargs ... argument needs to be a pointer to a C variable of the relevant type for this parameter. Note that params with multiple values (e.g., Colour) take multiple args here. ### Method `OfxStatus (*paramGetValue)(OfxParamHandle paramHandle, ...)` ### Parameters #### Path Parameters - `paramHandle` (OfxParamHandle) - Handle to the parameter to fetch the value from. #### Varargs - `...` - One or more pointers to variables of the relevant type to hold the parameter’s value. ### Return - `kOfxStatOK` - The property set was found and returned. - `kOfxStatErrBadHandle` - If the parameter handle was invalid. - `kOfxStatErrUnknown` - If the type is unknown. ### Note `paramGetValue` should only be called from within a kOfxActionInstanceChanged or interact action and never from the render actions (which should always use paramGetValueAtTime). ``` -------------------------------- ### Create Instance Action for OpenFX Plugin Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample4_Saturation.html This C++ function is used to create an instance of an OpenFX image effect. It caches handles to source, output, and optionally mask clips, as well as saturation parameters. It also records whether the instance is for the general context to handle mask input appropriately. ```cpp //////////////////////////////////////////////////////////////////////////////// /// instance construction OfxStatus CreateInstanceAction( OfxImageEffectHandle instance) { OfxPropertySetHandle effectProps; gImageEffectSuite->getPropertySet(instance, &effectProps); // To avoid continual lookup, put our handles into our instance // data, those handles are guaranteed to be valid for the duration // of the instance. MyInstanceData *myData = new MyInstanceData; // Set my private instance data gPropertySuite->propSetPointer(effectProps, kOfxPropInstanceData, 0, (void *) myData); // is this instance made for the general context? char *context = 0; gPropertySuite->propGetString(effectProps, kOfxImageEffectPropContext, 0, &context); myData->isGeneralContext = context && (strcmp(context, kOfxImageEffectContextGeneral) == 0); // Cache the source and output clip handles gImageEffectSuite->clipGetHandle(instance, "Source", &myData->sourceClip, 0); gImageEffectSuite->clipGetHandle(instance, "Output", &myData->outputClip, 0); if(myData->isGeneralContext) { gImageEffectSuite->clipGetHandle(instance, "Mask", &myData->maskClip, 0); } // Cache away the param handles OfxParamSetHandle paramSet; gImageEffectSuite->getParamSet(instance, ¶mSet); gParameterSuite->paramGetHandle(paramSet, SATURATION_PARAM_NAME, &myData->saturationParam, 0); return kOfxStatOK; } ``` -------------------------------- ### paramGetIntegral Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxParam_8h.html Gets the integral of a parameter over a specific time range. Only double and colour parameters support integration. ```APIDOC ## paramGetIntegral ### Description Gets the integral of a parameter over a specific time range. The varargs needs to be a pointer to C variables of the relevant type for this parameter. See OfxParameterSuiteV1::paramGetValue for notes on the varargs list. Only double and colour parameters can be integrated. ### Method `OfxStatus (*paramGetIntegral)(OfxParamHandle paramHandle, OfxTime time1, OfxTime time2, ...)` ### Parameters #### Path Parameters - `paramHandle` (OfxParamHandle) - Handle to the parameter to fetch the integral from. - `time1` (OfxTime) - The start time for evaluating the integral. - `time2` (OfxTime) - The end time for evaluating the integral. #### Varargs - `...` - One or more pointers to variables of the relevant type to hold the parameter’s integral. ### Return - `kOfxStatOK` - All was OK. - `kOfxStatErrBadHandle` - If the parameter handle was invalid. ``` -------------------------------- ### Clip Instance Properties (Different FPS) Source: https://openfx.readthedocs.io/en/main/Reference/ofxCoordSystem.html Displays the reported frame ranges and frame rates for clip instances in the second example, where output FPS is double the input FPS. Output ranges from 0 to 9 at 50 FPS, and source ranges from -2 to 12 at 25 FPS. ```text range[0] range[1] FPS Output 0 9 50 Source -2 12 25 ``` -------------------------------- ### paramGetDerivative Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxParam_8h.html Gets the derivative of a parameter at a specific time. Only double and colour parameters support derivative calculation. ```APIDOC ## paramGetDerivative ### Description Gets the derivative of a parameter at a specific time. The varargs needs to be a pointer to C variables of the relevant type for this parameter. See OfxParameterSuiteV1::paramGetValue for notes on the varargs list. Only double and colour parameters can have their derivatives found. ### Method `OfxStatus (*paramGetDerivative)(OfxParamHandle paramHandle, OfxTime time, ...)` ### Parameters #### Path Parameters - `paramHandle` (OfxParamHandle) - Handle to the parameter to fetch the derivative from. - `time` (OfxTime) - The specific point in time to look up the parameter's derivative. #### Varargs - `...` - One or more pointers to variables of the relevant type to hold the parameter’s derivative. ### Return - `kOfxStatOK` - All was OK. - `kOfxStatErrBadHandle` - If the parameter handle was invalid. ``` -------------------------------- ### OpenFX kOfxActionLoad Source: https://openfx.readthedocs.io/en/main/Reference/DoxygenIndex The initial action called after a plugin binary is loaded. It allows the plugin to set up global data structures and fetch host suites. The handle, inArgs, and outArgs are redundant and should be NULL. ```c #define kOfxActionLoad "kOfxActionLoad" ``` -------------------------------- ### Choice Parameter Option Ordering Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxParam_8h.html Demonstrates how to define the order of options for a choice parameter in different plugin versions. This affects UI display but not project storage. ```c++ Plugin v1: Option = {"OptA", "OptB", "OptC"} Order = {1, 2, 3} Plugin v2: // will be shown as OptA / OptB / NewOpt / OptC Option = {"OptA", "OptB", "OptC", NewOpt"} Order = {1, 2, 4, 3} ``` -------------------------------- ### paramGetDerivative Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxParameterSuiteV1.html Gets the derivative of a parameter at a specific time. Only double and colour parameters support derivative retrieval. ```APIDOC ## paramGetDerivative ### Description Gets the derivative of a parameter at a specific time. Only double and colour parameters support derivative retrieval. ### Method (Implicitly a function call within the OpenFX API) ### Parameters #### Path Parameters - **paramHandle** (OfxParamHandle) - The parameter handle to fetch the derivative from. - **time** (OfxTime) - The time at which to look up the parameter's derivative. - **...** - One or more pointers to variables of the relevant type to hold the parameter’s derivative. See OfxParameterSuiteV1::paramGetValue for notes on the varargs list. ### Return - kOfxStatOK - All was OK. - kOfxStatErrBadHandle - If the parameter handle was invalid. ``` -------------------------------- ### kOfxPropTime Source: https://openfx.readthedocs.io/en/main/Reference/api/file/ofxCore_8h.html A general-purpose property used for getting or setting the time associated with an object or event within the OpenFX framework. ```APIDOC ## kOfxPropTime ### Description General property used to get/set the time of something. ### Property Details - **Type**: Double - **Usage**: Read/Write ``` -------------------------------- ### OFX Plugin Load Action Source: https://openfx.readthedocs.io/en/main/Guide/ofxExample5_Circle.html This C++ code snippet shows the initial action called when an OFX plugin is loaded. It fetches essential suites (Property, Image Effect, Parameter) and verifies host API version compatibility (1.2 or higher) and support for multi-resolution images. This information is used to conditionally adjust the plugin's behavior in subsequent actions. ```cpp //////////////////////////////////////////////////////////////////////////////// // The first _action_ called after the binary is loaded (three boot strapper functions will be however) OfxStatus LoadAction(void) { // fetch our three suites FetchSuite(gPropertySuite, kOfxPropertySuite, 1); FetchSuite(gImageEffectSuite, kOfxImageEffectSuite, 1); FetchSuite(gParameterSuite, kOfxParameterSuite, 1); int verSize = 0; if(gPropertySuite->propGetDimension(gHost->host, kOfxPropAPIVersion, &verSize) == kOfxStatOK) { verSize = verSize > 2 ? 2 : verSize; gPropertySuite->propGetIntN(gHost->host, kOfxPropAPIVersion, 2, gAPIVersion); } // we only support 1.2 and above if(gAPIVersion[0] == 1 && gAPIVersion[1] < 2) { return kOfxStatFailed; } /// does the host support multi-resolution images gPropertySuite->propGetInt(gHost->host, kOfxImageEffectPropSupportsMultiResolution, 0, &gHostSupportsMultiRes); return kOfxStatOK; } ``` -------------------------------- ### paramGetValueAtTime Source: https://openfx.readthedocs.io/en/main/Reference/api/struct/structOfxParameterSuiteV1.html Gets the value of a parameter at a specific time. This is the preferred method for retrieving parameter values during render actions. ```APIDOC ## paramGetValueAtTime ### Description Gets the value of a parameter at a specific time. This is the preferred method for retrieving parameter values during render actions. ### Method (Implicitly a function call within the OpenFX API) ### Parameters #### Path Parameters - **paramHandle** (OfxParamHandle) - The parameter handle to fetch the value from. - **time** (OfxTime) - The time at which to look up the parameter's value. - **...** - One or more pointers to variables of the relevant type to hold the parameter’s value. See OfxParameterSuiteV1::paramGetValue for notes on the varargs list. ### Return - kOfxStatOK - All was OK. - kOfxStatErrBadHandle - If the parameter handle was invalid. ```