Moved code for calculating local_matrix to BKE funtion for reuse
authorGaia Clary <gaia.clary@machinimatrix.org>
Fri, 12 Jul 2013 12:58:01 +0000 (12:58 +0000)
committerGaia Clary <gaia.clary@machinimatrix.org>
Fri, 12 Jul 2013 12:58:01 +0000 (12:58 +0000)
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/intern/object.c
source/blender/makesrna/intern/rna_object.c

index abc216033ff03116726a09f25267da94a9f673b0..992792dcb999b90ff256ef2e9fd8730b3ed8e833 100644 (file)
@@ -95,6 +95,7 @@ void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], bool use_compat)
 void BKE_object_to_mat3(struct Object *ob, float mat[3][3]);
 void BKE_object_to_mat4(struct Object *ob, float mat[4][4]);
 void BKE_object_apply_mat4(struct Object *ob, float mat[4][4], const bool use_compat, const bool use_parent);
+void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]);
 
 bool BKE_object_pose_context_check(struct Object *ob);
 struct Object *BKE_object_pose_armature_get(struct Object *ob);
index 957bd84cd90151e1cdbf1aca623a47b6ca7910cc..e79a759407b2544f02792aee2126e9113448c7a0 100644 (file)
@@ -1736,6 +1736,18 @@ void BKE_object_to_mat4(Object *ob, float mat[4][4])
        add_v3_v3v3(mat[3], ob->loc, ob->dloc);
 }
 
+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);
+       }
+       else {
+               copy_m4_m4(mat, ob->obmat);
+       }
+}
+
 /* extern */
 int enable_cu_speed = 1;
 
index d48dbbb130046f496988fc8eddb01842f797a2db..542be30c08b4c67615a32c64896b626ea6f58c13 100644 (file)
@@ -44,7 +44,7 @@
 #include "BKE_paint.h"
 #include "BKE_editmesh.h"
 #include "BKE_group.h" /* needed for BKE_group_object_exists() */
-
+#include "BKE_object.h" /* Needed for BKE_object_matrix_local_get() */
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
@@ -216,15 +216,7 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
 {
        Object *ob = ptr->id.data;
-
-       if (ob->parent) {
-               float invmat[4][4]; /* for inverse of parent's matrix */
-               invert_m4_m4(invmat, ob->parent->obmat);
-               mul_m4_m4m4((float(*)[4])values, invmat, ob->obmat);
-       }
-       else {
-               copy_m4_m4((float(*)[4])values, ob->obmat);
-       }
+       BKE_object_matrix_local_get(ob, (float(*)[4])values);
 }
 
 static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])