forked from bartvdbraak/blender
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:
parent
09bb791249
commit
526d0bec47
@ -272,15 +272,12 @@ extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
|
||||
/**
|
||||
* Open N-degree of freedom devices
|
||||
*/
|
||||
extern void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle,
|
||||
extern int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle,
|
||||
GHOST_WindowHandle windowhandle,
|
||||
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
|
||||
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
|
||||
);
|
||||
|
||||
// original patch only
|
||||
// GHOST_NDOFEventHandler_fp setNdofEventHandler);
|
||||
|
||||
/***************************************************************************************
|
||||
** Cursor management functionality
|
||||
|
@ -302,7 +302,7 @@ public:
|
||||
/**
|
||||
* Starts the N-degree of freedom device manager
|
||||
*/
|
||||
virtual void openNDOF(GHOST_IWindow*,
|
||||
virtual int openNDOF(GHOST_IWindow*,
|
||||
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
|
||||
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
|
||||
|
@ -259,7 +259,7 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve
|
||||
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_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
|
||||
|
@ -57,19 +57,22 @@ GHOST_NDOFManager::~GHOST_NDOFManager()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
int
|
||||
GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
|
||||
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
|
||||
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
|
||||
{
|
||||
int Pid;
|
||||
|
||||
ndofLibraryInit = setNdofLibraryInit;
|
||||
ndofLibraryShutdown = setNdofLibraryShutdown;
|
||||
ndofDeviceOpen = setNdofDeviceOpen;
|
||||
|
||||
if (ndofLibraryInit && ndofDeviceOpen)
|
||||
{
|
||||
printf("%i client \n", ndofLibraryInit());
|
||||
Pid= ndofLibraryInit();
|
||||
printf("%i client \n", Pid);
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
m_DeviceHandle = ndofDeviceOpen((void *)¤tNdofValues);
|
||||
#else
|
||||
@ -78,26 +81,13 @@ GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
|
||||
void *ndofInfo = sys->prepareNdofInfo(¤tNdofValues);
|
||||
m_DeviceHandle = ndofDeviceOpen(ndofInfo);
|
||||
#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
|
||||
GHOST_NDOFManager::available() const
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
GHOST_NDOFManager();
|
||||
virtual ~GHOST_NDOFManager();
|
||||
|
||||
void deviceOpen(GHOST_IWindow* window,
|
||||
int deviceOpen(GHOST_IWindow* window,
|
||||
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
|
||||
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);
|
||||
|
@ -240,18 +240,15 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
|
||||
return success;
|
||||
}
|
||||
|
||||
void GHOST_System::openNDOF(GHOST_IWindow* w,
|
||||
int GHOST_System::openNDOF(GHOST_IWindow* w,
|
||||
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
|
||||
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
|
||||
// original patch only
|
||||
// GHOST_NDOFEventHandler_fp setNdofEventHandler)
|
||||
{
|
||||
m_ndofManager->deviceOpen(w,
|
||||
return m_ndofManager->deviceOpen(w,
|
||||
setNdofLibraryInit,
|
||||
setNdofLibraryShutdown,
|
||||
setNdofDeviceOpen);
|
||||
// setNdofEventHandler);
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,8 +193,9 @@ public:
|
||||
|
||||
/** Inherited from GHOST_ISystem
|
||||
* 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_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
|
||||
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 65 KiB |
@ -145,6 +145,9 @@ typedef struct Global {
|
||||
int compat; /* toggle compatibility mode for edge rendering */
|
||||
int notonlysolid;/* T-> also edge-render transparent faces */
|
||||
|
||||
/* ndof device found ? */
|
||||
int ndofdevice;
|
||||
|
||||
/* confusing... G.f and G.flags */
|
||||
int flags;
|
||||
|
||||
|
@ -58,10 +58,10 @@ typedef enum {
|
||||
ICON_SPACE4,
|
||||
ICON_TRIA_LEFT,
|
||||
ICON_TRIA_UP,
|
||||
ICON_BLANK3,
|
||||
ICON_BLANK4,
|
||||
ICON_BLANK5,
|
||||
ICON_BLANK6,
|
||||
ICON_NDOF_TURN,
|
||||
ICON_NDOF_FLY,
|
||||
ICON_NDOF_TRANS,
|
||||
ICON_NDOF_DOM,
|
||||
|
||||
ICON_ORTHO,
|
||||
ICON_PERSP,
|
||||
|
@ -232,6 +232,7 @@
|
||||
#define B_MAN_SCALE 163
|
||||
#define B_HEMESHBROWSE 164
|
||||
#define B_HEMESHLOCAL 165
|
||||
#define B_NDOF 166
|
||||
|
||||
/* IPO: 200 */
|
||||
#define B_IPOHOME 201
|
||||
|
@ -139,7 +139,7 @@ typedef struct View3D {
|
||||
|
||||
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 */
|
||||
|
||||
void *properties_storage; /* Nkey panel stores stuff here, not in file */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -935,12 +935,14 @@ void window_open_ndof(Window* win)
|
||||
MEM_freeN(plug_path);
|
||||
|
||||
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, "ndofShutdown"),
|
||||
PIL_dynlib_find_symbol(ndofLib, "ndofOpen"));
|
||||
|
||||
}
|
||||
else {
|
||||
GHOST_OpenNDOF(g_system, win->ghostwin, 0, 0, 0);
|
||||
G.ndofdevice = -1;
|
||||
}
|
||||
}
|
||||
|
@ -4631,6 +4631,19 @@ static char *around_pup(void)
|
||||
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 string[512];
|
||||
@ -4879,7 +4892,10 @@ void do_view3d_buttons(short event)
|
||||
G.vd->twtype= V3D_MANIP_SCALE;
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
break;
|
||||
|
||||
case B_NDOF:
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if(event>=B_LAY && event<B_LAY+31) {
|
||||
@ -5158,10 +5174,49 @@ void view3d_buttons(void)
|
||||
uiDefIconButBitS(block, TOG, V3D_ALIGN, B_AROUND, ICON_ALIGN,
|
||||
xco,0,XIC,YIC,
|
||||
&G.vd->flag, 0, 0, 0, 0, "Move object centers only");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
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);
|
||||
|
||||
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 */
|
||||
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)");
|
||||
@ -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)");
|
||||
|
||||
{
|
||||
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)) {
|
||||
xco+= XIC/2;
|
||||
uiBlockBeginAlign(block);
|
||||
|
Loading…
Reference in New Issue
Block a user