[Bf-blender-cvs] [7bd5ba50194] blender2.8: Fix T57062: missing preview range drawing in graph editor.

Brecht Van Lommel noreply at git.blender.org
Thu Oct 4 15:50:36 CEST 2018


Commit: 7bd5ba501944a39c10975087a69f006065a0e75f
Author: Brecht Van Lommel
Date:   Thu Oct 4 15:45:58 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB7bd5ba501944a39c10975087a69f006065a0e75f

Fix T57062: missing preview range drawing in graph editor.

===================================================================

M	release/datafiles/userdef/userdef_default_theme.c
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/animation/anim_draw.c
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 6ef02b90e02..82cf7e86807 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -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),
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 00a07ae7b80..cf5087b848b 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -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
 
 }
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 05ea3fd6314..0ab6cdb3526 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -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 */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 112d4a0f33b..458b43231d9 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -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 */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 4ed82321abc..fbbaa544e2c 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -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;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index e7d528d8f67..6d8077633a4 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 4af61f66864..a2840b0443c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -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);



More information about the Bf-blender-cvs mailing list