diff options
author | Philipp Oeser <lichtwerk> | 2021-07-22 11:10:57 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-07-22 11:11:44 +0300 |
commit | 57668d84cf17d5e883bdfe9ec584c0683d8db860 (patch) | |
tree | 2b0be59647677352d22c2ce34434f28eca1c1eba /source/blender/editors/geometry | |
parent | 8d5b9478a258bb0c5c438c79f8d08b76f8966602 (diff) |
Make polls for removing mesh data layers consistent
This was reported in T90026 for attributes, but was also true for:
- UVMaps
- Vertex Colors
- Sculpt Vertex Colors
- Face Maps
For Vertex groups and Shapekeys this was already done (in that their
remove poll would check if there is a vertex group or shapekey to begin
with), now make this consistent across all mentioned types.
Thx @vvv for the initial patch (where this was done for attributes only)
ref T90026
Reviewed By: HooglyBoogly
Maniphest Tasks: T90026
Differential Revision: https://developer.blender.org/D11990
Diffstat (limited to 'source/blender/editors/geometry')
-rw-r--r-- | source/blender/editors/geometry/geometry_attributes.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/editors/geometry/geometry_attributes.c b/source/blender/editors/geometry/geometry_attributes.c index 9b034d82a51..5cb491f116a 100644 --- a/source/blender/editors/geometry/geometry_attributes.c +++ b/source/blender/editors/geometry/geometry_attributes.c @@ -47,6 +47,21 @@ static bool geometry_attributes_poll(bContext *C) BKE_id_attributes_supported(data); } +static bool geometry_attributes_remove_poll(bContext *C) +{ + if (!geometry_attributes_poll(C)) { + return false; + } + + Object *ob = ED_object_context(C); + ID *data = (ob) ? ob->data : NULL; + if (BKE_id_attributes_active_get(data) != NULL) { + return true; + } + + return false; +} + static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), @@ -160,7 +175,7 @@ void GEOMETRY_OT_attribute_remove(wmOperatorType *ot) /* api callbacks */ ot->exec = geometry_attribute_remove_exec; - ot->poll = geometry_attributes_poll; + ot->poll = geometry_attributes_remove_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |