Anim: Avoid loading alpha channel from theme for keyframe drawing
The theme has a color for each keyframe type. This is exposed in RNA and the preferences UI as an RGB color, so without alpha channel. The code that loads the color from the theme, however, does include that unsettable alpha channel, though. In practice this doesn't cause issues, as the versioning code ensures that the default colors are stored with `alpha=uint8_t(255)`. While developing, however, this caused me considerable headscratching, as I was missing that little bit of versioning code, which means that the default color was set to all-zeroes, and thus had a zero alpha. This is now resolved by altering the drawing code to only load the RGB component from the theme. This way only the user-settable bytes are loaded, while the alpha component is handled a different way (setting it to an absolute value, instead of multiplying the theme value). No user-perceivable changes, just some developer comfort. Pull Request: https://projects.blender.org/blender/blender/pulls/120311
This commit is contained in:
@@ -81,27 +81,26 @@ void draw_keyframe_shape(const float x,
|
||||
if (draw_fill) {
|
||||
/* get interior colors from theme (for selected and unselected only) */
|
||||
switch (key_type) {
|
||||
case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames (default theme) */
|
||||
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_BREAKDOWN_SELECT : TH_KEYTYPE_BREAKDOWN, fill_col);
|
||||
case BEZT_KEYTYPE_BREAKDOWN:
|
||||
UI_GetThemeColor3ubv(sel ? TH_KEYTYPE_BREAKDOWN_SELECT : TH_KEYTYPE_BREAKDOWN, fill_col);
|
||||
break;
|
||||
case BEZT_KEYTYPE_EXTREME: /* reddish frames (default theme) */
|
||||
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_EXTREME_SELECT : TH_KEYTYPE_EXTREME, fill_col);
|
||||
case BEZT_KEYTYPE_EXTREME:
|
||||
UI_GetThemeColor3ubv(sel ? TH_KEYTYPE_EXTREME_SELECT : TH_KEYTYPE_EXTREME, fill_col);
|
||||
break;
|
||||
case BEZT_KEYTYPE_JITTER: /* greenish frames (default theme) */
|
||||
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_JITTER_SELECT : TH_KEYTYPE_JITTER, fill_col);
|
||||
case BEZT_KEYTYPE_JITTER:
|
||||
UI_GetThemeColor3ubv(sel ? TH_KEYTYPE_JITTER_SELECT : TH_KEYTYPE_JITTER, fill_col);
|
||||
break;
|
||||
case BEZT_KEYTYPE_MOVEHOLD: /* similar to traditional keyframes, but different... */
|
||||
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_MOVEHOLD_SELECT : TH_KEYTYPE_MOVEHOLD, fill_col);
|
||||
case BEZT_KEYTYPE_MOVEHOLD:
|
||||
UI_GetThemeColor3ubv(sel ? TH_KEYTYPE_MOVEHOLD_SELECT : TH_KEYTYPE_MOVEHOLD, fill_col);
|
||||
break;
|
||||
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames (default theme) */
|
||||
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_KEYFRAME_SELECT : TH_KEYTYPE_KEYFRAME, fill_col);
|
||||
case BEZT_KEYTYPE_KEYFRAME:
|
||||
UI_GetThemeColor3ubv(sel ? TH_KEYTYPE_KEYFRAME_SELECT : TH_KEYTYPE_KEYFRAME, fill_col);
|
||||
break;
|
||||
}
|
||||
|
||||
/* NOTE: we don't use the straight alpha from the theme, or else effects such as
|
||||
* graying out protected/muted channels doesn't work correctly!
|
||||
*/
|
||||
fill_col[3] *= alpha;
|
||||
/* For effects like graying out protected/muted channels. The theme RNA/UI doesn't allow users
|
||||
* to set the alpha. */
|
||||
fill_col[3] = 255.0f * alpha;
|
||||
|
||||
if (!draw_outline) {
|
||||
/* force outline color to match */
|
||||
|
||||
Reference in New Issue
Block a user