Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This snippet is to demonstrate how to write to a matrix channel in modo from an eval modifier. This is the correct way to write to a matrix. This does assume that you have set the matrix channel you want to drive as a channel for the modifier, using eval.AddChan(item_loc, LXsICHAN_XFRMCORE_WPOSMATRIX, LXfECHAN_WRITE); in your modifier constructo…
/*
This snippet is to demonstrate how to write to a matrix channel
in modo from an eval modifier. This is the correct way to write
to a matrix. This does assume that you have set the matrix channel
you want to drive as a channel for the modifier, using something like:
eval.AddChan(item_loc, LXsICHAN_XFRMCORE_WPOSMATRIX, LXfECHAN_WRITE);
in your modifier constructor. This method will drive the matrix
channel directly, so instead of using the local channels to calculate
the world SRT, it'll use the values the modifier provides it with.
*/
void modifier_element::Eval(CLxUser_Evaluation &eval, CLxUser_Attributes &attr)
{
CLxUser_Matrix output_matrix;
LXtMatrix4 output_matrix4;
// Assuming you have done something to set the value of the output_matrix4 here.
// Write to the matrix.
attr.ObjectRW (chan_index, output_matrix); // ObjectRW gets an item for writing to.
output_matrix.Set4 (output_matrix4); // Set the value of the output_matrix.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment