[Bf-blender-cvs] [190809d] master: UIList tweak: make active item visible when it changes somehow (useful e.g. when weight-paintings a rigged mesh).

Bastien Montagne noreply at git.blender.org
Sun Jan 12 15:58:36 CET 2014


Commit: 190809d8abcd9780a69d8bb001dcf342111ee350
Author: Bastien Montagne
Date:   Sun Jan 12 15:56:47 2014 +0100
https://developer.blender.org/rB190809d8abcd9780a69d8bb001dcf342111ee350

UIList tweak: make active item visible when it changes somehow (useful e.g. when weight-paintings a rigged mesh).

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

M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesdna/DNA_screen_types.h

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

diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index c7de757..e94fc2d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2816,6 +2816,12 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
 	}
 	dyn_data->items_len = dyn_data->items_shown = -1;
 
+	/* When active item changed since last draw, scroll to it. */
+	if (activei != ui_list->list_last_activei) {
+		ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
+		ui_list->list_last_activei = activei;
+	}
+
 	/* Filter list items! (not for compact layout, though) */
 	if (dataptr->data && prop) {
 		int filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE;
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index d343b2b..beb230e 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -172,10 +172,10 @@ typedef struct uiList {           /* some list UI data need to be saved in file
 	int list_scroll;
 	int list_grip;
 	int list_last_len;
-	int padi1;
+	int list_last_activei;
 
 	/* Filtering data. */
-	char filter_byname[64];	      /* defined as UI_MAX_NAME_STR */
+	char filter_byname[64];       /* defined as UI_MAX_NAME_STR */
 	int filter_flag;
 	int filter_sort_flag;




More information about the Bf-blender-cvs mailing list