Commit: 38e1b92b7a2ce83a82a7f80e2e002d8262d7bf04 Author: Campbell Barton Date: Tue Dec 6 18:26:24 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rB38e1b92b7a2ce83a82a7f80e2e002d8262d7bf04
Fix T102964: Key-map event type values changed for NDOF buttons Regression in [0] changed NDOF key-map values. Restore the previous values & add missing view buttons to rna_enum_event_type_items. [0]: ecda118be407163096641db36b6ee8bf1d88ee55 Differential Revision: https://developer.blender.org/D16701 =================================================================== M intern/ghost/intern/GHOST_NDOFManager.h M source/blender/makesrna/intern/rna_wm.c M source/blender/windowmanager/wm_event_types.h =================================================================== diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h index 2d5bba14aa4..34ee9d71fba 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.h +++ b/intern/ghost/intern/GHOST_NDOFManager.h @@ -27,7 +27,13 @@ typedef enum { } NDOF_DeviceT; -/* NDOF device button event types */ +/** + * NDOF device button event types. + * + * \note Button values are stored in DNA as part of key-map items. + * Existing values should not be changed. Otherwise, a mapping must be used, + * see #NDOF_BUTTON_INDEX_AS_EVENT. + */ typedef enum { /* Used internally, never sent or used as an index. */ NDOF_BUTTON_NONE = -1, @@ -58,6 +64,11 @@ typedef enum { NDOF_BUTTON_DOMINANT, NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS, + /* Store Views. */ + NDOF_BUTTON_V1, + NDOF_BUTTON_V2, + NDOF_BUTTON_V3, + _NDOF_UNUSED_0, /* General-purpose buttons. * Users can assign functions via keymap editor. */ NDOF_BUTTON_1, @@ -74,11 +85,8 @@ typedef enum { NDOF_BUTTON_A, NDOF_BUTTON_B, NDOF_BUTTON_C, - /* Store Views. */ - NDOF_BUTTON_V1, - NDOF_BUTTON_V2, - NDOF_BUTTON_V3, - /* Keyboard emulation. */ + + /* Keyboard emulation (keep last as they are mapped to regular keyboard events). */ NDOF_BUTTON_ESC, NDOF_BUTTON_ENTER, NDOF_BUTTON_DELETE, diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 83e3e4eb335..55ceee55684 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -99,6 +99,10 @@ static const EnumPropertyItem event_ndof_type_items[] = { {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""}, {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""}, {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""}, + /* View buttons. */ + {NDOF_BUTTON_V1, "NDOF_BUTTON_V1", 0, "View 1", ""}, + {NDOF_BUTTON_V2, "NDOF_BUTTON_V2", 0, "View 2", ""}, + {NDOF_BUTTON_V3, "NDOF_BUTTON_V3", 0, "View 3", ""}, /* general-purpose buttons */ {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""}, {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""}, @@ -113,10 +117,6 @@ static const EnumPropertyItem event_ndof_type_items[] = { {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""}, {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""}, {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""}, - /* View buttons. */ - {NDOF_BUTTON_V1, "NDOF_BUTTON_V1", 0, "View 1", ""}, - {NDOF_BUTTON_V2, "NDOF_BUTTON_V2", 0, "View 2", ""}, - {NDOF_BUTTON_V3, "NDOF_BUTTON_V3", 0, "View 3", ""}, # if 0 /* Never used (converted to keyboard events by GHOST). */ /* keyboard emulation */ {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"}, @@ -347,6 +347,10 @@ const EnumPropertyItem rna_enum_event_type_items[] = { {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift", "NdofShift"}, {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl", "NdofCtrl"}, #endif + /* View buttons. */ + {NDOF_BUTTON_V1, "NDOF_BUTTON_V1", 0, "NDOF View 1", ""}, + {NDOF_BUTTON_V2, "NDOF_BUTTON_V2", 0, "NDOF View 2", ""}, + {NDOF_BUTTON_V3, "NDOF_BUTTON_V3", 0, "NDOF View 3", ""}, /* general-purpose buttons */ {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", "NdofB1"}, {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", "NdofB2"}, diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index c36c57a12ae..c7678223ce4 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -279,25 +279,25 @@ enum { NDOF_BUTTON_DOMINANT = 0x01a3, /* 419 */ NDOF_BUTTON_PLUS = 0x01a4, /* 420 */ NDOF_BUTTON_MINUS = 0x01a5, /* 421 */ + /* Store/restore views. */ + NDOF_BUTTON_V1 = 0x01a6, /* 422 */ + NDOF_BUTTON_V2 = 0x01a7, /* 423 */ + NDOF_BUTTON_V3 = 0x01a8, /* 424 */ /* General-purpose buttons. */ - NDOF_BUTTON_1 = 0x01a6, /* 422 */ - NDOF_BUTTON_2 = 0x01a7, /* 423 */ - NDOF_BUTTON_3 = 0x01a8, /* 424 */ - NDOF_BUTTON_4 = 0x01a9, /* 425 */ - NDOF_BUTTON_5 = 0x01aa, /* 426 */ - NDOF_BUTTON_6 = 0x01ab, /* 427 */ - NDOF_BUTTON_7 = 0x01ac, /* 428 */ - NDOF_BUTTON_8 = 0x01ad, /* 429 */ - NDOF_BUTTON_9 = 0x01ae, /* 430 */ - NDOF_BUTTON_10 = 0x01af, /* 431 */ + NDOF_BUTTON_1 = 0x01aa, /* 426 */ + NDOF_BUTTON_2 = 0x01ab, /* 427 */ + NDOF_BUTTON_3 = 0x01ac, /* 428 */ + NDOF_BUTTON_4 = 0x01ad, /* 429 */ + NDOF_BUTTON_5 = 0x01ae, /* 430 */ + NDOF_BUTTON_6 = 0x01af, /* 431 */ + NDOF_BUTTON_7 = 0x01b0, /* 432 */ + NDOF_BUTTON_8 = 0x01b1, /* 433 */ + NDOF_BUTTON_9 = 0x01b2, /* 434 */ + NDOF_BUTTON_10 = 0x01b3, /* 435 */ /* more general-purpose buttons */ - NDOF_BUTTON_A = 0x01b0, /* 432 */ - NDOF_BUTTON_B = 0x01b1, /* 433 */ - NDOF_BUTTON_C = 0x01b2, /* 434 */ - /* Store/restore views. */ - NDOF_BUTTON_V1 = 0x01b3, /* 435 */ - NDOF_BUTTON_V2 = 0x01b4, /* 436 */ - NDOF_BUTTON_V3 = 0x01b5, /* 437 */ + NDOF_BUTTON_A = 0x01b4, /* 436 */ + NDOF_BUTTON_B = 0x01b5, /* 437 */ + NDOF_BUTTON_C = 0x01b6, /* 438 */ /* Disabled as GHOST converts these to keyboard events * which use regular keyboard event handling logic. */ @@ -313,8 +313,8 @@ enum { NDOF_BUTTON_CTRL = 0x01bd, /* 445 */ #endif -#define _NDOF_MAX NDOF_BUTTON_V3 -#define _NDOF_BUTTON_MAX NDOF_BUTTON_V3 +#define _NDOF_MAX NDOF_BUTTON_C +#define _NDOF_BUTTON_MAX NDOF_BUTTON_C /* ********** End of Input devices. ********** */ _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
