UI: Allow spawning file browser dialog from regular file browser editor

When some path property was displayed in the File Browser, clicking the
icon to open a file browser dialog to choose a file/directory would
show an error. While this makes sense when you are already in a file
browser dialog (we don't support such nested file browser dialogs),
allow it when the file browser is opened as a normal editor, not as a
dialog.
This commit is contained in:
Julian Eisel 2023-01-24 15:30:10 +01:00
parent 10a06dfd11
commit 6e4e5f6484
1 changed files with 3 additions and 2 deletions

View File

@ -268,8 +268,9 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
FileBrowseOp *fbo;
char *str;
if (CTX_wm_space_file(C)) {
BKE_report(op->reports, RPT_ERROR, "Cannot activate a file selector, one already open");
const SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile && sfile->op) {
BKE_report(op->reports, RPT_ERROR, "Cannot activate a file selector dialog, one already open");
return OPERATOR_CANCELLED;
}