From 18fa7589ef2892236dbc5320767956f34a4a98db Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Oct 2012 14:16:56 +0000 Subject: [PATCH] add comment about misuse of enum set function. --- source/blender/makesrna/intern/rna_wm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 2462733915b..28b034fc164 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -635,11 +635,18 @@ static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value) { wmKeyMapItem *kmi = ptr->data; - if (value == ESCKEY); - else if (value >= AKEY) + /* XXX, this should really be managed in an _itemf function, + * giving a list of valid enums, then silently changing them when they are set is not + * a good precedent, don't do this unless you have a good reason! */ + if (value == ESCKEY) { + /* pass */ + } + else if (value >= AKEY) { kmi->keymodifier = value; - else + } + else { kmi->keymodifier = 0; + } } -- 2.23.0