[Bf-blender-cvs] [b10d005] master: NDOF: compile 3D mouse code only if WITH_INPUT_NDOF

Mike Erwin noreply at git.blender.org
Thu Aug 18 06:41:27 CEST 2016


Commit: b10d0058d72da3051895481ae5830a7b668b7d80
Author: Mike Erwin
Date:   Thu Aug 18 00:21:55 2016 -0400
Branches: master
https://developer.blender.org/rBb10d0058d72da3051895481ae5830a7b668b7d80

NDOF: compile 3D mouse code only if WITH_INPUT_NDOF

When WITH_INPUT_NDOF is disabled, 3D mouse handling code is removed
from:

- GHOST (was mostly done, finished the job)
- window manager
- various editors
- RNA
- keymaps

The input tab of user prefs does not show 3D mouse settings. Key map
editor does not show NDOF mappings.

DNA does not change.

On my Mac the compiled binary is 42KB smaller after this change. It
runs fine WITH_INPUT_NDOF on or off.

===================================================================

M	intern/ghost/GHOST_C-api.h
M	intern/ghost/GHOST_ISystem.h
M	intern/ghost/GHOST_Types.h
M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_EventNDOF.h
M	intern/ghost/intern/GHOST_NDOFManager.h
M	intern/ghost/intern/GHOST_NDOFManagerCocoa.h
M	intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
M	intern/ghost/intern/GHOST_NDOFManagerUnix.h
M	intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
M	intern/ghost/intern/GHOST_NDOFManagerWin32.h
M	intern/ghost/intern/GHOST_System.cpp
M	intern/ghost/intern/GHOST_System.h
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/editors/CMakeLists.txt
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/view2d_ops.c
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/blender/editors/space_action/action_ops.c
M	source/blender/editors/space_clip/clip_intern.h
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/editors/space_graph/graph_ops.c
M	source/blender/editors/space_image/image_intern.h
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/space_logic/space_logic.c
M	source/blender/editors/space_nla/nla_ops.c
M	source/blender/editors/space_node/node_ops.c
M	source/blender/editors/space_sequencer/sequencer_ops.c
M	source/blender/editors/space_time/time_ops.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_intern.h
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/editors/space_view3d/view3d_walk.c
M	source/blender/editors/transform/transform_ops.c
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/makesrna/intern/rna_wm.c
M	source/blender/windowmanager/CMakeLists.txt
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/wm_event_types.h

===================================================================

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index f1484a2..ff1922a 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -433,6 +433,7 @@ extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
                                            GHOST_TButtonMask mask,
                                            int *isDown);
 
+#ifdef WITH_INPUT_NDOF
 /***************************************************************************************
  * Access to 3D mouse.
  ***************************************************************************************/
@@ -442,6 +443,7 @@ extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
  * \param deadzone Deadzone of the 3D mouse (both for rotation and pan) relative to full range
  */
 extern void GHOST_setNDOFDeadZone(float deadzone);
+#endif
 
 
 /***************************************************************************************
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 08045b9..03193d6 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -377,11 +377,13 @@ public:
 	 */
 	virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
 
+#ifdef WITH_INPUT_NDOF
 	/**
 	 * Sets 3D mouse deadzone
 	 * \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range
 	 */
 	virtual void setNDOFDeadZone(float deadzone) = 0;
+#endif
 
 	/**
 	 * Toggles console
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 0dd5d15..9ee4599 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -172,8 +172,10 @@ typedef enum {
 	GHOST_kEventWheel,          /// Mouse wheel event
 	GHOST_kEventTrackpad,       /// Trackpad event
 
+#ifdef WITH_INPUT_NDOF
 	GHOST_kEventNDOFMotion,     /// N degree of freedom device motion event
 	GHOST_kEventNDOFButton,     /// N degree of freedom device button event
+#endif
 
 	GHOST_kEventKeyDown,
 	GHOST_kEventKeyUp,
@@ -478,6 +480,7 @@ typedef enum {
 	GHOST_kFinished
 } GHOST_TProgress;
 
+#ifdef WITH_INPUT_NDOF
 typedef struct {
 	/** N-degree of freedom device data v3 [GSoC 2010] */
 	// Each component normally ranges from -1 to +1, but can exceed that.
@@ -497,6 +500,7 @@ typedef struct {
 	GHOST_TButtonAction action;
 	short button;
 } GHOST_TEventNDOFButtonData;
+#endif // WITH_INPUT_NDOF
 
 typedef struct {
 	/** The key code. */
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index ccd7f57..41bc735 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -406,12 +406,13 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
 }
 
 
+#ifdef WITH_INPUT_NDOF
 void GHOST_setNDOFDeadZone(float deadzone)
 {
 	GHOST_ISystem *system = GHOST_ISystem::getSystem();
 	system->setNDOFDeadZone(deadzone);
 }
-
+#endif
 
 void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
 {
diff --git a/intern/ghost/intern/GHOST_EventNDOF.h b/intern/ghost/intern/GHOST_EventNDOF.h
index b403789..754e109 100644
--- a/intern/ghost/intern/GHOST_EventNDOF.h
+++ b/intern/ghost/intern/GHOST_EventNDOF.h
@@ -22,9 +22,12 @@
 
 /** \file ghost/intern/GHOST_EventNDOF.h
  *  \ingroup GHOST
- * Declaration of GHOST_EventManager class.
  */
 
+#ifndef WITH_INPUT_NDOF
+#  error NDOF code included in non-NDOF-enabled build
+#endif
+
 #ifndef __GHOST_EVENTNDOF_H__
 #define __GHOST_EVENTNDOF_H__
 
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index d3c70bb..83d06ef 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -21,6 +21,10 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+#ifndef WITH_INPUT_NDOF
+#  error NDOF code included in non-NDOF-enabled build
+#endif
+
 #ifndef __GHOST_NDOFMANAGER_H__
 #define __GHOST_NDOFMANAGER_H__
 
diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
index 464ba48..3f1bfcf 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
@@ -24,8 +24,6 @@
 #ifndef __GHOST_NDOFMANAGERCOCOA_H__
 #define __GHOST_NDOFMANAGERCOCOA_H__
 
-#ifdef WITH_INPUT_NDOF
-
 #include "GHOST_NDOFManager.h"
 
 // Event capture is handled within the NDOF manager on Macintosh,
@@ -40,6 +38,4 @@ public:
 	bool available();
 };
 
-
-#endif // WITH_INPUT_NDOF
 #endif // #include guard
diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
index 8fea2a0..ded13b5 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
@@ -21,8 +21,6 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifdef WITH_INPUT_NDOF
-
 #include "GHOST_NDOFManagerUnix.h"
 #include "GHOST_System.h"
 
@@ -144,5 +142,3 @@ bool GHOST_NDOFManagerUnix::processEvents()
 
 	return anyProcessed;
 }
-
-#endif /* WITH_INPUT_NDOF */
diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.h b/intern/ghost/intern/GHOST_NDOFManagerUnix.h
index 278a8cb..3fd171d 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerUnix.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.h
@@ -24,8 +24,6 @@
 #ifndef __GHOST_NDOFMANAGERUNIX_H__
 #define __GHOST_NDOFMANAGERUNIX_H__
 
-#ifdef WITH_INPUT_NDOF
-
 #include "GHOST_NDOFManager.h"
 
 /* Event capture is handled within the NDOF manager on Linux,
@@ -43,5 +41,4 @@ private:
 	bool m_available;
 };
 
-#endif  /* WITH_INPUT_NDOF */
 #endif  /* __GHOST_NDOFMANAGERUNIX_H__ */
diff --git a/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp b/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
index 7ccd2e6..0023ee7 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
@@ -22,8 +22,6 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifdef WITH_INPUT_NDOF // use contents of this file
-
 #include "GHOST_NDOFManagerWin32.h"
 
 
@@ -40,5 +38,3 @@ bool GHOST_NDOFManagerWin32::available()
 	// always available since RawInput is built into Windows
 	return true;
 }
-
-#endif // WITH_INPUT_NDOF
diff --git a/intern/ghost/intern/GHOST_NDOFManagerWin32.h b/intern/ghost/intern/GHOST_NDOFManagerWin32.h
index 9b51928..2f7bc9e 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerWin32.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerWin32.h
@@ -25,8 +25,6 @@
 #ifndef __GHOST_NDOFMANAGERWIN32_H__
 #define __GHOST_NDOFMANAGERWIN32_H__
 
-#ifdef WITH_INPUT_NDOF
-
 #include "GHOST_NDOFManager.h"
 
 
@@ -37,6 +35,4 @@ public:
 	bool available();
 };
 
-
-#endif // WITH_INPUT_NDOF
 #endif // #include guard
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index c535808..56d68b9 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -38,11 +38,13 @@
 
 #include "GHOST_DisplayManager.h"
 #include "GHOST_EventManager.h"
-#include "GHOST_NDOFManager.h"
 #include "GHOST_TimerTask.h"
 #include "GHOST_TimerManager.h"
 #include "GHOST_WindowManager.h"
 
+#ifdef WITH_INPUT_NDOF
+#  include "GHOST_NDOFManager.h"
+#endif
 
 GHOST_System::GHOST_System()
     : m_nativePixel(false),
@@ -292,14 +294,12 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool& isDown
 	return success;
 }
 
+#ifdef WITH_INPUT_NDOF
 void GHOST_System::setNDOFDeadZone(float deadzone)
 {
-#ifdef WITH_INPUT_NDOF
 	this->m_ndofManager->setDeadZone(deadzone);
-#else
-	(void)deadzone;
-#endif
 }
+#endif
 
 GHOST_TSuccess GHOST_System::init()
 {
@@ -345,6 +345,7 @@ GHOST_TSuccess GHOST_System::exit()
 	delete m_ndofManager;
 	m_ndofManager = NULL;
 #endif
+
 	return GHOST_kSuccess;
 }
 
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index a10259b..af08399 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -48,7 +48,9 @@ class GHOST_Event;
 class GHOST_TimerManager;
 class GHOST_Window;
 class GHOST_WindowManager;
+#ifdef WITH_INPUT_NDOF
 class GHOST_NDOFManager;
+#endif
 
 /**
  * Implementation of platform independent functionality of the GHOST_ISystem
@@ -236,6 +238,7 @@ public:
 	 */
 	GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
 	
+#ifdef WITH_INPUT_NDOF
 	/***************************************************************************************
 	 * Access to 3D mouse.
 	 ***************************************************************************************/
@@ -245,6 +248,7 @@ public:
 	 * \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range
 	 */
 	void setNDOFDeadZone(float deadzone);
+#endif
 
 	/***************************************************************************************
 	 * Other (internal) functionality.
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 1ce8002..f884b0f 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -57,7 +57,7 @@
 #include "GHOST_WindowWin32.h"
 
 #ifdef WITH_INPUT_NDOF
-#include "GHOST_NDOFManagerWin32.h"
+  #include "GHOST_NDOFManagerWin32.h"
 #endif
 
 // Key code values not found in winuser.h
@@ -125,9 +125,9 @@
 static void initRawInput()
 {
 #ifdef WITH_INPUT_NDOF
-#define DEVICE_COUNT 2
+  #define DEVICE_COUNT 2
 #else
-#define DEVICE_COUNT 1
+  #define DEVICE_COUNT 1
 #endif
 
 	RAWINPUTDEVICE devices[DEVICE_COUNT];
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 1512f4f..dcafac6 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1177,15 +1177,16 @@ class USERPREF_PT_input(Panel):
             sub.prop(walk, "view_height")
             sub.prop(walk, "jump_height")
 
-        col.separator()
-        col.label(text="NDOF Device:")
-        sub = col.column(align=True)
-        sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
-        sub.prop(inputs, "ndof_orbit_sensitivity", text="NDOF Orbit Sensitivity")
-        sub.prop(inputs, "ndof_deadzone"

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list