Assets: Disable file renaming operator for Asset Browsers

This operator only works with renaming files, not assets.
This commit is contained in:
Julian Eisel 2021-07-05 16:02:56 +02:00
parent b8115f0c5b
commit cadda7aa5c
Notes: blender-bot 2023-02-13 23:17:13 +01:00
Referenced by issue #89541, Attempting to rename data-block ID name for material asset via F2 on thumbnail results in error
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}
/** \} */