Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_channels_defines.c
| Context not available. | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "GPU_immediate.h" | |||||
| /* *********************************************** */ | /* *********************************************** */ | ||||
| // XXX constant defines to be moved elsewhere? | // XXX constant defines to be moved elsewhere? | ||||
| Context not available. | |||||
| /* set backdrop drawing color */ | /* set backdrop drawing color */ | ||||
| acf->get_backdrop_color(ac, ale, color); | acf->get_backdrop_color(ac, ale, color); | ||||
| glColor3fv(color); | |||||
| /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ | /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ | ||||
| const unsigned char coloruc[4] = {color[0]*255, color[1]*255, color[2]*255, 255}; | |||||
Severin: It's a bit ugly to have float->uchar conversions everywhere, I'd suggest you solve this a bit… | |||||
merwinUnsubmitted Not Done Inline ActionsI disagree here. Why should a roundbox drawing function have two or more interfaces? I think it should just take byte[4] colors (like now) or just float[4] colors and callers have to deal with it. Looks like float colors are used more often so can we use that? UI_GetThemeColorShade4fv already exists. Keep the new UI_GetThemeColorShade4ubv because it is useful. I'll add immUniformColor4fv in a minute, so "git stash" then "git pull --rebase" then "git stash pop". Sorry for the extra work @Krantz Geoffroy (kgeogeo) -- we're almost there! merwin: I disagree here. Why should a roundbox drawing function have two or more interfaces? I think it… | |||||
| UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); | UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); | ||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); | UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, coloruc); | ||||
| } | } | ||||
| Context not available. | |||||
| /* set backdrop drawing color */ | /* set backdrop drawing color */ | ||||
| acf->get_backdrop_color(ac, ale, color); | acf->get_backdrop_color(ac, ale, color); | ||||
| glColor3fv(color); | |||||
| /* rounded corners on LHS only | /* rounded corners on LHS only | ||||
| * - top and bottom | * - top and bottom | ||||
| * - special hack: make the top a bit higher, since we are first... | * - special hack: make the top a bit higher, since we are first... | ||||
| */ | */ | ||||
| const unsigned char coloruc[4] = {color[0]*255, color[1]*255, color[2]*255, 255}; | |||||
| UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); | UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); | ||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); | UI_draw_roundbox_gl_mode(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, coloruc); | ||||
| } | } | ||||
| /* name for summary entries */ | /* name for summary entries */ | ||||
| Context not available. | |||||
| /* set backdrop drawing color */ | /* set backdrop drawing color */ | ||||
| acf->get_backdrop_color(ac, ale, color); | acf->get_backdrop_color(ac, ale, color); | ||||
| glColor3fv(color); | |||||
| /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ | /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ | ||||
| const unsigned char coloruc[4] = {color[0]*255, color[1]*255, color[2]*255, 255}; | |||||
| UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); | UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); | ||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); | UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, coloruc); | ||||
| } | } | ||||
| /* name for group entries */ | /* name for group entries */ | ||||
| Context not available. | |||||
| /* set backdrop drawing color */ | /* set backdrop drawing color */ | ||||
| acf->get_backdrop_color(ac, ale, color); | acf->get_backdrop_color(ac, ale, color); | ||||
| glColor3fv(color); | |||||
| /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ | /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ | ||||
| const unsigned char coloruc[4] = {color[0]*255, color[1]*255, color[2]*255, 255}; | |||||
| UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); | UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); | ||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5); | UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5, coloruc); | ||||
| } | } | ||||
| /* name for nla controls expander entries */ | /* name for nla controls expander entries */ | ||||
| Context not available. | |||||
| * so we ignore that and use our own when needed | * so we ignore that and use our own when needed | ||||
| */ | */ | ||||
| nla_action_get_color(adt, (bAction *)ale->data, color); | nla_action_get_color(adt, (bAction *)ale->data, color); | ||||
| /* only on top left corner, to show that this channel sits on top of the preceding ones | |||||
| * while still linking into the action line strip to the right | |||||
| */ | |||||
| UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT); | |||||
| /* draw slightly shifted up vertically to look like it has more separation from other channels, | |||||
| * but we then need to slightly shorten it so that it doesn't look like it overlaps | |||||
| */ | |||||
| if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { | if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { | ||||
| /* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */ | /* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */ | ||||
| glColor3fv(color); | const unsigned char coloruc[4] = {color[0]*255, color[1]*255, color[2]*255, 255}; | ||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8, coloruc); | |||||
| } | } | ||||
| else { | else { | ||||
| float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f; | float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f; | ||||
| glColor4f(color[0], color[1], color[2], alpha); | const unsigned char coloruc[4] = {color[0]*255, color[1]*255, color[2]*255, alpha}; | ||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8, coloruc); | |||||
| } | } | ||||
| /* only on top left corner, to show that this channel sits on top of the preceding ones | |||||
| * while still linking into the action line strip to the right | |||||
| */ | |||||
| UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT); | |||||
| /* draw slightly shifted up vertically to look like it has more separation from other channels, | |||||
| * but we then need to slightly shorten it so that it doesn't look like it overlaps | |||||
| */ | |||||
| UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8); | |||||
| } | } | ||||
| /* name for nla action entries */ | /* name for nla action entries */ | ||||
| Context not available. | |||||
It's a bit ugly to have float->uchar conversions everywhere, I'd suggest you solve this a bit differently:
Here, the call would simplify to this then: