Fix: Improve poll for convert attribute operator

Converting an attribute does not work from edit mode because
there is no attribute API implemented for BMesh, so disable the
operation in that mode and add a poll message.
This commit is contained in:
Hans Goudey 2022-06-08 10:38:08 +02:00
parent 83fd3767d3
commit 1af652d42e
1 changed files with 5 additions and 2 deletions

View File

@ -261,8 +261,11 @@ static bool geometry_attribute_convert_poll(bContext *C)
if (GS(data->name) != ID_ME) {
return false;
}
CustomDataLayer *layer = BKE_id_attributes_active_get(data);
if (layer == nullptr) {
if (CTX_data_edit_object(C) != nullptr) {
CTX_wm_operator_poll_msg_set(C, "Operation is not allowed in edit mode");
return false;
}
if (BKE_id_attributes_active_get(data) == nullptr) {
return false;
}
return true;