Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-11-09 01:32:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-09 01:32:28 +0300
commitc4967b5dde966a3342a835fc8831fa170f856a97 (patch)
tree07eb5779f0612c66a73a4eb88783b2072e6c707f /source/blender/blenkernel/intern/object.c
parent0c27782b8e4b2eb8f756b081cef39c5ee089b032 (diff)
bugfix [#24616] Apply Visual Transform doesn't always apply location
- object updates were not being flushed, so children weren't updating. - apply the matrix relative to the parent, added this as an option to object_apply_mat4() which allows assigning the worldspace matrix in python without worrying about the parent.
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index e006c48aca5..9512aa3a1ce 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1550,7 +1550,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
if(gob) {
ob->rotmode= target->rotmode;
mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
- object_apply_mat4(ob, ob->obmat, FALSE);
+ object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
}
else {
copy_object_transform(ob, target);
@@ -1694,11 +1694,25 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
}
/* see pchan_apply_mat4() for the equivalent 'pchan' function */
-void object_apply_mat4(Object *ob, float mat[][4], short use_compat)
+void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const short use_parent)
{
float rot[3][3];
- mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat);
- object_mat3_to_rot(ob, rot, use_compat);
+
+ if(use_parent && ob->parent) {
+ float rmat[4][4], diff_mat[4][4], imat[4][4];
+ mul_m4_m4m4(diff_mat, ob->parentinv, ob->parent->obmat);
+ invert_m4_m4(imat, diff_mat);
+ mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */
+ object_apply_mat4(ob, rmat, use_compat, FALSE);
+
+ /* same as below, use rmat rather then mat */
+ mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
+ object_mat3_to_rot(ob, rot, use_compat);
+ }
+ else {
+ mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat);
+ object_mat3_to_rot(ob, rot, use_compat);
+ }
}
void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
@@ -2127,7 +2141,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
copy_m3_m4(originmat, tmat);
// origin, voor help line
- if( (ob->partype & 15)==PARSKEL ) {
+ if( (ob->partype & PARTYPE)==PARSKEL ) {
VECCOPY(ob->orig, par->obmat[3]);
}
else {