diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-30 00:13:40 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-30 00:13:40 +0400 |
commit | 4aff02006b9c5dba240e64a34d6433005ae092eb (patch) | |
tree | f79eba137c1909b5ff8df1f1cd95857ba0451067 /source/blender/blenkernel/intern/object.c | |
parent | 70e6241c9b0e162e5049df13391f7a455e9d52c4 (diff) |
Add 2 items to CTL-A menu: Scale to ObData and Rotation to ObData. These options allows to apply separately the scale and the rotation to the object data. Usefull to physics compound objects that do not support scaling.
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ec110c6ea7c..b5d080da247 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1479,22 +1479,42 @@ float bsystem_time(Object *ob, float cfra, float ofs) return cfra; } -void object_to_mat3(Object *ob, float mat[][3]) /* no parent */ +void object_scale_to_mat3(Object *ob, float mat[][3]) { - float smat[3][3], vec[3]; - float rmat[3][3]; - /*float q1[4];*/ - - /* size */ + float vec[3]; if(ob->ipo) { vec[0]= ob->size[0]+ob->dsize[0]; vec[1]= ob->size[1]+ob->dsize[1]; vec[2]= ob->size[2]+ob->dsize[2]; - SizeToMat3(vec, smat); + SizeToMat3(vec, mat); + } + else { + SizeToMat3(ob->size, mat); + } +} + +void object_rot_to_mat3(Object *ob, float mat[][3]) +{ + float vec[3]; + if(ob->ipo) { + vec[0]= ob->rot[0]+ob->drot[0]; + vec[1]= ob->rot[1]+ob->drot[1]; + vec[2]= ob->rot[2]+ob->drot[2]; + EulToMat3(vec, mat); } else { - SizeToMat3(ob->size, smat); + EulToMat3(ob->rot, mat); } +} + +void object_to_mat3(Object *ob, float mat[][3]) /* no parent */ +{ + float smat[3][3]; + float rmat[3][3]; + /*float q1[4];*/ + + /* size */ + object_scale_to_mat3(ob, smat); /* rot */ /* Quats arnt used yet */ @@ -1508,15 +1528,7 @@ void object_to_mat3(Object *ob, float mat[][3]) /* no parent */ } } else {*/ - if(ob->ipo) { - vec[0]= ob->rot[0]+ob->drot[0]; - vec[1]= ob->rot[1]+ob->drot[1]; - vec[2]= ob->rot[2]+ob->drot[2]; - EulToMat3(vec, rmat); - } - else { - EulToMat3(ob->rot, rmat); - } + object_rot_to_mat3(ob, rmat); /*}*/ Mat3MulMat3(mat, rmat, smat); } |