Skip to content

Instantly share code, notes, and snippets.

@mattcox
Last active July 12, 2018 21:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcox/4559150 to your computer and use it in GitHub Desktop.
Save mattcox/4559150 to your computer and use it in GitHub Desktop.
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