[Bf-blender-cvs] [cadda7aa5cd] master: Assets: Disable file renaming operator for Asset Browsers
Julian Eisel
noreply at git.blender.org
Mon Jul 5 16:09:30 CEST 2021
Commit: cadda7aa5cd557fd34cddf58b9f4bb2e8db52847
Author: Julian Eisel
Date: Mon Jul 5 16:02:56 2021 +0200
Branches: master
https://developer.blender.org/rBcadda7aa5cd557fd34cddf58b9f4bb2e8db52847
Assets: Disable file renaming operator for Asset Browsers
This operator only works with renaming files, not assets.
===================================================================
M source/blender/editors/space_file/file_ops.c
===================================================================
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;
}
/** \} */
More information about the Bf-blender-cvs
mailing list