Page MenuHome

Fix T66080: "child of" constraint "set inverse" problematic with bones
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Jul 5 2019, 11:16 AM.

Details

Summary

For bones, do this in the DEG evaluated domain.
I've split 'child_get_inverse_matrix' in two (depending on the
constraint owner type) to make it obvious one is working with evaluated,
whereas the other is working with original.
This seems to be working fine, but a second/third pair of eyes is really
welcome since I am (still) on shaky ground here.

also fixes T66397 afaict

Diff Detail

Repository
rB Blender

Event Timeline

Formatting seems broken, make sure you use clang-format.

source/blender/editors/object/object_constraint.c
991

Why is it so?

1244

Again, why is it so?

Seems to be quite a duplicate from the case above, so totally worth moving the orig-to-eval queries to child_get_inverse_matrix_owner_bone().

1248

More clear would be to state: "Use evaluated bone to calculate matrix, and store it it the original constraint."

  • make format
  • cleanup comments
  • deduplicate call to ED_object_constraint_update(), wasnt necessary to call this on the evaluated object
Philipp Oeser (lichtwerk) marked an inline comment as done.Jul 5 2019, 12:39 PM
source/blender/editors/object/object_constraint.c
991

haha, was afraid of that question :)
assume this has to do with BKE_pose_where_is which seems to misbehave on non-evaluated object.
wild guess is that this has to do with flags being reset/set there and BKE_pose_where_is_bone, but I am still checking the internals...

You did this yourself [see your commit rB26d4a2a51694], what was the explanation there? ;)

Anyways, I'll take a deeper look...

1244

why? see above

I can move the queries to, but that would require to pass the op as well [to get the bConstraint in that function]

Philipp Oeser (lichtwerk) marked 2 inline comments as not done.Jul 5 2019, 12:46 PM

@Sergey Sharybin (sergey), @Brecht Van Lommel (brecht): seems I cant find the deeper reason in a reasonable time.

I can check further [would be quite good to get a deeper understanding], that might take some time though [to go over the whole shebang of BKE_pose_where_is, BKE_pose_where_is_bone, BKE_constraints_make_evalob and friends, checking pchan flags there etc]...
Just checking priorities here and want to avoid this getting a time-sink (if this is not desired)...

Should I dig deeper, or do you want to take over @Sergey Sharybin (sergey)?

@Philipp Oeser (lichtwerk), BKE_pose_where_is_bone() is indeed supposed to be used on evaluated bone, otherwise some dependencies will not be at a proper state.

The point was more about expanding comment a bit, mentioning that function relies on (re)evaluating parts of the scene and copying new evaluated stuff back to original.

  • move the orig-to-eval queries to child_get_inverse_matrix_owner_bone
  • update comments (used @sergeys wording here)
Philipp Oeser (lichtwerk) marked 2 inline comments as done.Jul 5 2019, 3:13 PM
Philipp Oeser (lichtwerk) added inline comments.
source/blender/editors/object/object_constraint.c
991

added comment in child_get_inverse_matrix_owner_bone [used your wording :)]

1244

moved the queries to child_get_inverse_matrix_owner_bone

Generally fine. Just some last bit of feedback.

source/blender/editors/object/object_constraint.c
989

With the more comprehensive comment in child_get_inverse_matrix_owner_bone() this comment is not needed anymore. In fact, we don't access evaluated bone here. Think this exact comment can be remove.

1242

Same as above.

  • remove unneccesary comment

Form reading the code seems fine to me.
Didn't have time to test it though, so relying this on you.. ;)

This revision is now accepted and ready to land.Jul 5 2019, 3:39 PM