Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c91
1 files changed, 16 insertions, 75 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index ae688846b95..d88f150c1dd 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -28,13 +28,6 @@
#ifdef RNA_RUNTIME
-static const EnumPropertyItem event_tweak_type_items[] = {
- {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
- {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
- {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL},
-};
-
static const EnumPropertyItem event_mouse_type_items[] = {
{LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
@@ -156,10 +149,6 @@ const EnumPropertyItem rna_enum_event_type_items[] = {
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", "WhIn"},
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", "WhOut"},
{0, "", 0, NULL, NULL},
- {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", "TwkL"},
- {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"},
- {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"},
- {0, "", 0, NULL, NULL},
{EVT_AKEY, "A", 0, "A", ""},
{EVT_BKEY, "B", 0, "B", ""},
{EVT_CKEY, "C", 0, "C", ""},
@@ -362,26 +351,7 @@ const EnumPropertyItem rna_enum_event_type_items[] = {
* This is needed for `km.keymap_items.new` value argument,
* to accept values from different types.
*/
-const EnumPropertyItem rna_enum_event_value_all_items[] = {
- {KM_ANY, "ANY", 0, "Any", ""},
- {KM_PRESS, "PRESS", 0, "Press", ""},
- {KM_RELEASE, "RELEASE", 0, "Release", ""},
- {KM_CLICK, "CLICK", 0, "Click", ""},
- {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
- {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
- {EVT_GESTURE_N, "NORTH", 0, "North", ""},
- {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
- {EVT_GESTURE_E, "EAST", 0, "East", ""},
- {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
- {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
- {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
- {EVT_GESTURE_W, "WEST", 0, "West", ""},
- {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
- {KM_NOTHING, "NOTHING", 0, "Nothing", ""},
- {0, NULL, 0, NULL, NULL},
-};
-
-const EnumPropertyItem rna_enum_event_value_keymouse_items[] = {
+const EnumPropertyItem rna_enum_event_value_items[] = {
{KM_ANY, "ANY", 0, "Any", ""},
{KM_PRESS, "PRESS", 0, "Press", ""},
{KM_RELEASE, "RELEASE", 0, "Release", ""},
@@ -393,7 +363,7 @@ const EnumPropertyItem rna_enum_event_value_keymouse_items[] = {
{0, NULL, 0, NULL, NULL},
};
-const EnumPropertyItem rna_enum_event_value_tweak_items[] = {
+const EnumPropertyItem rna_enum_event_direction_items[] = {
{KM_ANY, "ANY", 0, "Any", ""},
{EVT_GESTURE_N, "NORTH", 0, "North", ""},
{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
@@ -420,7 +390,6 @@ const EnumPropertyItem rna_enum_event_type_mask_items[] = {
{EVT_TYPE_MASK_MOUSE_BUTTON, "MOUSE_BUTTON", 0, "Mouse Button", ""},
{EVT_TYPE_MASK_MOUSE, "MOUSE", 0, "Mouse", ""},
{EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""},
- {EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""},
{EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -612,18 +581,6 @@ static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
return result;
}
-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 rna_enum_event_value_tweak_items;
- }
- return rna_enum_event_value_all_items;
-}
-
static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
{
const wmEvent *event = ptr->data;
@@ -915,10 +872,6 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
kmi->type = EVT_AKEY;
kmi->val = KM_PRESS;
break;
- case KMI_TYPE_TWEAK:
- kmi->type = EVT_TWEAK_L;
- kmi->val = KM_ANY;
- break;
case KMI_TYPE_MOUSE:
kmi->type = LEFTMOUSE;
kmi->val = KM_PRESS;
@@ -969,9 +922,6 @@ static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C),
if (map_type == KMI_TYPE_MOUSE) {
return event_mouse_type_items;
}
- if (map_type == KMI_TYPE_TWEAK) {
- return event_tweak_type_items;
- }
if (map_type == KMI_TYPE_TIMER) {
return event_timer_type_items;
}
@@ -986,24 +936,6 @@ static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C),
}
}
-static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C),
- PointerRNA *ptr,
- PropertyRNA *UNUSED(prop),
- bool *UNUSED(r_free))
-{
- int map_type = rna_wmKeyMapItem_map_type_get(ptr);
-
- if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) {
- return rna_enum_event_value_keymouse_items;
- }
- if (map_type == KMI_TYPE_TWEAK) {
- return rna_enum_event_value_tweak_items;
- }
- else {
- return rna_enum_event_value_all_items;
- }
-}
-
static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C,
PointerRNA *ptr,
PropertyRNA *UNUSED(prop),
@@ -2106,8 +2038,7 @@ static void rna_def_event(BlenderRNA *brna)
/* enums */
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_all_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Event_value_itemf");
+ RNA_def_property_enum_items(prop, rna_enum_event_value_items);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some");
@@ -2118,6 +2049,12 @@ static void rna_def_event(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Type", "");
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "direction");
+ RNA_def_property_enum_items(prop, rna_enum_event_direction_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Direction", "The direction (only applies to drag events)");
+
/* keyboard */
prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2538,7 +2475,6 @@ static void rna_def_keyconfig(BlenderRNA *brna)
static const EnumPropertyItem map_type_items[] = {
{KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
- {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
{KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
{KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
{KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
@@ -2679,11 +2615,16 @@ static void rna_def_keyconfig(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_all_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
+ RNA_def_property_enum_items(prop, rna_enum_event_value_items);
RNA_def_property_ui_text(prop, "Value", "");
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "direction");
+ RNA_def_property_enum_items(prop, rna_enum_event_direction_items);
+ RNA_def_property_ui_text(prop, "Direction", "The direction (only applies to drag events)");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "id");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);