diff options
author | Julian Eisel <julian@blender.org> | 2021-07-05 17:02:56 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-07-05 17:06:47 +0300 |
commit | cadda7aa5cd557fd34cddf58b9f4bb2e8db52847 (patch) | |
tree | 68384a03004d9cf7630a52c2b0ec7a8bed6416ac /source | |
parent | b8115f0c5bd91f6aa9d70eb6bafab61b2051b003 (diff) |
Assets: Disable file renaming operator for Asset Browsers
This operator only works with renaming files, not assets.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 49c3a29b67b..612f3a67aa3 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -2801,6 +2801,11 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } +static bool file_rename_poll(bContext *C) +{ + return ED_operator_file_active(C) && !ED_fileselect_is_asset_browser(CTX_wm_space_file(C)); +} + void FILE_OT_rename(struct wmOperatorType *ot) { /* identifiers */ @@ -2811,7 +2816,7 @@ void FILE_OT_rename(struct wmOperatorType *ot) /* api callbacks */ ot->invoke = file_rename_invoke; ot->exec = file_rename_exec; - ot->poll = ED_operator_file_active; + ot->poll = file_rename_poll; } /** \} */ |