diff --git a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
index e589951030..ff578025ce 100644
--- a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
+++ b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
@@ -144,16 +144,10 @@ macro(InitializeFreeCADBuildOptions)
if(MSVC)
set(FREECAD_3DCONNEXION_SUPPORT "NavLib" CACHE STRING "Select version of the 3Dconnexion device integration")
- set_property(CACHE FREECAD_3DCONNEXION_SUPPORT PROPERTY STRINGS "NavLib" "Raw input")
- else(MSVC)
- set(FREECAD_3DCONNEXION_SUPPORT "Raw input")
- endif(MSVC)
-
- if(MSVC)
- option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" ON)
- option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF) # 3/5/2021 current LibPack uses non-C++17 FLANN
+ set_property(CACHE FREECAD_3DCONNEXION_SUPPORT PROPERTY STRINGS "NavLib" "Raw input" "Both")
option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
elseif(APPLE)
+ set(FREECAD_USE_3DCONNEXION_RAWINPUT ON)
find_library(3DCONNEXIONCLIENT_FRAMEWORK 3DconnexionClient)
if(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
@@ -161,18 +155,27 @@ macro(InitializeFreeCADBuildOptions)
option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." OFF)
endif(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
else(MSVC)
+ set(FREECAD_USE_3DCONNEXION_RAWINPUT ON)
set(FREECAD_USE_3DCONNEXION OFF )
endif(MSVC)
+
+ if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "NavLib" AND FREECAD_USE_3DCONNEXION)
+ set(FREECAD_USE_3DCONNEXION_NAVLIB ON)
+ set(FREECAD_USE_3DCONNEXION OFF)
+ elseif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Both" AND FREECAD_USE_3DCONNEXION)
+ set(FREECAD_USE_3DCONNEXION_NAVLIB ON)
+ set(FREECAD_USE_3DCONNEXION_RAWINPUT ON)
+ endif()
+
+ if(MSVC)
+ option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" ON)
+ option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF) # 3/5/2021 current LibPack uses non-C++17 FLANN
+ endif(MSVC)
if(NOT MSVC)
option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" OFF)
option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF)
endif(NOT MSVC)
- if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "NavLib" AND FREECAD_USE_3DCONNEXION)
- set(FREECAD_USE_3DCONNEXION_NAVLIB ON)
- set(FREECAD_USE_3DCONNEXION OFF)
- endif()
-
# if this is set override some options
if (FREECAD_BUILD_DEBIAN)
set(FREECAD_USE_EXTERNAL_ZIPIOS ON )
diff --git a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake
index fd5968eb86..4b8f83c2da 100644
--- a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake
+++ b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake
@@ -193,13 +193,19 @@ macro(PrintFinalReport)
simple(Coin3D "${COIN3D_VERSION} [${COIN3D_LIBRARIES}] [${COIN3D_INCLUDE_DIRS}]")
simple(pivy ${PIVY_VERSION})
if (WIN32)
- if (FREECAD_USE_3DCONNEXION)
- simple(3Dconnexion "Building 3Dconnexion support with original code")
+ if (FREECAD_USE_3DCONNEXION_RAWINPUT AND FREECAD_USE_3DCONNEXION_NAVLIB)
+ simple(3Dconnexion "Building 3Dconnexion support with raw input and NavLib")
+ elseif (FREECAD_USE_3DCONNEXION)
+ simple(3Dconnexion "Building 3Dconnexion support with raw input")
elseif(FREECAD_USE_3DCONNEXION_NAVLIB)
simple(3Dconnexion "Building 3Dconnexion support with NavLib")
else()
simple(3Dconnexion "Not building 3Dconnexion device support")
endif()
+ elseif(APPLE)
+ if (FREECAD_USE_3DCONNEXION)
+ simple(3Dconnexion "Building 3Dconnexion support with raw input")
+ endif()
else()
conditional(SPNAV SPNAV_FOUND "not found" "[${SPNAV_LIBRARY}] [${SPNAV_INCLUDE_DIR}]")
endif()
diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp
index c11004fdfa..80bf156e59 100644
--- a/src/Gui/Application.cpp
+++ b/src/Gui/Application.cpp
@@ -560,8 +560,15 @@ Application::Application(bool GUIenabled)
_pcWorkbenchDictionary = PyDict_New();
#ifdef USE_3DCONNEXION_NAVLIB
- // Instantiate the 3Dconnexion controller
- pNavlibInterface = new NavlibInterface();
+ ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath(
+ "User parameter:BaseApp/Preferences/View");
+ if (!hViewGrp->GetBool("LegacySpaceMouseDevices", false)) {
+ // Instantiate the 3Dconnexion controller
+ pNavlibInterface = new NavlibInterface();
+ }
+ else {
+ pNavlibInterface = nullptr;
+ }
#endif
if (GUIenabled) {
@@ -2295,7 +2302,9 @@ void Application::runApplication()
Gui::getMainWindow()->setProperty("eventLoop", true);
#ifdef USE_3DCONNEXION_NAVLIB
- Instance->pNavlibInterface->enableNavigation();
+ if (Instance->pNavlibInterface) {
+ Instance->pNavlibInterface->enableNavigation();
+ }
#endif
runEventLoop(mainApp);
diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt
index 902c59aa1f..3bf6f8d462 100644
--- a/src/Gui/CMakeLists.txt
+++ b/src/Gui/CMakeLists.txt
@@ -151,22 +151,28 @@ IF(SPNAV_FOUND)
SET(FreeCADGui_SDK_SRCS
3Dconnexion/GuiAbstractNativeEvent.cpp
3Dconnexion/GuiNativeEventLinuxX11.cpp
- )
+ )
SET(FreeCADGui_SDK_MOC_HDRS
3Dconnexion/GuiAbstractNativeEvent.h
3Dconnexion/GuiNativeEventLinuxX11.h
- )
+ )
else(SPNAV_USE_X11)
SET(FreeCADGui_SDK_SRCS
3Dconnexion/GuiAbstractNativeEvent.cpp
3Dconnexion/GuiNativeEventLinux.cpp
- )
+ )
SET(FreeCADGui_SDK_MOC_HDRS
3Dconnexion/GuiAbstractNativeEvent.h
3Dconnexion/GuiNativeEventLinux.h
- )
+ )
endif(SPNAV_USE_X11)
SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS})
+ list(APPEND FreeCADGui_connexion_SRCS
+ ${FreeCADGui_SDK_SRCS}
+ )
+ list(APPEND FreeCADGui_connexion_HDRS
+ ${FreeCADGui_SDK_MOC_HDRS}
+ )
add_definitions(-DSPNAV_FOUND)
include_directories(
@@ -270,30 +276,42 @@ SOURCE_GROUP("XML" FILES ${FreeCADApp_XML_SRCS})
# The 3D Connexion SDK files
if(FREECAD_USE_3DCONNEXION AND MSVC)
-SET(FreeCADGui_SDK_SRCS
- 3Dconnexion/I3dMouseParams.h
- 3Dconnexion/MouseParameters.cpp
- 3Dconnexion/MouseParameters.h
- 3Dconnexion/GuiAbstractNativeEvent.cpp
- 3Dconnexion/GuiNativeEventWin32.cpp
-)
-SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS})
-SET(FreeCADGui_SDK_MOC_HDRS
- 3Dconnexion/GuiAbstractNativeEvent.h
- 3Dconnexion/GuiNativeEventWin32.h
-)
+ SET(FreeCADGui_SDK_SRCS
+ 3Dconnexion/I3dMouseParams.h
+ 3Dconnexion/MouseParameters.cpp
+ 3Dconnexion/MouseParameters.h
+ 3Dconnexion/GuiAbstractNativeEvent.cpp
+ 3Dconnexion/GuiNativeEventWin32.cpp
+ )
+ SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS})
+ SET(FreeCADGui_SDK_MOC_HDRS
+ 3Dconnexion/GuiAbstractNativeEvent.h
+ 3Dconnexion/GuiNativeEventWin32.h
+ )
+ list(APPEND FreeCADGui_connexion_SRCS
+ ${FreeCADGui_SDK_SRCS}
+ )
+ list(APPEND FreeCADGui_connexion_HDRS
+ ${FreeCADGui_SDK_MOC_HDRS}
+ )
endif(FREECAD_USE_3DCONNEXION AND MSVC)
if(FREECAD_USE_3DCONNEXION AND APPLE)
-SET(FreeCADGui_SDK_SRCS
- 3Dconnexion/GuiAbstractNativeEvent.cpp
- 3Dconnexion/GuiNativeEventMac.cpp
-)
-SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS})
-SET(FreeCADGui_SDK_MOC_HDRS
- 3Dconnexion/GuiAbstractNativeEvent.h
- 3Dconnexion/GuiNativeEventMac.h
-)
+ SET(FreeCADGui_SDK_SRCS
+ 3Dconnexion/GuiAbstractNativeEvent.cpp
+ 3Dconnexion/GuiNativeEventMac.cpp
+ )
+ SOURCE_GROUP("3D connexion SDK" FILES ${FreeCADGui_SDK_SRCS})
+ SET(FreeCADGui_SDK_MOC_HDRS
+ 3Dconnexion/GuiAbstractNativeEvent.h
+ 3Dconnexion/GuiNativeEventMac.h
+ )
+ list(APPEND FreeCADGui_connexion_SRCS
+ ${FreeCADGui_SDK_SRCS}
+ )
+ list(APPEND FreeCADGui_connexion_HDRS
+ ${FreeCADGui_SDK_MOC_HDRS}
+ )
endif(FREECAD_USE_3DCONNEXION AND APPLE)
if(FREECAD_USE_3DCONNEXION_NAVLIB AND (MSVC OR APPLE))
@@ -306,9 +324,15 @@ if(FREECAD_USE_3DCONNEXION_NAVLIB AND (MSVC OR APPLE))
${NAVLIB_STUB_DIR}/navlib_stub.c
)
SOURCE_GROUP("3Dconnexion Navlib" FILES ${FreeCADGui_SDK_SRCS})
- SET(FreeCADGui_SDK_MOC_HDRS
+ SET(FreeCADGui_SDK_MOC_HDRS
3Dconnexion/navlib/NavlibInterface.h
- )
+ )
+ list(APPEND FreeCADGui_connexion_SRCS
+ ${FreeCADGui_SDK_SRCS}
+ )
+ list(APPEND FreeCADGui_connexion_HDRS
+ ${FreeCADGui_SDK_MOC_HDRS}
+ )
endif(FREECAD_USE_3DCONNEXION_NAVLIB AND (MSVC OR APPLE))
set_property(SOURCE GraphvizView.h GraphvizView.cpp PROPERTY SKIP_AUTOMOC ON)
@@ -390,9 +414,9 @@ SET(Gui_UIC_SRCS
VectorListEditor.ui
)
-if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Raw input")
- list(APPEND Gui_UIC_SRCS DlgCustomizeSpNavSettings.ui)
-endif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Raw input")
+if(FREECAD_USE_3DCONNEXION_RAWINPUT)
+ list(APPEND Gui_UIC_SRCS DlgCustomizeSpNavSettings.ui)
+endif(FREECAD_USE_3DCONNEXION_RAWINPUT)
set (FreeCAD_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Language/FreeCAD_translation.qrc)
qt_find_and_add_translation(QM_SRCS "Language/FreeCAD_*.ts"
@@ -581,10 +605,10 @@ SET(Dialog_Customize_HPP_SRCS
ListWidgetDragBugFix.h
)
-if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Raw input")
- list(APPEND Dialog_Customize_CPP_SRCS DlgCustomizeSpaceball.cpp DlgCustomizeSpNavSettings.cpp)
- list(APPEND Dialog_Customize_HPP_SRCS DlgCustomizeSpaceball.h DlgCustomizeSpNavSettings.h)
-endif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Raw input")
+if(FREECAD_USE_3DCONNEXION_RAWINPUT)
+ list(APPEND Dialog_Customize_CPP_SRCS DlgCustomizeSpaceball.cpp DlgCustomizeSpNavSettings.cpp)
+ list(APPEND Dialog_Customize_HPP_SRCS DlgCustomizeSpaceball.h DlgCustomizeSpNavSettings.h)
+endif(FREECAD_USE_3DCONNEXION_RAWINPUT)
SET(Dialog_Customize_SRCS
${Dialog_Customize_CPP_SRCS}
@@ -595,9 +619,9 @@ SET(Dialog_Customize_SRCS
DlgToolbars.ui
)
-if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Raw input")
- list(APPEND Dialog_Customize_SRCS DlgCustomizeSpNavSettings.ui)
-endif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Raw input")
+if(FREECAD_USE_3DCONNEXION_RAWINPUT)
+ list(APPEND Dialog_Customize_SRCS DlgCustomizeSpNavSettings.ui)
+endif(FREECAD_USE_3DCONNEXION_RAWINPUT)
SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS})
@@ -1297,11 +1321,11 @@ SET(FreeCADGui_SRCS
StartupProcess.h
TransactionObject.h
ToolHandler.h
- ${FreeCADGui_SDK_MOC_HDRS}
)
SET(FreeCADGui_SRCS
- ${FreeCADGui_SDK_SRCS}
+ ${FreeCADGui_connexion_SRCS}
+ ${FreeCADGui_connexion_HDRS}
${FreeCADGui_CPP_SRCS}
${FreeCADGui_XML_SRCS}
${qsint_MOC_SRCS}
diff --git a/src/Gui/PreferencePages/DlgSettingsNavigation.cpp b/src/Gui/PreferencePages/DlgSettingsNavigation.cpp
index e51b5b5594..1d71982431 100644
--- a/src/Gui/PreferencePages/DlgSettingsNavigation.cpp
+++ b/src/Gui/PreferencePages/DlgSettingsNavigation.cpp
@@ -60,6 +60,9 @@ DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent)
ui->naviCubeBaseColor->setAllowTransparency(true);
ui->rotationCenterColor->setAllowTransparency(true);
retranslate();
+#if !defined(_USE_3DCONNEXION_SDK) && !defined(SPNAV_FOUND)
+ ui->legacySpaceMouseDevices->setDisabled(true);
+#endif
}
/**
@@ -97,6 +100,10 @@ void DlgSettingsNavigation::saveSettings()
ui->prefCubeSize->onSave();
ui->naviCubeBaseColor->onSave();
ui->naviCubeInactiveOpacity->onSave();
+ ui->legacySpaceMouseDevices->onSave();
+ if (property("LegacySpaceMouse").toBool() != ui->legacySpaceMouseDevices->isChecked()) {
+ requireRestart();
+ }
bool showNaviCube = ui->groupBoxNaviCube->isChecked();
hGrp->SetBool("ShowNaviCube", showNaviCube);
@@ -143,6 +150,8 @@ void DlgSettingsNavigation::loadSettings()
ui->prefCubeSize->onRestore();
ui->naviCubeBaseColor->onRestore();
ui->naviCubeInactiveOpacity->onRestore();
+ ui->legacySpaceMouseDevices->onRestore();
+ setProperty("LegacySpaceMouse", ui->legacySpaceMouseDevices->isChecked());
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
diff --git a/src/Gui/PreferencePages/DlgSettingsNavigation.ui b/src/Gui/PreferencePages/DlgSettingsNavigation.ui
index afcd9db072..513bcfdce8 100644
--- a/src/Gui/PreferencePages/DlgSettingsNavigation.ui
+++ b/src/Gui/PreferencePages/DlgSettingsNavigation.ui
@@ -7,7 +7,7 @@
0
0
548
- 762
+ 795
@@ -255,7 +255,7 @@
Base color for all elements
-
+
226
232
@@ -335,7 +335,7 @@
The color of the rotation center indicator
-
+
255
0
@@ -572,7 +572,7 @@ Free Turntable: the part will be rotated around the z-axis.
-
-
+
Sets camera zoom for new documents.
The value is the diameter of the sphere to fit on the screen.
@@ -580,21 +580,21 @@ The value is the diameter of the sphere to fit on the screen.
mm
-
+
0.000010000000000
-
+
10000000.000000000000000
+
+ 100.000000000000000
+
NewDocumentCameraScale
View
-
- 100.000000000000000
-
-
@@ -721,6 +721,28 @@ Mouse tilting is not disabled by this setting.
+ -
+
+
+ Space mouse
+
+
+
-
+
+
+ Enable support of legacy space mouse devices
+
+
+ LegacySpaceMouseDevices
+
+
+ View
+
+
+
+
+
+
-
diff --git a/src/Gui/resource.cpp b/src/Gui/resource.cpp
index e7a1af48f7..41d6c35e3d 100644
--- a/src/Gui/resource.cpp
+++ b/src/Gui/resource.cpp
@@ -51,7 +51,7 @@
#include "DlgActionsImp.h"
#include "DlgKeyboardImp.h"
-#ifndef USE_3DCONNEXION_NAVLIB
+#if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND)
#include "DlgCustomizeSpaceball.h"
#include "DlgCustomizeSpNavSettings.h"
#endif
@@ -98,7 +98,7 @@ WidgetFactorySupplier::WidgetFactorySupplier()
new CustomPageProducer;
new CustomPageProducer;
new CustomPageProducer;
-#ifndef USE_3DCONNEXION_NAVLIB
+#if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND)
new CustomPageProducer;
new CustomPageProducer;
#endif