FreeCAD-VR: command integration
This commit is contained in:
parent
537d7edfd8
commit
c0152eeb68
|
@ -8,9 +8,9 @@ if (FREECAD_USE_3DCONNEXION)
|
||||||
add_definitions(-D_USE_3DCONNEXION_SDK)
|
add_definitions(-D_USE_3DCONNEXION_SDK)
|
||||||
endif(FREECAD_USE_3DCONNEXION)
|
endif(FREECAD_USE_3DCONNEXION)
|
||||||
|
|
||||||
if (OCULUS_FOUND)
|
if (BUILD_VR)
|
||||||
add_definitions(-D_USE_OCULUS_RIFT_SDK )
|
add_definitions(-DBUILD_VR )
|
||||||
endif(OCULUS_FOUND)
|
endif(BUILD_VR)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
|
|
@ -1408,6 +1408,37 @@ bool StdViewDockUndockFullscreen::isActive(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Std_ViewVR
|
||||||
|
//===========================================================================
|
||||||
|
DEF_STD_CMD_A(StdCmdViewVR);
|
||||||
|
|
||||||
|
StdCmdViewVR::StdCmdViewVR()
|
||||||
|
: Command("Std_ViewVR")
|
||||||
|
{
|
||||||
|
sGroup = QT_TR_NOOP("Standard-View");
|
||||||
|
sMenuText = QT_TR_NOOP("FreeCAD-VR");
|
||||||
|
sToolTipText = QT_TR_NOOP("Extend the FreeCAD 3D Window to a Oculus Rift");
|
||||||
|
sWhatsThis = "Std_ViewVR";
|
||||||
|
sStatusTip = QT_TR_NOOP("Extend the FreeCAD 3D Window to a Oculus Rift");
|
||||||
|
sPixmap = "view-zoom-all";
|
||||||
|
eType = Alter3DView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StdCmdViewVR::activated(int iMsg)
|
||||||
|
{
|
||||||
|
//doCommand(Command::Gui,"Gui.activeDocument().activeView().fitAll()");
|
||||||
|
doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"ViewVR\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StdCmdViewVR::isActive(void)
|
||||||
|
{
|
||||||
|
return getGuiApplication()->sendHasMsgToActiveView("ViewVR");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Std_ViewScreenShot
|
// Std_ViewScreenShot
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -2453,6 +2484,7 @@ void CreateViewStdCommands(void)
|
||||||
rcCmdMgr.addCommand(new StdCmdViewTop());
|
rcCmdMgr.addCommand(new StdCmdViewTop());
|
||||||
rcCmdMgr.addCommand(new StdCmdViewAxo());
|
rcCmdMgr.addCommand(new StdCmdViewAxo());
|
||||||
rcCmdMgr.addCommand(new StdCmdViewFitAll());
|
rcCmdMgr.addCommand(new StdCmdViewFitAll());
|
||||||
|
rcCmdMgr.addCommand(new StdCmdViewVR());
|
||||||
rcCmdMgr.addCommand(new StdCmdViewFitSelection());
|
rcCmdMgr.addCommand(new StdCmdViewFitSelection());
|
||||||
rcCmdMgr.addCommand(new StdCmdViewRotateLeft());
|
rcCmdMgr.addCommand(new StdCmdViewRotateLeft());
|
||||||
rcCmdMgr.addCommand(new StdCmdViewRotateRight());
|
rcCmdMgr.addCommand(new StdCmdViewRotateRight());
|
||||||
|
|
|
@ -366,7 +366,7 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
||||||
_viewer->turnDeltaDimensionsOn();
|
_viewer->turnDeltaDimensionsOn();
|
||||||
else
|
else
|
||||||
_viewer->turnDeltaDimensionsOff();
|
_viewer->turnDeltaDimensionsOff();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
|
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
|
||||||
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
|
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
|
||||||
|
@ -545,6 +545,11 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn)
|
||||||
_viewer->viewAll();
|
_viewer->viewAll();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (strcmp("ViewVR",pMsg) == 0) {
|
||||||
|
// call the VR portion of the viewer
|
||||||
|
_viewer->viewVR();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if(strcmp("ViewSelection",pMsg) == 0) {
|
else if(strcmp("ViewSelection",pMsg) == 0) {
|
||||||
_viewer->viewSelection();
|
_viewer->viewSelection();
|
||||||
return true;
|
return true;
|
||||||
|
@ -728,6 +733,12 @@ bool View3DInventor::onHasMsg(const char* pMsg) const
|
||||||
return true;
|
return true;
|
||||||
else if(strcmp("ViewFit",pMsg) == 0)
|
else if(strcmp("ViewFit",pMsg) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
else if(strcmp("ViewVR",pMsg) == 0)
|
||||||
|
#ifdef BUILD_VR
|
||||||
|
return true;
|
||||||
|
#elif
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
else if(strcmp("ViewSelection",pMsg) == 0)
|
else if(strcmp("ViewSelection",pMsg) == 0)
|
||||||
return true;
|
return true;
|
||||||
else if(strcmp("ViewBottom",pMsg) == 0)
|
else if(strcmp("ViewBottom",pMsg) == 0)
|
||||||
|
|
|
@ -33,7 +33,11 @@
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
|
|
||||||
#if _USE_OCULUS_RIFT_SDK
|
#if BUILD_VR
|
||||||
|
|
||||||
|
#ifndef OCULUS_FOUND
|
||||||
|
# error "Build VR without the Oculus SDK makes no sense at all"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define USE_SO_OFFSCREEN_RENDERER
|
#define USE_SO_OFFSCREEN_RENDERER
|
||||||
//#define USE_FRAMEBUFFER
|
//#define USE_FRAMEBUFFER
|
||||||
|
@ -480,4 +484,4 @@ int oculusTest(void)
|
||||||
//return app.exec();
|
//return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_USE_OCULUS_RIFT_SDK
|
#endif //BUILD_VR
|
|
@ -1636,6 +1636,19 @@ void View3DInventorViewer::animatedViewAll(int steps, int ms)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BUILD_VR
|
||||||
|
extern int oculusTest(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void View3DInventorViewer::viewVR(void)
|
||||||
|
{
|
||||||
|
#if BUILD_VR
|
||||||
|
oculusTest();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void View3DInventorViewer::boxZoom(const SbBox2s& box)
|
void View3DInventorViewer::boxZoom(const SbBox2s& box)
|
||||||
{
|
{
|
||||||
navigation->boxZoom(box);
|
navigation->boxZoom(box);
|
||||||
|
|
|
@ -310,6 +310,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void viewAll();
|
void viewAll();
|
||||||
void viewAll(float factor);
|
void viewAll(float factor);
|
||||||
|
|
||||||
|
/// Breaks out a VR window for a Rift
|
||||||
|
void viewVR(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reposition the current camera so we can see all selected objects
|
* Reposition the current camera so we can see all selected objects
|
||||||
* of the scene. Therefore we search for all SOFCSelection nodes, if
|
* of the scene. Therefore we search for all SOFCSelection nodes, if
|
||||||
|
|
|
@ -487,7 +487,11 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||||
*view << "Std_ViewCreate" << "Std_OrthographicCamera" << "Std_PerspectiveCamera" << "Separator"
|
*view << "Std_ViewCreate" << "Std_OrthographicCamera" << "Std_PerspectiveCamera" << "Separator"
|
||||||
<< stdviews << "Std_FreezeViews" << "Std_DrawStyle" << "Separator" << view3d << zoom
|
<< stdviews << "Std_FreezeViews" << "Std_DrawStyle" << "Separator" << view3d << zoom
|
||||||
<< "Std_ViewDockUndockFullscreen" << "Std_AxisCross" << "Std_ToggleClipPlane"
|
<< "Std_ViewDockUndockFullscreen" << "Std_AxisCross" << "Std_ToggleClipPlane"
|
||||||
<< "Std_TextureMapping" << "Separator" << visu
|
<< "Std_TextureMapping"
|
||||||
|
#ifdef BUILD_VR
|
||||||
|
<< "Std_ViewVR"
|
||||||
|
#endif
|
||||||
|
<< "Separator" << visu
|
||||||
<< "Std_ToggleVisibility" << "Std_ToggleNavigation"
|
<< "Std_ToggleVisibility" << "Std_ToggleNavigation"
|
||||||
<< "Std_SetAppearance" << "Std_RandomColor" << "Separator"
|
<< "Std_SetAppearance" << "Std_RandomColor" << "Separator"
|
||||||
<< "Std_MeasureDistance" << "Separator"
|
<< "Std_MeasureDistance" << "Separator"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user