MfxEffect

This document currently is a largely undocumented draft so it is more informational to refer to the C API at the moment: Open Mesh Effect API Reference.

class MfxEffect

Defining a new effect is done by subclassing MfxEffect and implementing some of its virtual methods. These methods correspond to actions and some of them like Describe and Cook are mandatory.

Public Functions

const char *GetName()

Override this in subclasses to give the effect a name

void SetHost(OfxHost *host)

Equivalent of the setHost entry point of an OpenFX plugin.

OfxStatus MainEntry(const char *action, const void *handle, OfxPropertySetHandle inArgs, OfxPropertySetHandle outArgs)

Equivalent of the mainEntry entry point of an OpenFX plugin, calling one of the action methods bellow.

Protected Functions

OfxStatus Load()

Equivalent of the kOfxActionLoad.

OfxStatus Unload()

Equivalent of the kOfxActionUnload.

OfxStatus Describe(OfxMeshEffectHandle descriptor)

Equivalent of the kOfxActionDescribe.

OfxStatus CreateInstance(OfxMeshEffectHandle instance)

Equivalent of the kOfxActionCreateInstance.

OfxStatus DestroyInstance(OfxMeshEffectHandle instance)

Equivalent of the kOfxActionDestroyInstance.

OfxStatus Cook(OfxMeshEffectHandle instance)

Equivalent of the kOfxMeshEffectActionCook.

OfxStatus IsIdentity(OfxMeshEffectHandle instance)

Equivalent of the kOfxMeshEffectActionIsIdentity.

MfxInputDef AddInput(const char *name)

Define a new input/output slot of the effect. The name may be one of the standard kOfxMeshMainInput or kOfxMeshMainOutput or anything else for additionnal slots. Can only be used during the Describe action.

MfxParamDef<int> AddParam(const char *name, int defaultValue)

Define a new parameter of the effect. The second argument (the default value) defines the type of the parameter. Can only be used during the Describe action.

MfxParamDef<int2> AddParam(const char *name, const int2 &defaultValue)
MfxParamDef<int3> AddParam(const char *name, const int3 &defaultValue)
MfxParamDef<double> AddParam(const char *name, double defaultValue)
MfxParamDef<double2> AddParam(const char *name, const double2 &defaultValue)
MfxParamDef<double3> AddParam(const char *name, const double3 &defaultValue)
MfxParamDef<bool> AddParam(const char *name, bool defaultValue)
MfxInput GetInput(const char *name)

Get a given input instance by its name (e.g. kOfxMeshMainInput) This is used to retrieve (for inputs) or define (for outputs) the mesh data flowing through it. Can only be used during the Cook action.

template<typename T>
MfxParam<T> GetParam(const char *name)

Get a given parameter instance by its name as previously defined during the Describe action. The resulting MfxParam can be used to retrieve the current value of the parameter. The type of the parameter must be given as a template argument, e.g. GetParam<int2>("size"). Can only be used during the Cook action.

const MfxHost &host() const

The host() implicitely when using the MFX_CHECK and MFX_ENSURE macros.

Protected Attributes

const OfxMeshEffectSuiteV1 *meshEffectSuite = nullptr

Access to raw Open Mesh Effect suites, might be used when implementing actions (these member variables are not prefixed by ‘m_’ for more convenience) FIXME: They are useless if one uses the MFX_CHECK macro correctly. Advanced uses can still call e.g. host()->meshEffectSuite.

const OfxPropertySuiteV1 *propertySuite = nullptr
const OfxParameterSuiteV1 *parameterSuite = nullptr