API Reference — dna/layers/BehaviorWriter
class DNAAPI BehaviorWriter : public virtual DefinitionWriter
Write the DNA attributes that define how the rig evaluates: GUI-to-raw control mapping and PSD expressions.
When to use this
Use when constructing or modifying the behavioral layer of a DNA asset — populating evaluation data that drives how raw controls respond to GUI inputs, how joints are driven by PSD expressions, or how blend shapes and animated maps are activated per LOD. If you only need to read behavior data, use BehaviorReader instead.
Method groups
| Group | Methods |
|---|---|
| GUI-to-raw mapping | setGUIToRawInputIndices, setGUIToRawOutputIndices, setGUIToRawFromValues, setGUIToRawToValues, setGUIToRawSlopeValues, setGUIToRawCutValues |
| PSD expressions | setPSDCount, setPSDRowIndices, setPSDColumnIndices, setPSDValues |
| Joint matrix dimensions | setJointRowCount, setJointColumnCount |
| Joint groups | clearJointGroups, deleteJointGroup, setJointGroupLODs, setJointGroupInputIndices, setJointGroupOutputIndices, setJointGroupValues, setJointGroupJointIndices |
| Blend shape channels | setBlendShapeChannelLODs, setBlendShapeChannelInputIndices, setBlendShapeChannelOutputIndices |
| Animated maps | setAnimatedMapLODs, setAnimatedMapInputIndices, setAnimatedMapOutputIndices, setAnimatedMapFromValues, setAnimatedMapToValues, setAnimatedMapSlopeValues, setAnimatedMapCutValues |
Example
// Populate GUI-to-raw mapping
writer->setGUIToRawInputIndices(guiInputIdx.data(), static_cast<uint16_t>(guiInputIdx.size()));
writer->setGUIToRawOutputIndices(rawOutputIdx.data(), static_cast<uint16_t>(rawOutputIdx.size()));
writer->setGUIToRawFromValues(fromVals.data(), static_cast<uint16_t>(fromVals.size()));
writer->setGUIToRawSlopeValues(slopes.data(), static_cast<uint16_t>(slopes.size()));
writer->setGUIToRawCutValues(cuts.data(), static_cast<uint16_t>(cuts.size()));
// Populate PSD expressions
writer->setPSDCount(static_cast<uint16_t>(psdCount));
writer->setPSDRowIndices(psdRows.data(), static_cast<uint16_t>(psdRows.size()));
writer->setPSDColumnIndices(psdCols.data(), static_cast<uint16_t>(psdCols.size()));
writer->setPSDValues(psdWeights.data(), static_cast<uint16_t>(psdWeights.size()));
Parameters
| Name | Type | Description |
|---|---|---|
inputIndices, outputIndices, rowIndices, columnIndices |
const std::uint16_t* |
required. Source address the indices are copied from. |
fromValues, toValues, slopeValues, cutValues |
const float* |
required. Source address the values are copied from. |
count |
std::uint16_t |
required. Number of elements to copy. For setPSDCount, the number of distinct PSD expressions. |
Watch out for
- The destructor is protected, so you cannot delete through a
BehaviorWriterpointer. - Setters copy from the source address, so the caller keeps ownership of its buffers.
- Implementors must inherit from
Writer, not fromBehaviorWriterdirectly. SubclassingBehaviorWriterdirectly bypasses lifecycle management provided byWriter. jointGroupIndexpassed to anysetJointGroup*method must be less than the value returned bygetJointGroupCount. Joint group storage is implicitly resized when an index exceeds current capacity, but out-of-range indices still violate the documented precondition.- The LOD values set via
setBlendShapeChannelLODsare not interchangeable with the LOD indices set inDefinitionWriter::setBlendShapeNameIndicesandDefinitionWriter::setLODBlendShapeMapping. Passing the wrong set silently produces incorrect blend shape evaluation at runtime.