Mesh modifier plug-ins
Mesh modifier plug-ins in Coden are very similar to mesh generator plug-ins with one exception that the first parameter must be a mesh. As such, the difference is purely conceptual: a mesh modifier is designed to alter an existing mesh in some way, where as mesh generator is designed to generate a new mesh from scratch. However, in some host applications this difference becomes more profound because they may treat mesh modifiers differently than other plug-in types. For example, in 3dsmax and XSI implementations mesh modifiers become modifier and operator plug-ins, respectively, while mesh generators in these hosts define new object types. However, other hosts such as Maya do not have such distinctions.
In either case, it makes a good practice to distinguish the intended purpose of your mesh plug-in and use the modifier distinction for anything intended for altering existing meshes.
Specifying mesh modifier plug-ins
Any function which accepts a PolygonMesh3
as its first input and produces a PolygonMesh3
as its first output, where both the input and output are part of the same port group, will be treated as a mesh modifier.
[OutputPort( Group = "primary" )]
public static PolygonMesh3 MyMeshModifier( [InputPort( Group = "primary" )] PolygonMesh3 meshInput )
{
// Take meshInput, alter it, and return as result...
}
Please note that mesh modifier plug-ins must accept a PolygonMesh3
as its first parameter.
All other aspects of writing mesh modifiers such as accepting and returning texture coordinates and other extra mesh information are the same as with mesh generator plug-ins.
Examples
For examples of mesh modifier plug-ins see CloneAndOffsetMesh.cs, DirectedPointsOnSurface.cs, and Mirror.cs files available in the samples project.