Using face animations in node trees
Creating a new node type is easy. First, we add a new class, FaceAnimNode
, consisting of the FaceAnimNode.h
header and the implementation file, FaceAnimNode.cpp
, both placed in the graphnodes
folder. We can borrow most of the implementation from the WaitNode, adding ImGui elements and a bit of logic to control the face animation during the execution time. Figure 10.5 shows the final layout of the FaceAnim node:

Figure 10.5: The new FaceAnim node
The node allows us to choose one of the face animation clips, including the None
setting to disable face animations on an instance, starting and ending weights for the animation in both play directions, and a timer to control how long the animation replay will take.
Before we can add the new FaceAnim
node, we must extend the enum
containing the node types and the graph node factory class.
Adjusting the code for the new FaceAnim node
Similar to WaitNode, the FaceAnim
node delays the...