Setting an INode's transformation, consistent with animation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I'm having trouble setting an INode's transformation in a way that is consistent with keys are set in the user interface (time line buttons etc).
Simply put: the plug-in sets the transformation (position and rotation) of an object,
and the user can create keys in the timeline (with the "set key" button or with "auto key" and playback.
First I tried
inode->SetNodeTM(t, mat); // mat being a Matrix3
This works if there are no keys on the object yet,
but if there are prior keys, then the transformation becomes corrupted / broken.
So I switched to
Control* c = inode->GetTMController();
SetXFormPacket pkg(mat); // mat being a Matrix3
c->SetValue(t, &pkg, 0, CTRL_ABSOLUTE);
Which works when no keys are on the timeline and doesn't result in corrupted transformations, but:
- when using "auto key" with playback, only rotational keys are recorded
- when a positional key is already in the timeline, then the position is ignored, only rotation is applied
So next I tried:
c->GetRotationController()->SetValue(t, &pkg, 0, CTRL_ABSOLUTE);
c->GetPositionController()->SetValue(t, &pkg, 0, CTRL_ABSOLUTE);
But now, depending on which order the two are called, position or rotation will be ignored.
If I use setValue() with parameter commit=1, then I'm back to the original problem of having a broken transformation.
I'd be happy if someone could let me know which is the correct way to set a transformation.
Thank you!