The Mesh Effect API

kOfxMeshEffectPluginApi

String used to label OFX Mesh Effect Plug-ins.

Set the pluginApi member of the OfxPluginHeader inside any OfxMeshEffectPluginStruct to be this so that the host knows the plugin is an image effect.

Mesh Effect API Header Files

The Mesh Effect API itself is provided in the ofxMeshEffect.h header file. Other header files are the same as the one provided with the Image Effect API:

The reminder of this page focuses on the objects defined in ofxMeshEffect.h. For the functions that operate on these object, see Mesh Effect Suite.

Mesh Effect

A Mesh Effect is an operator that expects zero or more meshes as inputs and provides zero or more other meshes as outputs. The behavior of such effect is tunned using parameters as defined in ofxParam.h. They roughly correspond to a node in a node-based 3D modeling tool like Houdini or a modifier in a stack-based generatino like in Blender or Cinema 4D. A mesh effect is manipulated using the OfxMeshEffectHandle type.

typedef struct OfxMeshEffectStruct *OfxMeshEffectHandle

Blind declaration of an OFX mesh effect.

kOfxMeshEffectPropPluginHandle

The plugin handle passed to the initial ‘describe’ action.

  • Type - pointer X 1

  • Property Set - plugin instance, (read only)

This value will be the same for all instances of a plugin.

Mesh Instances

Mesh effects operate on mesh data represented by the OfxMeshHandle type:

typedef struct OfxMeshStruct *OfxMeshHandle

Blind declaration of an OFX geometry data.

Properties:

kOfxMeshPropPointCount

The number of points in a mesh.

  • Type - integer X 1

  • Property Set - a mesh instance (read only)

This property is the number of points allocated in the mesh object.

kOfxMeshPropVertexCount

The number of vertices in a mesh.

  • Type - integer X 1

  • Property Set - a mesh instance (read only)

This property is the number of vertices allocated in the mesh object.

kOfxMeshPropFaceCount

The number of faces in a mesh.

  • Type - integer X 1

  • Property Set - a mesh instance (read only)

This property is the number of faces allocated in the mesh object.

kOfxMeshPropAttributeCount

The number of attribtues in a mesh.

  • Type - integer X 1

  • Property Set - a mesh instance (read only)

This property is the number of attribtues stored in the mesh object. Attributes can be attached to either points, vertices, faces or the whole mesh. There are at least three attributes in a geometry namely the point’s position, the vertex’ point association and the face’s vertex count.

Inputs and outputs

Inputs and outputs of a mesh effect are the same type of object, both manipulated using the OfxMeshInputHandle type:

typedef struct OfxMeshInputStruct *OfxMeshInputHandle

Blind declaration of an OFX mesh effect input.

Some hosts may give a special meaning to kOfxMeshMainInput and kOfxMeshMainOutput, in particular if they only support the filter context (like Blender’s modifiers).

kOfxMeshMainInput

Identifier of the main mesh input of a mesh effect.

kOfxMeshMainOutput

Identifier of the main mesh output of a mesh effect.

Custom Attributes

The Open Mesh Effect API supports attaching any custom attribute to either points, vertices or faces. A fourth attribute attachment is for attributes with only one instance (the equivalent of detail attributes in Houdini). Some of these attributes are conventional and expected to always be present.

Attribute attachments:

kOfxMeshAttribPoint

Mesh attribute attachement to points.

kOfxMeshAttribVertex

Mesh attribute attachement to vertex.

kOfxMeshAttribFace

Mesh attribute attachement to faces.

kOfxMeshAttribMesh

Mesh attribute attachement to the whole mesh.

Conventional attributes:

kOfxMeshAttribPointPosition

Name of the point attribut for position.

kOfxMeshAttribVertexPoint

Name of the vertex attribut for point index.

kOfxMeshAttribFaceCounts

Name of the face attribut for vertex count.

Attribute properties/

An attribute is represented by a generic OfxPropertySetHandle that provides the following keys:

kOfxMeshAttribPropData

The data pointer of an attribute.

  • Type - int X 1

  • Property Set - a mesh instance (read only)

This property contains a pointer to memory where attribute data is stored, whose size depend on the attribute attachement (point/vertex/face/mesh) and attribute type (int, float, vector, etc.)

kOfxMeshAttribPropIsOwner

Whether the mesh effect owns its data.

  • Type - bool X 1

  • Property Set - a mesh instance (read only)

The mesh effect must free its data on destruction iff it owns it. In most cases, it is recommanded to use the mesh effect attributes as proxies to data structures owned by the underlying host mesh structures, so this is 0, but in some cases wher ethe data layout does not allow it, some memory is allocated in the mesh and this flag must hence be set to 1, so that memory is automatically freed on mesh release.

kOfxMeshAttribPropStride

The stride of an attribute.

  • Type - int X 1

  • Property Set - a mesh instance (read only)

This property contains the number of bytes between the beginning of two values of the attributes in the buffer to which the data property points.

kOfxMeshAttribPropComponentCount

The number of components an attribute.

  • Type - int X 1

  • Property Set - a mesh attribute (read only)

An attribute can have between 1 and 4 components.

kOfxMeshAttribPropType

The type of an attribute.

  • Type - string X 1

  • Property Set - a mesh attribute (read only)

An attribute can have type kOfxMeshAttribTypeFloat or kOfxMeshAttribTypeInt

NB The plugin_support code in the Implementation section provides fonctions to more easily access this information for plugin writers.

Attributes types:

kOfxMeshAttribTypeUByte

Attribute type unsigned integer 8 bit.

kOfxMeshAttribTypeInt

Attribute type integer 32 bit.

kOfxMeshAttribTypeFloat

Attribute type float 32 bit.