[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48514] trunk/blender/source/blender: Bugfix [#31976] Bone Group Custom color set is not respected when creating an

Joshua Leung aligorith at gmail.com
Tue Jul 3 03:15:05 CEST 2012


Revision: 48514
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48514
Author:   aligorith
Date:     2012-07-03 01:15:03 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
Bugfix [#31976] Bone Group Custom color set is not respected when creating an
Action

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

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_action.h
    trunk/blender/source/blender/blenkernel/intern/action.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/makesrna/intern/rna_pose.c

Modified: trunk/blender/source/blender/blenkernel/BKE_action.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_action.h	2012-07-03 01:11:59 UTC (rev 48513)
+++ trunk/blender/source/blender/blenkernel/BKE_action.h	2012-07-03 01:15:03 UTC (rev 48514)
@@ -113,7 +113,7 @@
 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[]);

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2012-07-03 01:11:59 UTC (rev 48513)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2012-07-03 01:15:03 UTC (rev 48514)
@@ -253,7 +253,7 @@
 }
 
 /* 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 @@
 			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);

Modified: trunk/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframing.c	2012-07-03 01:11:59 UTC (rev 48513)
+++ trunk/blender/source/blender/editors/animation/keyframing.c	2012-07-03 01:15:03 UTC (rev 48514)
@@ -201,7 +201,7 @@
 					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);
 					}
 				}
 			}

Modified: trunk/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_pose.c	2012-07-03 01:11:59 UTC (rev 48513)
+++ trunk/blender/source/blender/makesrna/intern/rna_pose.c	2012-07-03 01:15:03 UTC (rev 48514)
@@ -142,9 +142,9 @@
 	/* 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);
 	}
 }
 




More information about the Bf-blender-cvs mailing list