NDOF related edits
authorCampbell Barton <ideasman42@gmail.com>
Tue, 2 Aug 2011 05:52:27 +0000 (05:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 2 Aug 2011 05:52:27 +0000 (05:52 +0000)
- fix for building without NDOF on X11
- quiet some warnings

CMakeLists.txt
build_files/cmake/macros.cmake
intern/ghost/CMakeLists.txt
intern/ghost/SConscript
intern/ghost/intern/GHOST_System.cpp
intern/ghost/intern/GHOST_SystemX11.cpp
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/windowmanager/intern/wm_operators.c

index 2ac6d67..fe86aaf 100644 (file)
@@ -179,7 +179,7 @@ option(WITH_LZO           "Enable fast LZO compression (used for pointcache)" ON
 option(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)" ON)
 
 # Misc
-option(WITH_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
+option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
 option(WITH_RAYOPTIMIZATION    "Enable use of SIMD (SSE) optimizations for the raytracer" ON) 
 if(UNIX AND NOT APPLE)
        option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
@@ -453,7 +453,7 @@ if(UNIX AND NOT APPLE)
                endif()
        endif()
 
-       if (WITH_NDOF)
+       if (WITH_INPUT_NDOF)
                if(CMAKE_SYSTEM_NAME MATCHES "Linux")
                        set(NDOF /usr)
                        set(NDOF_INC ${NDOF}/include)
@@ -1039,7 +1039,7 @@ elseif(APPLE)
                set(TIFF_LIBPATH ${TIFF}/lib)
        endif()
 
-       if (WITH_NDOF)
+       if (WITH_INPUT_NDOF)
                # linker needs "-weak_framework 3DconnexionClient"
        endif()
 
index 3de9db6..c53f52b 100644 (file)
@@ -193,7 +193,7 @@ macro(SETUP_LIBDIRS)
        if(WITH_MEM_JEMALLOC)
                link_directories(${JEMALLOC_LIBPATH})
        endif()
-       if(WITH_NDOF)
+       if(WITH_INPUT_NDOF)
                link_directories(${NDOF_LIBPATH})
        endif()
 
@@ -317,7 +317,7 @@ macro(setup_liblinks
        if(WITH_MEM_JEMALLOC)
                target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
        endif()
-       if(WITH_NDOF)
+       if(WITH_INPUT_NDOF)
                target_link_libraries(${target} ${NDOF_LIBRARY})
        endif()
 
index b69dff6..86829c8 100644 (file)
@@ -97,6 +97,9 @@ if(WITH_GHOST_DEBUG)
        add_definitions(-DWITH_GHOST_DEBUG)
 endif()
 
+if(WITH_INPUT_NDOF)
+       add_definitions(-DWITH_INPUT_NDOF)
+endif()
 
 if(WITH_HEADLESS OR WITH_GHOST_SDL)
        if(WITH_HEADLESS)
@@ -158,14 +161,21 @@ elseif(APPLE)
                        intern/GHOST_SystemCocoa.mm
                        intern/GHOST_SystemPathsCocoa.mm
                        intern/GHOST_WindowCocoa.mm
-                       intern/GHOST_NDOFManagerCocoa.mm
 
                        intern/GHOST_DisplayManagerCocoa.h
                        intern/GHOST_SystemCocoa.h
                        intern/GHOST_SystemPathsCocoa.h
                        intern/GHOST_WindowCocoa.h
-                       intern/GHOST_NDOFManagerCocoa.h
                )
+
+               if(WITH_INPUT_NDOF)
+                       list(APPEND SRC
+                               intern/GHOST_NDOFManagerCocoa.mm
+
+                               intern/GHOST_NDOFManagerCocoa.h
+                       )
+               endif()
+
        else()
                list(APPEND SRC
                        intern/GHOST_DisplayManagerCarbon.cpp
@@ -199,13 +209,11 @@ elseif(UNIX)
                intern/GHOST_SystemX11.cpp
                intern/GHOST_SystemPathsX11.cpp
                intern/GHOST_WindowX11.cpp
-               intern/GHOST_NDOFManagerX11.cpp
 
                intern/GHOST_DisplayManagerX11.h
                intern/GHOST_SystemX11.h
                intern/GHOST_SystemPathsX11.h
                intern/GHOST_WindowX11.h
-               intern/GHOST_NDOFManagerX11.h
        )
 
        if(NOT WITH_INSTALL_PORTABLE)
@@ -219,6 +227,14 @@ elseif(UNIX)
                )
        endif()
 
+       if(WITH_INPUT_NDOF)
+               list(APPEND SRC
+                       intern/GHOST_NDOFManagerX11.cpp
+
+                       intern/GHOST_NDOFManagerX11.h
+               )
+       endif()
+
 elseif(WIN32)
        if(MSVC)
                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
@@ -234,7 +250,6 @@ elseif(WIN32)
                intern/GHOST_SystemPathsWin32.cpp
                intern/GHOST_WindowWin32.cpp
                intern/GHOST_DropTargetWin32.cpp
-               intern/GHOST_NDOFManagerWin32.cpp
 
                intern/GHOST_DisplayManagerWin32.h
                intern/GHOST_DropTargetWin32.h
@@ -242,8 +257,16 @@ elseif(WIN32)
                intern/GHOST_SystemPathsWin32.h
                intern/GHOST_WindowWin32.h
                intern/GHOST_TaskbarWin32.h
-               intern/GHOST_NDOFManagerWin32.h
        )
+
+       if(WITH_INPUT_NDOF)
+               list(APPEND SRC
+                       intern/GHOST_NDOFManagerWin32.cpp
+
+                       intern/GHOST_NDOFManagerWin32.h
+               )
+       endif()
+
 endif()
 
 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")
index 3dec748..d65eb0c 100644 (file)
@@ -78,6 +78,9 @@ if env['BF_GHOST_DEBUG']:
 else:
        sources.remove('intern' + os.sep + 'GHOST_EventPrinter.cpp')
 
+if env['WITH_BF_3DMOUSE']:
+       defs.append('WITH_INPUT_NDOF')
+
 if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
     incs = env['BF_WINTAB_INC'] + ' ' + incs
 
index 792adba..f601031 100644 (file)
 
 
 GHOST_System::GHOST_System()
-: m_displayManager(0), m_timerManager(0), m_windowManager(0), m_eventManager(0), m_ndofManager(0)
+    : m_displayManager(0),
+      m_timerManager(0),
+      m_windowManager(0),
+      m_eventManager(0)
+#ifdef WITH_INPUT_NDOF
+      , m_ndofManager(0)
+#endif
 {
 }
 
index 517c3a1..105f71b 100644 (file)
@@ -167,7 +167,9 @@ init(
        GHOST_TSuccess success = GHOST_System::init();
 
        if (success) {
+#ifdef WITH_INPUT_NDOF
                m_ndofManager = new GHOST_NDOFManagerX11(*this);
+#endif
                m_displayManager = new GHOST_DisplayManagerX11(this);
 
                if (m_displayManager) {
@@ -414,9 +416,11 @@ processEvents(
                        anyProcessed = true;
                }
 
+#ifdef WITH_INPUT_NDOF
                if (dynamic_cast<GHOST_NDOFManagerX11*>(m_ndofManager)->processEvents()) {
                        anyProcessed = true;
                }
+#endif
                
        } while (waitForEvent && !anyProcessed);
        
index 204d5df..a7c90bb 100644 (file)
@@ -445,7 +445,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
  * that explains the negative signs in the code below
  */
 
-static int view_ndof_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        SpaceImage *sima= CTX_wm_space_image(C);
        ARegion *ar= CTX_wm_region(C);
index 9422469..09e703d 100644 (file)
@@ -968,7 +968,7 @@ void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4])
        q[3] = scale * z;
        }
 
-static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 // -- "orbit" navigation (trackball/turntable)
 // -- zooming
 // -- panning in rotationally-locked views
@@ -1118,7 +1118,7 @@ void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot)
        ot->flag = 0;
 }
 
-static int ndof_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 // -- "pan" navigation
 // -- zoom or dolly?
 {
index d813fd9..d9c3300 100644 (file)
@@ -1411,7 +1411,7 @@ static void WM_OT_search_menu(wmOperatorType *ot)
        ot->poll= wm_search_menu_poll;
 }
 
-static int wm_ndof_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int wm_ndof_menu_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
 {
        uiPupMenuInvoke(C,"VIEW3D_MT_ndof_settings");