Bone color groups now get synced too when syncing bone <-> animdata stuff
authorJoshua Leung <aligorith@gmail.com>
Sat, 18 Aug 2012 05:43:06 +0000 (05:43 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sat, 18 Aug 2012 05:43:06 +0000 (05:43 +0000)
For now, the notifiers on bone group color setting won't trigger the necessary
color syncing, so it will be necessary to select another bone/object before the
view responds properly.

source/blender/editors/animation/anim_deps.c

index c4160a618687935daf8c8af304d249cf39633b27..619c62724edac1f67f2cfae84f31333654629378 100644 (file)
@@ -144,12 +144,13 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
                 * NOTE: this feature will only really work if groups by default contain the F-Curves for a single bone
                 */
                // TODO: if bone gets renamed, it would be best to be able to rename the group
-               // TODO: sync bone/group colors
                if (ob->pose) {
                        bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
                        bArmature *arm = ob->data;
                        
                        if (pchan) {
+                               bActionGroup *bgrp;
+                               
                                /* if one matches, sync the selection status */
                                if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))
                                        agrp->flag |= AGRP_SELECTED;
@@ -172,6 +173,13 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
                                        /* this can't possibly be active now */
                                        agrp->flag &= ~AGRP_ACTIVE;
                                }
+                               
+                               /* sync group colors */
+                               bgrp = (bActionGroup *)BLI_findlink(&ob->pose->agroups, (pchan->agrp_index - 1));
+                               if (bgrp) {
+                                       agrp->customCol = bgrp->customCol;
+                                       action_group_colors_sync(agrp, bgrp);
+                               }
                        }
                }
        }