diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 12 |
3 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 44e99bd2995..0f3ea27a7f9 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -327,6 +327,10 @@ if(WITH_OPENVDB) endif() endif() +if(WITH_INPUT_NDOF) + add_definitions(-DWITH_INPUT_NDOF) +endif() + # Build makesrna executable blender_include_dirs( . diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index cbf7bb4d5e0..29c0e948a4c 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -292,11 +292,13 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value) } } +#ifdef WITH_INPUT_NDOF static void rna_userdef_ndof_deadzone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { UserDef *userdef = ptr->data; WM_ndof_deadzone_set(userdef->ndof_deadzone); } +#endif static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value) { @@ -4333,6 +4335,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; +#ifdef WITH_INPUT_NDOF static EnumPropertyItem ndof_view_navigation_items[] = { {0, "FREE", 0, "Free", "Use full 6 degrees of freedom by default"}, {NDOF_MODE_ORBIT, "ORBIT", 0, "Orbit", "Orbit about the view center by default"}, @@ -4344,6 +4347,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) {0, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"}, {0, NULL, 0, NULL, NULL} }; +#endif /* WITH_INPUT_NDOF */ static EnumPropertyItem view_zoom_styles[] = { {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"}, @@ -4421,6 +4425,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tweak Threshold", "Number of pixels you have to drag before tweak event is triggered"); +#ifdef WITH_INPUT_NDOF /* 3D mouse settings */ /* global options */ prop = RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); @@ -4501,6 +4506,13 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_FLY_HELICOPTER); RNA_def_property_ui_text(prop, "Helicopter Mode", "Device up/down directly controls your Z position"); + /* let Python know whether NDOF is enabled */ + prop = RNA_def_boolean(srna, "use_ndof", true, "", ""); +#else + prop = RNA_def_boolean(srna, "use_ndof", false, "", ""); +#endif /* WITH_INPUT_NDOF */ + RNA_def_property_flag(prop, PROP_IDPROPERTY); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dbl_click_time"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 026d2e209a3..ba77e2a1768 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -118,6 +118,7 @@ static EnumPropertyItem event_textinput_type_items[] = { {0, NULL, 0, NULL, NULL} }; +#ifdef WITH_INPUT_NDOF static EnumPropertyItem event_ndof_type_items[] = { {NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""}, /* buttons on all 3dconnexion devices */ @@ -167,7 +168,8 @@ static EnumPropertyItem event_ndof_type_items[] = { {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""}, {0, NULL, 0, NULL, NULL} }; -#endif +#endif /* WITH_INPUT_NDOF */ +#endif /* RNA_RUNTIME */ /* not returned: CAPSLOCKKEY, UNKNOWNKEY */ EnumPropertyItem rna_enum_event_type_items[] = { @@ -332,6 +334,7 @@ EnumPropertyItem rna_enum_event_type_items[] = { {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", "TmrReport"}, {TIMERREGION, "TIMERREGION", 0, "Timer Region", "TmrReg"}, {0, "", 0, NULL, NULL}, +#ifdef WITH_INPUT_NDOF {NDOF_MOTION, "NDOF_MOTION", 0, "NDOF Motion", "NdofMov"}, /* buttons on all 3dconnexion devices */ {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "NDOF Menu", "NdofMenu"}, @@ -379,6 +382,7 @@ EnumPropertyItem rna_enum_event_type_items[] = { {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", "NdofBB"}, {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", "NdofBC"}, {0, NULL, 0, NULL, NULL} +#endif /* WITH_INPUT_NDOF */ }; EnumPropertyItem rna_enum_event_value_items[] = { @@ -701,10 +705,12 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value) kmi->type = TIMER; kmi->val = KM_NOTHING; break; +#ifdef WITH_INPUT_NDOF case KMI_TYPE_NDOF: kmi->type = NDOF_MOTION; kmi->val = KM_NOTHING; break; +#endif } } } @@ -738,7 +744,9 @@ static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerR 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; +#ifdef WITH_INPUT_NDOF if (map_type == KMI_TYPE_NDOF) return event_ndof_type_items; +#endif if (map_type == KMI_TYPE_TEXTINPUT) return event_textinput_type_items; else return rna_enum_event_type_items; } @@ -2014,7 +2022,9 @@ static void rna_def_keyconfig(BlenderRNA *brna) {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""}, {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""}, {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""}, +#ifdef WITH_INPUT_NDOF {KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""}, +#endif {KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""}, {KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""}, {0, NULL, 0, NULL, NULL} |