Bugfix [#31976] Bone Group Custom color set is not respected when creating an
authorJoshua Leung <aligorith@gmail.com>
Tue, 3 Jul 2012 01:15:03 +0000 (01:15 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 3 Jul 2012 01:15:03 +0000 (01:15 +0000)
Action

Custom color set colors were not getting copied over when creating new action
groups. Instead, a "default set" was initialised for use instead.

source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/intern/action.c
source/blender/editors/animation/keyframing.c
source/blender/makesrna/intern/rna_pose.c

index 527d85c7cf3ed5c415b8f8737d19f93502c002c9..7df491c0fef183003b974ac3713bf752cf770de8 100644 (file)
@@ -113,7 +113,7 @@ struct bActionGroup *get_active_actiongroup(struct bAction *act);
 void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select);
 
 /* Sync colors used for action/bone group with theme settings */
-void action_group_colors_sync(struct bActionGroup *grp);
+void action_group_colors_sync(struct bActionGroup *grp, const struct bActionGroup *ref_grp);
 
 /* Add a new action group with the given name to the action */
 struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]);
index b3d2e3371f49f2eb32743f4409bfb6dc20fad018..8d1707725b561268e901d3488419d7d55b69afa1 100644 (file)
@@ -253,7 +253,7 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
 }
 
 /* Sync colors used for action/bone group with theme settings */
-void action_group_colors_sync(bActionGroup *grp)
+void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
 {
        /* only do color copying if using a custom color (i.e. not default color)  */
        if (grp->customCol) {
@@ -265,9 +265,15 @@ void action_group_colors_sync(bActionGroup *grp)
                        memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
                }
                else {
-                       /* init custom colors with a generic multi-color rgb set, if not initialized already
-                        * (for custom color set) */
-                       if (grp->cs.solid[0] == 0) {
+                       /* if a reference group is provided, use the custom color from there... */
+                       if (ref_grp) {
+                               /* assumption: reference group has a color set */
+                               memcpy(&grp->cs, &ref_grp->cs, sizeof(ThemeWireColor));
+                       }
+                       /* otherwise, init custom color with a generic/placeholder color set if
+                        * no previous theme color was used that we can just keep using
+                        */
+                       else if (grp->cs.solid[0] == 0) {
                                /* define for setting colors in theme below */
                                rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255);
                                rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255);
index 6250424d655d146bd5fd911807fa8ad15380cbf9..267746d5b91a3379de51f03c7d07a990c57e15ce 100644 (file)
@@ -201,7 +201,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
                                        grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
                                        if (grp) {
                                                agrp->customCol = grp->customCol;
-                                               action_group_colors_sync(agrp);
+                                               action_group_colors_sync(agrp, grp);
                                        }
                                }
                        }
index bb8a29f8fe478ae6d815f4c3c5a5e716a5237f93..35c85f0f40ebf36833e10463618213c38904396a 100644 (file)
@@ -142,9 +142,9 @@ void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
        /* ensure only valid values get set */
        if ((value >= -1) && (value < 21)) {
                grp->customCol = value;
-       
+               
                /* sync colors stored with theme colors based on the index specified */
-               action_group_colors_sync(grp);
+               action_group_colors_sync(grp, NULL);
        }
 }