diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-06-01 17:54:44 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-06-01 17:54:44 +0400 |
commit | 1ced3560099b66d70399b4a5cfbb343b36562979 (patch) | |
tree | d2927d8f403e2cb7a0526f40068d4e8873db5c48 /source/blender/blenkernel/intern/action.c | |
parent | 719b3e26e768f03990be95e07f588b84deef9caa (diff) |
Action Group Colors for Bones (Part 2)
Colors used by Bone Groups are now copied/assigned to Action Groups too when
they're created now. This completes the work started in r.46960 to restore this
functionality from 2.48.
Currently, there is no control over when/whether these colors are copied over
(although it is possible to disable the display of these colors for relevant
animation editors if desired). Originally I was going to make this a more
generic Keying Sets feature, though that turned out to be a bit too complex to
manage.
Other notes:
* Split out the code for copying colors to a common library function
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 233647c9ec6..b3d2e3371f4 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -252,6 +252,31 @@ 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) +{ + /* only do color copying if using a custom color (i.e. not default color) */ + if (grp->customCol) { + if (grp->customCol > 0) { + /* copy theme colors on-to group's custom color in case user tries to edit color */ + bTheme *btheme = U.themes.first; + ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)]; + + 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) { + /* 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); + rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255); + } + } + } +} + /* Add a new action group with the given name to the action */ bActionGroup *action_groups_add_new(bAction *act, const char name[]) { @@ -409,10 +434,9 @@ void action_groups_clear_tempflags(bAction *act) /* *************** Pose channels *************** */ -/* usually used within a loop, so we got a N^2 slowdown */ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) { - if (ELEM(NULL, pose, name) || (name[0] == 0)) + if (ELEM(NULL, pose, name) || (name[0] == '\0')) return NULL; if (pose->chanhash) |