diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-12-29 17:23:12 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-12-29 17:26:38 +0300 |
commit | fb7ff31315a1c9feefe993264178cb34ce443208 (patch) | |
tree | a2dd5f3ea023b2a6deb4c6b1978e94bf74f8920d /source/blender/blenkernel/intern | |
parent | c5927cd97758baf3df30459d43dc7c6c488fc616 (diff) |
Fix stupid handling of 'Object.matrix_local' in RNA.
The getter of this matrix (actually, `BKE_object_matrix_local_get()`) was only correct
in case of pure-object parenting, bone parenting and such did not gave valid results.
Also cleaned up a bit setter code, was using as temp storage ob->obmat itself,
which is supposed to be a world matrix!
Reviewers: campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D958
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1676f22683a..f6b328eb8e8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2019,12 +2019,16 @@ void BKE_object_to_mat4(Object *ob, float mat[4][4]) add_v3_v3v3(mat[3], ob->loc, ob->dloc); } +static void ob_get_parent_matrix(Scene *scene, Object *ob, Object *par, float parentmat[4][4]); + void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]) { if (ob->parent) { - float invmat[4][4]; /* for inverse of parent's matrix */ - invert_m4_m4(invmat, ob->parent->obmat); - mul_m4_m4m4(mat, invmat, ob->obmat); + float par_imat[4][4]; + + ob_get_parent_matrix(NULL, ob, ob->parent, par_imat); + invert_m4(par_imat); + mul_m4_m4m4(mat, par_imat, ob->obmat); } else { copy_m4_m4(mat, ob->obmat); |