diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2022-11-04 12:28:20 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-11-07 14:24:54 +0300 |
commit | 94930da29b310fcf729141b219c4b1dcac6ea6f4 (patch) | |
tree | c5b2bc2baa17fe8c26bd9e0acf3e8dd9faed884a /source/blender | |
parent | e031a45d6026d2fce23fca2b1001e783d2642031 (diff) |
Fix File Browser Move Bookmark malfunction if no item is selected
The operator was acting on non selected items (wasnt checking SpaceFile
bookmarknr for being -1) which could end up removing items even.
Now sanatize this by introducing proper poll (which returns false if
nothing is selected).
Fixes T102014.
Maniphest Tasks: T102014
Differential Revision: https://developer.blender.org/D16385
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index f68d329329f..6d7365fa136 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1309,6 +1309,18 @@ static int bookmark_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static bool file_bookmark_move_poll(bContext *C) +{ + SpaceFile *sfile = CTX_wm_space_file(C); + + /* Bookmarks are for file browsing only (not asset browsing). */ + if (!ED_operator_file_browsing_active(C)) { + return false; + } + + return sfile->bookmarknr != -1; +} + void FILE_OT_bookmark_move(wmOperatorType *ot) { static const EnumPropertyItem slot_move[] = { @@ -1325,8 +1337,7 @@ void FILE_OT_bookmark_move(wmOperatorType *ot) /* api callbacks */ ot->exec = bookmark_move_exec; - /* Bookmarks are for file browsing only (not asset browsing). */ - ot->poll = ED_operator_file_browsing_active; + ot->poll = file_bookmark_move_poll; /* flags */ ot->flag = OPTYPE_REGISTER; /* No undo! */ |