Revision: 17514
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17514
Author: aligorith
Date: 2008-11-20 07:24:44 +0100 (Thu, 20 Nov 2008)
Log Message:
-----------
AnimSys2: Apply Scale/Rotation/LocRot works with Meshes with Shapekeys
This was rather simple to accomplish, as it was pretty much the same as for
recentering meshes.
Now, to get Join and Separate working... (no wonder nobody has bothered to
touch those ;) )
Modified Paths:
--------------
branches/animsys2/source/blender/src/editobject.c
Modified: branches/animsys2/source/blender/src/editobject.c
===================================================================
--- branches/animsys2/source/blender/src/editobject.c 2008-11-20 06:00:55 UTC
(rev 17513)
+++ branches/animsys2/source/blender/src/editobject.c 2008-11-20 06:24:44 UTC
(rev 17514)
@@ -3986,10 +3986,6 @@
error("Can't apply to a multi user
mesh, doing nothing.");
return;
}
- if(me->key) {
- error("Can't apply to a mesh with
vertex keys, doing nothing.");
- return;
- }
}
else if (ob->type==OB_ARMATURE) {
arm= ob->data;
@@ -4022,25 +4018,39 @@
ob= base->object;
if(ob->type==OB_MESH) {
+ /* calculate matrix */
if (apply_scale && apply_rot)
object_to_mat3(ob, mat);
else if (apply_scale)
object_scale_to_mat3(ob, mat);
else
object_rot_to_mat3(ob, mat);
-
+
+ /* get object data */
me= ob->data;
- /* see checks above */
-
+ /* adjust data */
mvert= me->mvert;
for(a=0; a<me->totvert; a++, mvert++) {
Mat3MulVecfl(mat, mvert->co);
}
+
+ if (me->key) {
+ KeyBlock *kb;
+
+ for (kb=me->key->block.first; kb;
kb=kb->next) {
+ float *fp= kb->data;
+
+ for (a=0; a<kb->totelem; a++,
fp+=3)
+ Mat3MulVecfl(mat, fp);
+ }
+ }
+
+ /* adjust transforms */
if (apply_scale)
- ob->size[0]= ob->size[1]= ob->size[2]=
1.0;
+ ob->size[0]= ob->size[1]= ob->size[2]=
1.0f;
if (apply_rot)
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
+ ob->rot[0]= ob->rot[1]= ob->rot[2]=
0.0f;
/*QuatOne(ob->quat);*/ /* Quats arnt used yet */
where_is_object(ob);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs