add fileOpenDialog and enable loading of urdf from GUI

(will add .bullet file support soon)
Uses native Windows (getFileOpenFileName) and Mac OSX NSOpenPanel,
on Linux using pipe popen to zenity)
This commit is contained in:
Erwin Coumans
2014-08-31 11:53:44 -07:00
parent 8595928949
commit f199a4a972
14 changed files with 250 additions and 50 deletions

View File

@@ -137,6 +137,40 @@ void Win32OpenGLWindow::endRendering()
}
int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
{
//wchar_t wideChars[1024];
OPENFILENAME ofn ;
ZeroMemory( &ofn , sizeof( ofn));
ofn.lStructSize = sizeof ( ofn );
ofn.hwndOwner = NULL ;
#ifdef UNICODE
WCHAR bla[1024];
ofn.lpstrFile = bla;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = 1023;
ofn.lpstrFilter = L"URDF\0*.urdf\0";
#else
ofn.lpstrFile = fileName;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = 1023;
//ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.lpstrFilter = "URDF\0*.urdf\0";
#endif
ofn.nFilterIndex =1;
ofn.lpstrFileTitle = NULL ;
ofn.nMaxFileTitle = 0 ;
ofn.lpstrInitialDir=NULL ;
ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ;
GetOpenFileName( &ofn );
return strlen(fileName);
//return 0;
}