== Action Editor - Group Colours for Channels ==
It is now possible for Action Channels to be displayed using the colour of its group. The colour for an Action Group is only set when it is auto-created by keyframing (controls to tweak this may/may-not be added, time permitting). To enable the display of these colours, the View -> 'Use Group Colors' must be enabled. However, this is disabled by default.
This commit is contained in:
@@ -233,7 +233,9 @@ typedef enum SACTION_FLAG {
|
|||||||
/* don't include keyframes that are out of view */
|
/* don't include keyframes that are out of view */
|
||||||
SACTION_HORIZOPTIMISEON = (1<<5),
|
SACTION_HORIZOPTIMISEON = (1<<5),
|
||||||
/* hack for moving pose-markers (temp flag) */
|
/* hack for moving pose-markers (temp flag) */
|
||||||
SACTION_POSEMARKERS_MOVE = (1<<6)
|
SACTION_POSEMARKERS_MOVE = (1<<6),
|
||||||
|
/* draw action channels using group colours (where applicable) */
|
||||||
|
SACTION_DRAWGCOLORS = (1<<7)
|
||||||
} SACTION_FLAG;
|
} SACTION_FLAG;
|
||||||
|
|
||||||
/* SpaceAction AutoSnap Settings (also used by SpaceNLA) */
|
/* SpaceAction AutoSnap Settings (also used by SpaceNLA) */
|
||||||
|
|||||||
@@ -462,6 +462,7 @@ static void draw_channel_names(void)
|
|||||||
if ( IN_RANGE(yminc, G.v2d->cur.ymin, G.v2d->cur.ymax) ||
|
if ( IN_RANGE(yminc, G.v2d->cur.ymin, G.v2d->cur.ymax) ||
|
||||||
IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) )
|
IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) )
|
||||||
{
|
{
|
||||||
|
bActionGroup *grp = NULL;
|
||||||
short indent= 0, offset= 0, sel= 0, group=0;
|
short indent= 0, offset= 0, sel= 0, group=0;
|
||||||
int expand= -1, protect = -1, special= -1, mute = -1;
|
int expand= -1, protect = -1, special= -1, mute = -1;
|
||||||
char name[32];
|
char name[32];
|
||||||
@@ -495,6 +496,8 @@ static void draw_channel_names(void)
|
|||||||
bActionChannel *achan= (bActionChannel *)ale->data;
|
bActionChannel *achan= (bActionChannel *)ale->data;
|
||||||
|
|
||||||
group= (ale->grp) ? 1 : 0;
|
group= (ale->grp) ? 1 : 0;
|
||||||
|
grp= ale->grp;
|
||||||
|
|
||||||
indent = 0;
|
indent = 0;
|
||||||
special = -1;
|
special = -1;
|
||||||
|
|
||||||
@@ -524,7 +527,9 @@ static void draw_channel_names(void)
|
|||||||
bConstraintChannel *conchan = (bConstraintChannel *)ale->data;
|
bConstraintChannel *conchan = (bConstraintChannel *)ale->data;
|
||||||
|
|
||||||
indent = 2;
|
indent = 2;
|
||||||
|
|
||||||
group= (ale->grp) ? 1 : 0;
|
group= (ale->grp) ? 1 : 0;
|
||||||
|
grp= ale->grp;
|
||||||
|
|
||||||
if (EDITABLE_CONCHAN(conchan))
|
if (EDITABLE_CONCHAN(conchan))
|
||||||
protect = ICON_UNLOCKED;
|
protect = ICON_UNLOCKED;
|
||||||
@@ -548,7 +553,9 @@ static void draw_channel_names(void)
|
|||||||
|
|
||||||
indent = 2;
|
indent = 2;
|
||||||
protect = -1; // for now, until this can be supported by others
|
protect = -1; // for now, until this can be supported by others
|
||||||
|
|
||||||
group= (ale->grp) ? 1 : 0;
|
group= (ale->grp) ? 1 : 0;
|
||||||
|
grp= ale->grp;
|
||||||
|
|
||||||
if (icu->flag & IPO_MUTE)
|
if (icu->flag & IPO_MUTE)
|
||||||
mute = ICON_MUTE_IPO_ON;
|
mute = ICON_MUTE_IPO_ON;
|
||||||
@@ -581,7 +588,9 @@ static void draw_channel_names(void)
|
|||||||
|
|
||||||
indent = 1;
|
indent = 1;
|
||||||
special = geticon_ipo_blocktype(achan->ipo->blocktype);
|
special = geticon_ipo_blocktype(achan->ipo->blocktype);
|
||||||
|
|
||||||
group= (ale->grp) ? 1 : 0;
|
group= (ale->grp) ? 1 : 0;
|
||||||
|
grp= ale->grp;
|
||||||
|
|
||||||
if (FILTER_IPO_ACHAN(achan))
|
if (FILTER_IPO_ACHAN(achan))
|
||||||
expand = ICON_TRIA_DOWN;
|
expand = ICON_TRIA_DOWN;
|
||||||
@@ -598,7 +607,9 @@ static void draw_channel_names(void)
|
|||||||
|
|
||||||
indent = 1;
|
indent = 1;
|
||||||
special = ICON_CONSTRAINT;
|
special = ICON_CONSTRAINT;
|
||||||
|
|
||||||
group= (ale->grp) ? 1 : 0;
|
group= (ale->grp) ? 1 : 0;
|
||||||
|
grp= ale->grp;
|
||||||
|
|
||||||
if (FILTER_CON_ACHAN(achan))
|
if (FILTER_CON_ACHAN(achan))
|
||||||
expand = ICON_TRIA_DOWN;
|
expand = ICON_TRIA_DOWN;
|
||||||
@@ -625,8 +636,28 @@ static void draw_channel_names(void)
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* for normal channels */
|
/* for normal channels
|
||||||
|
* - use 3 shades of color group/standard colour for 3 indention level
|
||||||
|
* - use standard colour if enabled
|
||||||
|
*/
|
||||||
|
if ((G.saction->flag & SACTION_DRAWGCOLORS) && (grp)) {
|
||||||
|
char cp[3];
|
||||||
|
|
||||||
|
if (indent == 2) {
|
||||||
|
VECCOPY(cp, grp->cs.solid);
|
||||||
|
}
|
||||||
|
else if (indent == 1) {
|
||||||
|
VECCOPY(cp, grp->cs.select);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
VECCOPY(cp, grp->cs.active);
|
||||||
|
}
|
||||||
|
|
||||||
|
glColor3ub(cp[0], cp[1], cp[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
BIF_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
|
BIF_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
|
||||||
|
|
||||||
indent += group;
|
indent += group;
|
||||||
offset = 7 * indent;
|
offset = 7 * indent;
|
||||||
glRectf(x+offset, yminc, (float)NAMEWIDTH, ymaxc);
|
glRectf(x+offset, yminc, (float)NAMEWIDTH, ymaxc);
|
||||||
|
|||||||
@@ -1150,8 +1150,38 @@ void verify_pchan2achan_grouping (bAction *act, bPose *pose, char name[])
|
|||||||
grp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
|
grp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
|
||||||
|
|
||||||
grp->flag |= (AGRP_ACTIVE|AGRP_SELECTED|AGRP_EXPANDED);
|
grp->flag |= (AGRP_ACTIVE|AGRP_SELECTED|AGRP_EXPANDED);
|
||||||
|
|
||||||
|
/* copy name */
|
||||||
sprintf(grp->name, agrp->name);
|
sprintf(grp->name, agrp->name);
|
||||||
|
|
||||||
|
/* deal with group-color copying */
|
||||||
|
if (agrp->customCol) {
|
||||||
|
if (agrp->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[(agrp->customCol - 1)];
|
||||||
|
|
||||||
|
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* init custom colours with a generic multi-colour rgb set, if not initialised already */
|
||||||
|
if (agrp->cs.solid[0] == 0) {
|
||||||
|
/* define for setting colors in theme below */
|
||||||
|
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
|
||||||
|
|
||||||
|
SETCOL(grp->cs.solid, 0xff, 0x00, 0x00, 255);
|
||||||
|
SETCOL(grp->cs.select, 0x81, 0xe6, 0x14, 255);
|
||||||
|
SETCOL(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
|
||||||
|
|
||||||
|
#undef SETCOL
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* just copy color set specified */
|
||||||
|
memcpy(&grp->cs, &agrp->cs, sizeof(ThemeWireColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BLI_addtail(&act->groups, grp);
|
BLI_addtail(&act->groups, grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ enum {
|
|||||||
ACTMENU_VIEW_TIME,
|
ACTMENU_VIEW_TIME,
|
||||||
ACTMENU_VIEW_NOHIDE,
|
ACTMENU_VIEW_NOHIDE,
|
||||||
ACTMENU_VIEW_TRANSDELDUPS,
|
ACTMENU_VIEW_TRANSDELDUPS,
|
||||||
ACTMENU_VIEW_HORIZOPTIMISE
|
ACTMENU_VIEW_HORIZOPTIMISE,
|
||||||
|
ACTMENU_VIEW_GCOLORS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -347,6 +348,9 @@ static void do_action_viewmenu(void *arg, int event)
|
|||||||
case ACTMENU_VIEW_HORIZOPTIMISE: /* Include keyframes not in view (horizontally) when preparing to draw */
|
case ACTMENU_VIEW_HORIZOPTIMISE: /* Include keyframes not in view (horizontally) when preparing to draw */
|
||||||
G.saction->flag ^= SACTION_HORIZOPTIMISEON;
|
G.saction->flag ^= SACTION_HORIZOPTIMISEON;
|
||||||
break;
|
break;
|
||||||
|
case ACTMENU_VIEW_GCOLORS: /* Draw grouped-action channels using its group's color */
|
||||||
|
G.saction->flag ^= SACTION_DRAWGCOLORS;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
}
|
}
|
||||||
@@ -393,6 +397,11 @@ static uiBlock *action_viewmenu(void *arg_unused)
|
|||||||
menuwidth, 19, NULL, 0.0, 0.0, 1,
|
menuwidth, 19, NULL, 0.0, 0.0, 1,
|
||||||
ACTMENU_VIEW_NOHIDE, "");
|
ACTMENU_VIEW_NOHIDE, "");
|
||||||
|
|
||||||
|
uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_DRAWGCOLORS)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
|
||||||
|
"Use Group Colors|", 0, yco-=20,
|
||||||
|
menuwidth, 19, NULL, 0.0, 0.0, 1,
|
||||||
|
ACTMENU_VIEW_GCOLORS, "");
|
||||||
|
|
||||||
// this option may get removed in future
|
// this option may get removed in future
|
||||||
uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_HORIZOPTIMISEON)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
|
uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_HORIZOPTIMISEON)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
|
||||||
"Cull Out-of-View Keys (Time)|", 0, yco-=20,
|
"Cull Out-of-View Keys (Time)|", 0, yco-=20,
|
||||||
|
|||||||
Reference in New Issue
Block a user