THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/09/2004 at 10:34, xxxxxxxx wrote:
Cinema 4D Version: 8.503
Platform: Windows ;
Language(s) : C++ ;
Here's the background info:
My plugin reads a file, loads referenced Wavefront OBJ geometry, and creates a rig (hierarchical bones) for the geometry. The bones are fixed.
It then creates a tag on each bone which stores various data, including the global matrix of the bones at their default location/rotation/scales. The bones are then rotated into their setup location/rotation/scales (used for facilitating IK) and this global matrix is store into the BaseContainer of the tag as well. There are two global matrices stored in each tag on each bone.
My dialog has two buttons: one to return the rigged figure to the default and another to the setup configurations. The respective matrices are applied using SetMg().
Using keyframes is not an option since this could interfere with other similar objects loaded in (imagine wanting to restore one figure and having ALL of them restored!)
Now for the question and issue:
I have found two areas of concern in using this technique to restore the figure to a base configuration.
1. The order of application of the matrices with respect to the hierarchy must match that of the original setting of them (after fixing). But this only works once, and only once (except as noted in 2. where it doesn't work at all). If I click on one of the buttons twice, the first time results in a restored figure, the second in a complete mess. Why?
2. If the figure is posed at all (any bone rotated), it results in a partial mess in the application of restoring the figure to one of the base configurations.
One interesting observation is that if I continue to click on one of buttons (repeatedly setting the SAME IDENTICAL matrix for the bones), the figure tends to drift backwards to the pose in which it resided. This makes no sense. One would think that SetMg() would apply similar at every instance, completely replacing the existing global matrix, but it doesn't appear to be doing so. My hypotheses are that either the order of matrix application has changed (but to what is beyond me) or that something must be done before application of the matrices to avoid accumulating error/whatever.
Now I see why people continue to challenge the efficacy of C4D's CA. How can one do anything if such unexpected results occur?
How can I confidently allow a user to restore a posed rigged figure back to some base configuration (under all expected circumstances)?