Depsgraph: Make ob_get_parent_matrix() more public and reusable

Currently still only used from object.c, but in the next commit it'll be also
used from granular object update callbacks.
This commit is contained in:
2015-05-12 14:06:31 +05:00
parent 08d87514d3
commit 051688b34c
2 changed files with 6 additions and 6 deletions

View File

@@ -125,6 +125,7 @@ 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);
void BKE_object_get_parent_matrix(struct Scene *scene, struct Object *ob, struct Object *par, float parentmat[4][4]);
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float r_originmat[3][3]);
void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);

View File

@@ -2052,14 +2052,12 @@ 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 par_imat[4][4];
ob_get_parent_matrix(NULL, ob, ob->parent, par_imat);
BKE_object_get_parent_matrix(NULL, ob, ob->parent, par_imat);
invert_m4(par_imat);
mul_m4_m4m4(mat, par_imat, ob->obmat);
}
@@ -2351,7 +2349,8 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
}
}
static void ob_get_parent_matrix(Scene *scene, Object *ob, Object *par, float parentmat[4][4])
void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float parentmat[4][4])
{
float tmat[4][4];
float vec[3];
@@ -2408,7 +2407,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4
if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
ob_get_parent_matrix(scene, ob, par, totmat);
BKE_object_get_parent_matrix(scene, ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
@@ -2566,7 +2565,7 @@ void BKE_object_apply_mat4(Object *ob, float mat[4][4], const bool use_compat, c
if (use_parent && ob->parent) {
float rmat[4][4], diff_mat[4][4], imat[4][4], parent_mat[4][4];
ob_get_parent_matrix(NULL, ob, ob->parent, parent_mat);
BKE_object_get_parent_matrix(NULL, ob, ob->parent, parent_mat);
mul_m4_m4m4(diff_mat, parent_mat, ob->parentinv);
invert_m4_m4(imat, diff_mat);