Other Goodies in Fabric for Maya

Aside the Canvas node there are a few other things that are shipped with Fabric for Maya.

The “FabricConstraint” node

../../_images/userguide_34.jpg

The node FabricConstraint is a standard pose constraint, implemented as a Maya C++ node. It was implemented primarily to increase the performance of Kraken rigs, but it can be used in any Maya DG. The node’s output transformation is split into a Translate, a Rotate and a Scale port, so it can also be used as a translation constraint, a rotation constraint, a scale constraint or any combination of the three.

To add a FabricConstraint node to your Maya scene you can use the Tab search inside Maya’s node editor or run the following MEL script:

createNode "fabricConstraint";

The node comes with the following input and output ports.

Inputs:
  • Input - the matrix of the constraining object.
  • Offset - the matrix for the constrain offset.
  • Parent - the matrix of the constrained object’s parent.
Outputs:
  • Translate - the output translation.
  • Rotate - the output rotation.
  • Scale - the output scale.

Finally the node has an input parameter called rotateOrder to define the order of rotation. You can set the value of rotateOrder either in Maya’s attribute editor or via scripting.

The “CanvasFuncNode” node

This node is the ‘techy’ brother of the regular CanvasNode node. With the CanvasFuncNode you can only define ports and KL code, but no graph.

To add a CanvasFuncNode node to your Maya scene you can use the Tab search inside Maya’s node editor or run the following MEL script:

createNode "canvasFuncNode";

A new CanvasFuncNode node is initially empty: it has no ports and no code other than the standard dfgEntry block.

The “CanvasFuncDeformer” node

This node is the ‘techy’ brother of the regular CanvasDeformer node. With the CanvasFuncDeformer you can only define ports and KL code, but no graph.

To add a CanvasFuncDeformer node to your Maya scene you can use the Tab search inside Maya’s node editor or run the following MEL script:

createNode "canvasFuncDeformer";

A new CanvasFuncDeformer comes with a predefined meshes port of type PolygonMesh[] and no code other than the standard dfgEntry block.

Maya deformer nodes are somewhat special and they need to be connected with the source/target Maya mesh in a certain way. The easiest way to create a complete and working setup is to select the polygon mesh in your Maya scene and then to run the following MEL script:

string $sel[];
$sel = `ls -selection -exactType transform`;
$d=`deformer -type "canvasFuncDeformer"`;
select -r $d;
FabricCanvasSetCode -m $d -e "" -c "dfgEntry \n{\n  if (meshes.size() > 0)\n  {\n    Vec3 p[] = meshes[0].getAllPointPositions();\n\n    // add your KL code here to\n    // modify the positions in p[];\n\n    meshes[0].setAllPointPositions(p);\n  }\n}";

The “enableEvalContext” hidden attribute

Nodes have an attribute “enableEvalContext” which you can set to false. This will disable the evalContext functionality and should benefit the resulting performance.