Fix T103453: Don't allow call Attribute Convert operator in edit mode

Don't allow calling Attribute Convert operator in edit mode.
Right now BMesh does not support attribute operations.

Differential Revision: https://developer.blender.org/D16864
This commit is contained in:
Iliya Katueshenock 2022-12-26 14:49:20 -05:00 committed by Hans Goudey
parent 5206d72dca
commit 997eb77fd4
Notes: blender-bot 2023-02-21 17:59:30 +01:00
Referenced by issue #103453, Color attribute conversion does not work in edit mode
1 changed files with 7 additions and 0 deletions

View File

@ -599,15 +599,22 @@ static bool geometry_color_attribute_convert_poll(bContext *C)
return false;
}
if (CTX_data_edit_object(C) != nullptr) {
CTX_wm_operator_poll_msg_set(C, "Operation is not allowed in edit mode");
return false;
}
Object *ob = ED_object_context(C);
ID *id = static_cast<ID *>(ob->data);
if (GS(id->name) != ID_ME) {
return false;
}
CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
if (layer == nullptr) {
return false;
}
return true;
}