final (??) work on NDOF branch

it is now in a state where it can be safely
merged with trunk.

Note: basic icons were provided but I'm not
an icondesigner and working in a 16x15 grid
is way too small for me, so feel free to 
change them.
This commit is contained in:
2008-03-13 15:40:24 +00:00
parent 09bb791249
commit 526d0bec47
15 changed files with 16512 additions and 2172 deletions

View File

@@ -272,16 +272,13 @@ extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
/** /**
* Open N-degree of freedom devices * Open N-degree of freedom devices
*/ */
extern void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, extern int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle, GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
); );
// original patch only
// GHOST_NDOFEventHandler_fp setNdofEventHandler);
/*************************************************************************************** /***************************************************************************************
** Cursor management functionality ** Cursor management functionality
***************************************************************************************/ ***************************************************************************************/

View File

@@ -302,7 +302,7 @@ public:
/** /**
* Starts the N-degree of freedom device manager * Starts the N-degree of freedom device manager
*/ */
virtual void openNDOF(GHOST_IWindow*, virtual int openNDOF(GHOST_IWindow*,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen

View File

@@ -259,7 +259,7 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve
return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle); return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
} }
void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle, int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen) GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)

View File

@@ -57,19 +57,22 @@ GHOST_NDOFManager::~GHOST_NDOFManager()
} }
void int
GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window, GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen) GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
{ {
int Pid;
ndofLibraryInit = setNdofLibraryInit; ndofLibraryInit = setNdofLibraryInit;
ndofLibraryShutdown = setNdofLibraryShutdown; ndofLibraryShutdown = setNdofLibraryShutdown;
ndofDeviceOpen = setNdofDeviceOpen; ndofDeviceOpen = setNdofDeviceOpen;
if (ndofLibraryInit && ndofDeviceOpen) if (ndofLibraryInit && ndofDeviceOpen)
{ {
printf("%i client \n", ndofLibraryInit()); Pid= ndofLibraryInit();
printf("%i client \n", Pid);
#if defined(_WIN32) || defined(__APPLE__) #if defined(_WIN32) || defined(__APPLE__)
m_DeviceHandle = ndofDeviceOpen((void *)&currentNdofValues); m_DeviceHandle = ndofDeviceOpen((void *)&currentNdofValues);
#else #else
@@ -78,26 +81,13 @@ GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
void *ndofInfo = sys->prepareNdofInfo(&currentNdofValues); void *ndofInfo = sys->prepareNdofInfo(&currentNdofValues);
m_DeviceHandle = ndofDeviceOpen(ndofInfo); m_DeviceHandle = ndofDeviceOpen(ndofInfo);
#endif #endif
} return (Pid > 0) ? 0 : 1;
} else
return 1;
} }
/** original patch only */
/*
GHOST_TEventNDOFData*
GHOST_NDOFManager::handle(unsigned int message, unsigned int* wParam, unsigned long* lParam)
{
static GHOST_TEventNDOFData sbdata;
int handled = 0;
if (ndofEventHandler && m_DeviceHandle != 0)
{
handled = ndofEventHandler(&sbdata.tx, m_DeviceHandle, message, wParam, lParam);
}
printf("handled %i\n", handled);
return handled ? &sbdata : 0;
}
*/
bool bool
GHOST_NDOFManager::available() const GHOST_NDOFManager::available() const
{ {

View File

@@ -34,7 +34,7 @@ public:
GHOST_NDOFManager(); GHOST_NDOFManager();
virtual ~GHOST_NDOFManager(); virtual ~GHOST_NDOFManager();
void deviceOpen(GHOST_IWindow* window, int deviceOpen(GHOST_IWindow* window,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen); GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);

View File

@@ -240,18 +240,15 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
return success; return success;
} }
void GHOST_System::openNDOF(GHOST_IWindow* w, int GHOST_System::openNDOF(GHOST_IWindow* w,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen) GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
// original patch only
// GHOST_NDOFEventHandler_fp setNdofEventHandler)
{ {
m_ndofManager->deviceOpen(w, return m_ndofManager->deviceOpen(w,
setNdofLibraryInit, setNdofLibraryInit,
setNdofLibraryShutdown, setNdofLibraryShutdown,
setNdofDeviceOpen); setNdofDeviceOpen);
// setNdofEventHandler);
} }

View File

@@ -193,8 +193,9 @@ public:
/** Inherited from GHOST_ISystem /** Inherited from GHOST_ISystem
* Opens the N-degree of freedom device manager * Opens the N-degree of freedom device manager
* return 0 if device found, 1 otherwise
*/ */
virtual void openNDOF(GHOST_IWindow* w, virtual int openNDOF(GHOST_IWindow* w,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen); GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -145,6 +145,9 @@ typedef struct Global {
int compat; /* toggle compatibility mode for edge rendering */ int compat; /* toggle compatibility mode for edge rendering */
int notonlysolid;/* T-> also edge-render transparent faces */ int notonlysolid;/* T-> also edge-render transparent faces */
/* ndof device found ? */
int ndofdevice;
/* confusing... G.f and G.flags */ /* confusing... G.f and G.flags */
int flags; int flags;

View File

@@ -58,10 +58,10 @@ typedef enum {
ICON_SPACE4, ICON_SPACE4,
ICON_TRIA_LEFT, ICON_TRIA_LEFT,
ICON_TRIA_UP, ICON_TRIA_UP,
ICON_BLANK3, ICON_NDOF_TURN,
ICON_BLANK4, ICON_NDOF_FLY,
ICON_BLANK5, ICON_NDOF_TRANS,
ICON_BLANK6, ICON_NDOF_DOM,
ICON_ORTHO, ICON_ORTHO,
ICON_PERSP, ICON_PERSP,

View File

@@ -232,6 +232,7 @@
#define B_MAN_SCALE 163 #define B_MAN_SCALE 163
#define B_HEMESHBROWSE 164 #define B_HEMESHBROWSE 164
#define B_HEMESHLOCAL 165 #define B_HEMESHLOCAL 165
#define B_NDOF 166
/* IPO: 200 */ /* IPO: 200 */
#define B_IPOHOME 201 #define B_IPOHOME 201

View File

@@ -139,7 +139,7 @@ typedef struct View3D {
short snap_target; short snap_target;
char ndofmode; /* mode of transform for 6DOF devices 0 normal, 1 fly, 2 ob transform */ char ndofmode; /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */
char ndoffilter; /*filter for 6DOF devices 0 normal, 1 dominant */ char ndoffilter; /*filter for 6DOF devices 0 normal, 1 dominant */
void *properties_storage; /* Nkey panel stores stuff here, not in file */ void *properties_storage; /* Nkey panel stores stuff here, not in file */

File diff suppressed because it is too large Load Diff

View File

@@ -935,12 +935,14 @@ void window_open_ndof(Window* win)
MEM_freeN(plug_path); MEM_freeN(plug_path);
if (ndofLib) { if (ndofLib) {
GHOST_OpenNDOF(g_system, win->ghostwin, G.ndofdevice = 0 - GHOST_OpenNDOF(g_system, win->ghostwin,
PIL_dynlib_find_symbol(ndofLib, "ndofInit"), PIL_dynlib_find_symbol(ndofLib, "ndofInit"),
PIL_dynlib_find_symbol(ndofLib, "ndofShutdown"), PIL_dynlib_find_symbol(ndofLib, "ndofShutdown"),
PIL_dynlib_find_symbol(ndofLib, "ndofOpen")); PIL_dynlib_find_symbol(ndofLib, "ndofOpen"));
} }
else { else {
GHOST_OpenNDOF(g_system, win->ghostwin, 0, 0, 0); GHOST_OpenNDOF(g_system, win->ghostwin, 0, 0, 0);
G.ndofdevice = -1;
} }
} }

View File

@@ -4631,6 +4631,19 @@ static char *around_pup(void)
return string; return string;
} }
static char *ndof_pup(void)
{
static char string[512];
char *str = string;
str += sprintf(str, "%s", "ndof mode: %t");
str += sprintf(str, "%s", "|turntable %x0");
str += sprintf(str, "%s", "|fly %x1");
str += sprintf(str, "%s", "|transform %x2");
return string;
}
static char *propfalloff_pup(void) static char *propfalloff_pup(void)
{ {
static char string[512]; static char string[512];
@@ -4879,6 +4892,9 @@ void do_view3d_buttons(short event)
G.vd->twtype= V3D_MANIP_SCALE; G.vd->twtype= V3D_MANIP_SCALE;
allqueue(REDRAWVIEW3D, 1); allqueue(REDRAWVIEW3D, 1);
break; break;
case B_NDOF:
allqueue(REDRAWVIEW3D, 1);
break;
default: default:
@@ -5158,10 +5174,49 @@ void view3d_buttons(void)
uiDefIconButBitS(block, TOG, V3D_ALIGN, B_AROUND, ICON_ALIGN, uiDefIconButBitS(block, TOG, V3D_ALIGN, B_AROUND, ICON_ALIGN,
xco,0,XIC,YIC, xco,0,XIC,YIC,
&G.vd->flag, 0, 0, 0, 0, "Move object centers only"); &G.vd->flag, 0, 0, 0, 0, "Move object centers only");
xco+= XIC+8;
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
/* NDOF */
if (G.ndofdevice ==0 ) {
uiDefIconTextButC(block, ICONTEXTROW,B_NDOF, ICON_NDOF_TURN, ndof_pup(), xco,0,XIC+10,YIC, &(G.vd->ndofmode), 0, 3.0, 0, 0, "Ndof mode");
xco+= XIC+10;
uiDefIconButC(block, TOG, B_NDOF, ICON_NDOF_DOM,
xco,0,XIC,YIC,
&G.vd->ndoffilter, 0, 1, 0, 0, "dominant axis");
uiBlockEndAlign(block); uiBlockEndAlign(block);
xco+= XIC+8; xco+= XIC+8;
}
uiBlockEndAlign(block);
/*{
char tempstring[256];
switch (G.vd->ndofmode) {
case 0:
sprintf(tempstring,"6dof : %s %s", "turntable",((G.vd->ndoffilter==1) ? "dominant" : ""));
break;
case 1:
sprintf(tempstring,"6dof : %s %s", "fly",((G.vd->ndoffilter==1) ? "dominant" : ""));
break;
case 2:
sprintf(tempstring,"6dof : %s %s", "transform",((G.vd->ndoffilter==1) ? "dominant" : ""));
break;
default:
tempstring[0]=0;
break;
}
uiDefBut(block, LABEL,0,tempstring,
xco+=XIC*2,0,150,YIC, 0, 1.0, 0, 0, 0,
"");
}
*/
/* Transform widget / manipulators */ /* Transform widget / manipulators */
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefIconButBitS(block, TOG, V3D_USE_MANIPULATOR, B_REDR, ICON_MANIPUL,xco,0,XIC,YIC, &G.vd->twflag, 0, 0, 0, 0, "Use 3d transform manipulator (Ctrl Space)"); uiDefIconButBitS(block, TOG, V3D_USE_MANIPULATOR, B_REDR, ICON_MANIPUL,xco,0,XIC,YIC, &G.vd->twflag, 0, 0, 0, 0, "Use 3d transform manipulator (Ctrl Space)");
@@ -5259,27 +5314,7 @@ void view3d_buttons(void)
uiDefIconBut(block, BUT, B_VIEWRENDER, ICON_SCENE_DEHLT, xco,0,XIC,YIC, NULL, 0, 1.0, 0, 0, "Render this window (hold CTRL for anim)"); uiDefIconBut(block, BUT, B_VIEWRENDER, ICON_SCENE_DEHLT, xco,0,XIC,YIC, NULL, 0, 1.0, 0, 0, "Render this window (hold CTRL for anim)");
{
char tempstring[256];
switch (G.vd->ndofmode) {
case 0:
sprintf(tempstring,"6dof : %s %s", "turntable",((G.vd->ndoffilter==1) ? "dominant" : ""));
break;
case 1:
sprintf(tempstring,"6dof : %s %s", "fly",((G.vd->ndoffilter==1) ? "dominant" : ""));
break;
case 2:
sprintf(tempstring,"6dof : %s %s", "transform",((G.vd->ndoffilter==1) ? "dominant" : ""));
break;
default:
tempstring[0]=0;
break;
}
uiDefBut(block, LABEL,0,tempstring,
xco+=XIC*2,0,150,YIC, 0, 1.0, 0, 0, 0,
"");
}
if (ob && (ob->flag & OB_POSEMODE)) { if (ob && (ob->flag & OB_POSEMODE)) {
xco+= XIC/2; xco+= XIC/2;
uiBlockBeginAlign(block); uiBlockBeginAlign(block);