Merging r58196 through r58265 from trunk into soc-2013-depsgraph_mt
[blender.git] / source / blender / blenkernel / intern / object.c
index 9cf1831acec27e4b89881ff54a0bd2804c520d38..cbda864a2ea76bbd18794f56721029c8dc4e1c33 100644 (file)
@@ -1766,6 +1766,18 @@ void BKE_object_to_mat4(Object *ob, float mat[4][4])
        add_v3_v3v3(mat[3], ob->loc, ob->dloc);
 }
 
        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;
 
 /* extern */
 int enable_cu_speed = 1;