[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17227] branches/animsys2/source/blender/ src/editobject.c: AnimSys2: Recentering Meshes with ShapeKeys
Joshua Leung
aligorith at gmail.com
Thu Oct 30 09:10:20 CET 2008
Revision: 17227
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17227
Author: aligorith
Date: 2008-10-30 09:10:19 +0100 (Thu, 30 Oct 2008)
Log Message:
-----------
AnimSys2: Recentering Meshes with ShapeKeys
Meshes with ShapeKeys can now be recentered. Note that this may not be totally stable or thee may be some artifacts somewhere. However, in preliminary tests, this seems to work well enough.
Note: the only situation in which this will not work is if the object is showing a pinned shapekey. Perhaps it would be better to test for multiple mesh users instead, but feedback would be welcome on this...
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-10-30 07:22:11 UTC (rev 17226)
+++ branches/animsys2/source/blender/src/editobject.c 2008-10-30 08:10:19 UTC (rev 17227)
@@ -1913,8 +1913,15 @@
tot_lib_error++;
}
else if(G.obedit==0 && (me=get_mesh(base->object)) ) {
+ short skey_bad= 0;
- if(me->key) {
+ /* not all shapekeys are bad... just the pinned ones */
+ if (me->key) {
+ if (base->object->shapeflag & OB_SHAPE_LOCK)
+ skey_bad= 1;
+ }
+
+ if (skey_bad) {
/*error("Can't change the center of a mesh with vertex keys");
return;*/
tot_key_error++;
@@ -1943,6 +1950,18 @@
}
me->flag |= ME_ISDONE;
+ 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) {
+ VecSubf(fp, fp, cent);
+ }
+ }
+ }
+
if(centermode) {
Mat3CpyMat4(omat, base->object->obmat);
More information about the Bf-blender-cvs
mailing list