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
This commit is contained in:
@@ -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! */
|
||||
|
||||
Reference in New Issue
Block a user