Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteBoneJoint undo is incomplete (doesn't track resulting geometrical transformation) #153

Open
m-7761 opened this issue Dec 28, 2020 · 1 comment

Comments

@m-7761
Copy link

m-7761 commented Dec 28, 2020

The following matrix code isn't passed to the undo system:

mm3d/src/libmm3d/model.cc

Lines 952 to 962 in 8f12124

setBoneJointParent( j, m_joints[joint]->m_parent );
m_joints[j]->m_absolute = m_joints[j]->m_absolute * m;
double rot[3];
double trans[3];
m_joints[j]->m_absolute.getRotation( rot );
m_joints[j]->m_absolute.getTranslation( trans );
setBoneJointRotation( j, rot );
setBoneJointTranslation( j, trans );

I noticed this when wanting to add a "Parent" item to the Properties panel. In the following code I solved it by moving the body into setBoneJointParent, and having it pass the new relative matrix to a new private method called parentBoneJoint that adds the new and previous relative matrices to the undo object, that in turn uses "parentBoneJoint":

m-7761@21f3ce4

This also makes setBoneJointParent useful for actually reparenting joints as a user API.

@m-7761
Copy link
Author

m-7761 commented Dec 29, 2020

WARNING: I remembered the next day that many loops are written with the assumption that parent nodes are lower in the joint list, so that if reparenting is permitted to break this assumption, something major has to be done about it; a full audit, algorithm, etc. I suppose I will do that shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant