Revision: 17241
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17241
Author:   aligorith
Date:     2008-10-31 07:25:51 +0100 (Fri, 31 Oct 2008)

Log Message:
-----------
AnimSys2: Shapekeys recentering fix (attempt 2)

Now meshes with multiple users are not ignored. Previous tests had shown that 
there was a problem, but it turned out to be a missing case.

Also, added note of bug with bone roll changing randomly on EditMode transforms 
to fix. 

Modified Paths:
--------------
    branches/animsys2/source/blender/src/editobject.c
    branches/animsys2/source/blender/src/transform_generics.c

Modified: branches/animsys2/source/blender/src/editobject.c
===================================================================
--- branches/animsys2/source/blender/src/editobject.c   2008-10-31 05:51:16 UTC 
(rev 17240)
+++ branches/animsys2/source/blender/src/editobject.c   2008-10-31 06:25:51 UTC 
(rev 17241)
@@ -1851,7 +1851,7 @@
        int a, total= 0;
        
        /* keep track of what is changed */
-       int tot_change=0, tot_lib_error=0, tot_multiuser_mesh_error=0, 
tot_multiuser_arm_error=0;
+       int tot_change=0, tot_lib_error=0, tot_multiuser_arm_error=0;
        MVert *mvert;
 
        if(G.scene->id.lib || G.vd==NULL) return;
@@ -1913,9 +1913,7 @@
                                        tot_lib_error++;
                                }
                                else if(G.obedit==0 && 
(me=get_mesh(base->object)) ) {
-                                       if (me->id.us > 1) {
-                                               tot_multiuser_mesh_error++;
-                                       } else if (me->id.lib) {
+                                       if (me->id.lib) {
                                                tot_lib_error++;
                                        } else {
                                                if(centermode==2) {
@@ -1938,11 +1936,9 @@
                                                for(a=0; a<me->totvert; a++, 
mvert++) {
                                                        VecSubf(mvert->co, 
mvert->co, cent);
                                                }
-                                               me->flag |= ME_ISDONE;
                                                
                                                if (me->key) {
                                                        KeyBlock *kb;
-                                                       
                                                        for 
(kb=me->key->block.first; kb; kb=kb->next) {
                                                                float *fp= 
kb->data;
                                                                
@@ -1952,6 +1948,8 @@
                                                        }
                                                }
                                                
+                                               me->flag |= ME_ISDONE;
+                                               
                                                if(centermode) {
                                                        Mat3CpyMat4(omat, 
base->object->obmat);
                                                        
@@ -1990,6 +1988,18 @@
                                                                                
        for(a=0; a<tme->totvert; a++, mvert++) {
                                                                                
                VecSubf(mvert->co, mvert->co, cent);
                                                                                
        }
+                                                                               
        
+                                                                               
        if (tme->key) {
+                                                                               
                KeyBlock *kb;
+                                                                               
                for (kb=tme->key->block.first; kb; kb=kb->next) {
+                                                                               
                        float *fp= kb->data;
+                                                                               
                        
+                                                                               
                        for (a=0; a<kb->totelem; a++, fp+=3) {
+                                                                               
                                VecSubf(fp, fp, cent);
+                                                                               
                        }
+                                                                               
                }
+                                                                               
        }
+                                                                               
        
                                                                                
        tme->flag |= ME_ISDONE;
                                                                                
}
                                                                        }
@@ -2025,9 +2035,10 @@
                                                        /* don't allow Z change 
if curve is 2D */
                                                        if( !( cu->flag & CU_3D 
) )
                                                                cent[2] = 0.0;
-                                               } else {
+                                               } 
+                                               else {
                                                        INIT_MINMAX(min, max);
-               
+                                                       
                                                        nu= nu1;
                                                        while(nu) {
                                                                minmaxNurb(nu, 
min, max);
@@ -2134,14 +2145,12 @@
        }
        
        /* Warn if any errors occured */
-       if (tot_lib_error+tot_multiuser_mesh_error+tot_multiuser_arm_error) {
+       if (tot_lib_error+tot_multiuser_arm_error) {
                char err[512];
-               sprintf(err, "Warning %i Object(s) Not Centered, %i Changed:", 
tot_lib_error+tot_key_error+tot_multiuser_arm_error, tot_change);
+               sprintf(err, "Warning %i Object(s) Not Centered, %i Changed:", 
tot_lib_error+tot_multiuser_arm_error, tot_change);
                
                if (tot_lib_error)
                        sprintf(err+strlen(err), "|%i linked library objects", 
tot_lib_error);
-               if (tot_multiuser_mesh_error)
-                       sprintf(err+strlen(err), "|%i multiuser mesh 
object(s)", tot_multiuser_mesh_error);
                if (tot_multiuser_arm_error)
                        sprintf(err+strlen(err), "|%i multiuser armature 
object(s)", tot_multiuser_arm_error);
                

Modified: branches/animsys2/source/blender/src/transform_generics.c
===================================================================
--- branches/animsys2/source/blender/src/transform_generics.c   2008-10-31 
05:51:16 UTC (rev 17240)
+++ branches/animsys2/source/blender/src/transform_generics.c   2008-10-31 
06:25:51 UTC (rev 17241)
@@ -472,6 +472,7 @@
                        EditBone *ebo;
                        
                        /* Ensure all bones are correctly adjusted */
+                       // TODO: bone roll needs to be tweaked too for normal 
transforms, as it goes crazy atm
                        for (ebo=G.edbo.first; ebo; ebo=ebo->next){
                                
                                if ((ebo->flag & BONE_CONNECTED) && 
ebo->parent){


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to