diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-13 11:35:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-13 11:56:40 +0300 |
commit | ba44919601c540218ce05765915689d3837b8420 (patch) | |
tree | 3a30b0e8e670d472bd5b282d0e1d32bd37806ffa /source/blender/makesrna/intern | |
parent | 0b711e6758b0ba3732b2e6cfceb009aa186e525e (diff) |
Fix Event.value RNA access with tweak event types
Accessing event.value would return unrelated values such as
PRESS, RELEASE, CLICK... etc. instead of NORTH, SOUTH... etc.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 1d833024823..e9b31b1d8b9 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -606,6 +606,18 @@ static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties); } +static const EnumPropertyItem *rna_Event_value_itemf(bContext *UNUSED(C), + PointerRNA *ptr, + PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) +{ + const wmEvent *event = ptr->data; + if (ISTWEAK(event->type)) { + return event_tweak_value_items; + } + return rna_enum_event_value_items; +} + static void rna_Event_ascii_get(PointerRNA *ptr, char *value) { const wmEvent *event = ptr->data; @@ -2113,6 +2125,7 @@ static void rna_def_event(BlenderRNA *brna) prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "val"); RNA_def_property_enum_items(prop, rna_enum_event_value_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Event_value_itemf"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some"); |