Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2022-11-04 12:28:20 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-11-07 12:28:37 +0300
commit671c3e1fa4accba4f51f9364d10ab677650d16f0 (patch)
treefff35d7a6e9a0107cce4d3adc574d6c091fac842 /source/blender/editors/space_file/file_ops.c
parent37ca6e4fd10fe8d42b8644ea354294b043d212aa (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/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c15
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! */