== Proxies + Bone Groups ==
authorJoshua Leung <aligorith@gmail.com>
Sun, 16 Mar 2008 03:51:00 +0000 (03:51 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 16 Mar 2008 03:51:00 +0000 (03:51 +0000)
Bone Groups are now always copied from the source armature. This does mean that it isn't possible to have 'local' bone groups as for constraints, but it is better than losing bone groups from the original.

source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/armature.c

index b8c05f3bb7b7284b3c5691a6ad4ba2800b4ae2ed..3b4de305545a25576bcbf15ab54af278f26adbbe 100644 (file)
@@ -295,7 +295,7 @@ void copy_pose(bPose **dst, bPose *src, int copycon)
        
        outPose= MEM_callocN(sizeof(bPose), "pose");
        
-       duplicatelist (&outPose->chanbase, &src->chanbase);
+       duplicatelist(&outPose->chanbase, &src->chanbase);
        
        if (copycon) {
                for (pchan=outPose->chanbase.first; pchan; pchan=pchan->next) {
@@ -314,11 +314,11 @@ void free_pose_channels(bPose *pose)
        
        if (pose->chanbase.first) {
                for (pchan = pose->chanbase.first; pchan; pchan=pchan->next){
-                       if(pchan->path)
+                       if (pchan->path)
                                MEM_freeN(pchan->path);
                        free_constraints(&pchan->constraints);
                }
-               BLI_freelistN (&pose->chanbase);
+               BLI_freelistN(&pose->chanbase);
        }
 }
 
index 7ec56bd08abbfb7915a60fa67a7b6d5f7cc6d864..4bb31c1e9b916cd6cf8a28c3df325ba4b1f3d950 100644 (file)
@@ -1389,18 +1389,26 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
        bPoseChannel *pchan, *pchanp, pchanw;
        bConstraint *con;
        
-       if(frompose==NULL) return;
+       if (frompose==NULL) return;
        
        /* exception, armature local layer should be proxied too */
-       if(pose->proxy_layer)
+       if (pose->proxy_layer)
                ((bArmature *)ob->data)->layer= pose->proxy_layer;
        
        /* clear all transformation values from library */
        rest_pose(frompose);
        
-       pchan= pose->chanbase.first;
-       for(; pchan; pchan= pchan->next) {
-               if(pchan->bone->layer & layer_protected) {
+       /* copy over all of the proxy's bone groups */
+               /* TODO for later - implement 'local' bone groups as for constraints
+                *      Note: this isn't trivial, as bones reference groups by index not by pointer, 
+                *               so syncing things correctly needs careful attention
+                */
+       BLI_freelistN(&pose->agroups);
+       duplicatelist(&pose->agroups, &frompose->agroups);
+       pose->active_group= frompose->active_group;
+       
+       for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+               if (pchan->bone->layer & layer_protected) {
                        ListBase proxylocal_constraints = {NULL, NULL};
                        pchanp= get_pose_channel(frompose, pchan->name);