Fix T57062: missing preview range drawing in graph editor.

This commit is contained in:
Brecht Van Lommel 2018-10-04 15:45:58 +02:00
parent 528a8bd788
commit 7bd5ba5019
7 changed files with 35 additions and 2 deletions

View File

@ -435,6 +435,7 @@ const bTheme U_theme_default = {
.facedot_size = 4,
.handle_vertex_select = RGBA(0xff8500ff),
.handle_vertex_size = 5,
.anim_preview_range = RGBA(0xa14d0066),
},
.tinfo = {
.back = RGBA(0x42424200),
@ -522,6 +523,7 @@ const bTheme U_theme_default = {
.keyframe_scale_fac = 1.0f,
.handle_vertex_size = 4,
.anim_active = RGBA(0xa14d0066),
.anim_preview_range = RGBA(0xa14d0066),
},
.tnla = {
.back = RGBA(0x35353500),
@ -563,6 +565,7 @@ const bTheme U_theme_default = {
.handle_vertex_size = 4,
.anim_active = RGBA(0xcc701a66),
.anim_non_active = RGBA(0x9987614d),
.anim_preview_range = RGBA(0xa14d0066),
.nla_tweaking = RGBA(0x4df31a4d),
.nla_tweakdupli = RGBA(0xd90000ff),
.nla_transition = RGBA(0x1c2630ff),

View File

@ -27,6 +27,7 @@
#include <string.h>
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_userdef_types.h"
@ -50,6 +51,12 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
if (!USER_VERSION_ATLEAST(280, 20)) {
memcpy(btheme, &U_theme_default, sizeof(*btheme));
}
if (!USER_VERSION_ATLEAST(280, 25)) {
copy_v4_v4_char(btheme->tact.anim_preview_range, btheme->tact.anim_active);
copy_v4_v4_char(btheme->tnla.anim_preview_range, btheme->tnla.anim_active);
copy_v4_v4_char(btheme->tipo.anim_preview_range, btheme->tact.anim_active);
}
#undef USER_VERSION_ATLEAST
}

View File

@ -174,7 +174,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_ANIM_ACTIVE, -25, -30);
immUniformThemeColorShadeAlpha(TH_ANIM_PREVIEW_RANGE, -25, -30);
//immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f); /* XXX: Fix this hardcoded color (anim_active) */
/* only draw two separate 'curtains' if there's no overlap between them */

View File

@ -265,6 +265,7 @@ typedef enum ThemeColorID {
TH_ANIM_ACTIVE, /* active action */
TH_ANIM_INACTIVE, /* no active action */
TH_ANIM_PREVIEW_RANGE,/* preview range overlay */
TH_NLA_TWEAK, /* 'tweaking' track in NLA */
TH_NLA_TWEAK_DUPLI, /* error/warning flag for other strips referencing dupli strip */

View File

@ -632,6 +632,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_ANIM_INACTIVE:
cp = ts->anim_non_active;
break;
case TH_ANIM_PREVIEW_RANGE:
cp = ts->anim_preview_range;
break;
case TH_NLA_TWEAK:
cp = ts->nla_tweaking;

View File

@ -344,6 +344,8 @@ typedef struct ThemeSpace {
/* NLA */
char anim_active[4]; /* Active Action + Summary Channel */
char anim_non_active[4]; /* Active Action = NULL */
char anim_preview_range[4]; /* Preview range overlay */
char anim_pad[4];
char nla_tweaking[4]; /* NLA 'Tweaking' action/strip */
char nla_tweakdupli[4]; /* NLA - warning color for duplicate instances of tweaking strip */

View File

@ -1937,6 +1937,12 @@ static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Channel Group", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
RNA_def_property_update(prop, 0, "rna_userdef_update");
rna_def_userdef_theme_spaces_vertex(srna);
rna_def_userdef_theme_spaces_curves(srna, false, true, true, true);
}
@ -2782,12 +2788,17 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
RNA_def_property_range(prop, 0.8f, 5.0f); /* Note: These limits prevent buttons overlapping (min), and excessive size... (max) */
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_userdef_update");
prop = RNA_def_property(srna, "summary", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Summary", "Color of summary channel");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
@ -2827,6 +2838,12 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "No Active Action", "Animation data-block doesn't have active action");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
RNA_def_property_array(prop, 3);