[Bf-blender-cvs] [ee120d6293f] master: Fix T53476: File Browser: Selection Issue with 'fill' option.

Bastien Montagne noreply at git.blender.org
Tue Dec 5 22:37:46 CET 2017


Commit: ee120d6293fefec25d762b069d813440f3e54ee5
Author: Bastien Montagne
Date:   Tue Dec 5 22:34:49 2017 +0100
Branches: master
https://developer.blender.org/rBee120d6293fefec25d762b069d813440f3e54ee5

Fix T53476: File Browser: Selection Issue with 'fill' option.

Fill-selection would only go upward in list of items to find an already
selected one and fill-select all items in-between. Now, in case upward
search fails, it will also intent to go downward, effectiviely allowing
to 'fill-select' from bottom to top.

Note that top-to-bottom keeps priority (i.e. if a top-to-bottom
fill-selection is possible, it will always happen, even if a
bottom-to-top one is also possible).

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

M	source/blender/editors/space_file/file_ops.c

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

diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index cca33cdd1a7..217ce8f1d9a 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -151,15 +151,25 @@ static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill
 
 	/* if desired, fill the selection up from the last selected file to the current one */
 	if (fill && (sel.last >= 0) && (sel.last < numfiles) ) {
-		int f = sel.last;
-		while (f >= 0) {
+		int f;
+		/* Try to find a smaller-index selected item. */
+		for (f = sel.last; f >= 0; f--) {
 			if (filelist_entry_select_index_get(sfile->files, f, CHECK_ALL) )
 				break;
-			f--;
 		}
 		if (f >= 0) {
 			sel.first = f + 1;
 		}
+		/* If none found, try to find a higher-index selected item. */
+		else {
+			for (f = sel.first; f < numfiles; f++) {
+				if (filelist_entry_select_index_get(sfile->files, f, CHECK_ALL) )
+					break;
+			}
+			if (f < numfiles) {
+				sel.last = f - 1;
+			}
+		}
 	}
 	return sel;
 }



More information about the Bf-blender-cvs mailing list