[Bf-blender-cvs] [5eeb6c00be8] blender2.8: GP: Disable reverse list order when uncheck userprefs option

Antonioya noreply at git.blender.org
Fri Oct 12 09:56:04 CEST 2018


Commit: 5eeb6c00be8de7db5608d6831a0d88bd39611771
Author: Antonioya
Date:   Fri Oct 12 09:54:46 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5eeb6c00be8de7db5608d6831a0d88bd39611771

GP: Disable reverse list order when uncheck userprefs option

Before, the list kept the reverse order enabled in the filter. Now the filter is reset when the option is disabled and don't need any user change or restart.

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

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

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

diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index aee426280c2..6e869a2f902 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -3838,9 +3838,17 @@ void uiTemplateList(
 	MEM_SAFE_FREE(dyn_data->items_filter_neworder);
 	dyn_data->items_len = dyn_data->items_shown = -1;
 
-	/* if reverse, enable reverse flag */
+	/* if reverse, enable reverse and forced flag */
 	if (reverse) {
 		ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
+		ui_list->filter_sort_flag |= UILST_FLT_FORCED_REVERSE;
+	}
+	else {
+		/* if it was forced, disable forced flag to restore all normal behavior */
+		if (ui_list->filter_sort_flag & UILST_FLT_FORCED_REVERSE) {
+			ui_list->filter_sort_flag &= ~UILST_FLT_SORT_REVERSE;
+			ui_list->filter_sort_flag &= ~UILST_FLT_FORCED_REVERSE;
+		}
 	}
 
 	/* When active item changed since last draw, scroll to it. */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index e17c7e17450..9a57f1ae37b 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -455,6 +455,7 @@ enum {
 /* uiList filter orderby type */
 enum {
 	UILST_FLT_SORT_ALPHA        = 1 << 0,
+	UILST_FLT_FORCED_REVERSE    = 1 << 1,   /* Special flag to indicate reverse was set by external parameter */
 	UILST_FLT_SORT_REVERSE      = 1u << 31  /* Special value, bitflag used to reverse order! */
 };
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index ad0d5cee797..1470681dec0 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3997,7 +3997,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "use_grease_pencil_reverse_layers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_REVERSE_LAYERS);
 	RNA_def_property_ui_text(prop, "Layers list Top-Down",
-		"Order the grease pencil list of layers from Top to Down (require restart)");
+		"Order the grease pencil list of layers from Top to Down");
 	
 	prop = RNA_def_property(srna, "grease_pencil_eraser_radius", PROP_INT, PROP_PIXEL);
 	RNA_def_property_int_sdna(prop, NULL, "gp_eraser");



More information about the Bf-blender-cvs mailing list