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/object/object_facemap_ops.c | |
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/object/object_facemap_ops.c')
-rw-r--r-- | source/blender/editors/object/object_facemap_ops.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c index 3d4d3c8f622..92f3d28878c 100644 --- a/source/blender/editors/object/object_facemap_ops.c +++ b/source/blender/editors/object/object_facemap_ops.c @@ -176,6 +176,21 @@ static bool face_map_supported_edit_mode_poll(bContext *C) return false; } +static bool face_map_supported_remove_poll(bContext *C) +{ + if (!face_map_supported_poll(C)) { + return false; + } + + Object *ob = ED_object_context(C); + bFaceMap *fmap = BLI_findlink(&ob->fmaps, ob->actfmap - 1); + if (fmap) { + return true; + } + + return false; +} + static int face_map_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_context(C); @@ -225,7 +240,7 @@ void OBJECT_OT_face_map_remove(struct wmOperatorType *ot) ot->description = "Remove a face map from the active object"; /* api callbacks */ - ot->poll = face_map_supported_poll; + ot->poll = face_map_supported_remove_poll; ot->exec = face_map_remove_exec; /* flags */ |