Forráskód Böngészése

Merge pull request #2322 from assimp/fix_ofd

fix openfiledialog in modelviewer.
Kim Kulling 6 éve
szülő
commit
0f8f1449a1

+ 3 - 4
tools/assimp_view/Display.cpp

@@ -102,17 +102,16 @@ void GetNodeCount(aiNode* pcNode, unsigned int* piCnt)
 }
 
 //-------------------------------------------------------------------------------
-int CDisplay::EnableAnimTools(BOOL hm)
-{
+int CDisplay::EnableAnimTools(BOOL hm) {
     EnableWindow(GetDlgItem(g_hDlg,IDC_PLAY),hm);
     EnableWindow(GetDlgItem(g_hDlg,IDC_SLIDERANIM),hm);
+    
     return 1;
 }
 
 //-------------------------------------------------------------------------------
 // Fill animation combo box
-int CDisplay::FillAnimList(void)
-{
+int CDisplay::FillAnimList(void) {
     if (0 != g_pcAsset->pcScene->mNumAnimations)
     {
         // now fill in all animation names

+ 1 - 1
tools/assimp_view/Input.cpp

@@ -194,7 +194,7 @@ void HandleMouseInputSkyBox( void )
 
 //-------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------
-void HandleMouseInputLightIntensityAndColor( void )
+void HandleMouseInputLightIntensityAndColor()
     {
     POINT mousePos;
     GetCursorPos( &mousePos );

+ 44 - 6
tools/assimp_view/MessageProc.cpp

@@ -333,8 +333,7 @@ void ToggleWireFrame() {
 //-------------------------------------------------------------------------------
 // Toggle the "MultiSample" state
 //-------------------------------------------------------------------------------
-void ToggleMS()
-{
+void ToggleMS() {
     g_sOptions.bMultiSample = !g_sOptions.bMultiSample;
     DeleteAssetData();
     ShutdownDevice();
@@ -389,7 +388,7 @@ void ToggleUIState() {
 }
 
 //-------------------------------------------------------------------------------
-// Load the background texture for the cviewer
+// Load the background texture for the viewer
 //-------------------------------------------------------------------------------
 void LoadBGTexture() {
     char szFileName[MAX_PATH];
@@ -853,14 +852,53 @@ void OpenAsset() {
     strcpy(szCur,"*.*");
     szCur[4] = 0;
 
-    OPENFILENAME sFilename1 = {
+    /*DWORD        lStructSize;
+    HWND         hwndOwner;
+    HINSTANCE    hInstance;
+    LPCWSTR      lpstrFilter;
+    LPWSTR       lpstrCustomFilter;
+    DWORD        nMaxCustFilter;
+    DWORD        nFilterIndex;
+    LPWSTR       lpstrFile;
+    DWORD        nMaxFile;
+    LPWSTR       lpstrFileTitle;
+    DWORD        nMaxFileTitle;
+    LPCWSTR      lpstrInitialDir;
+    LPCWSTR      lpstrTitle;
+    DWORD        Flags;
+    WORD         nFileOffset;
+    WORD         nFileExtension;
+    LPCWSTR      lpstrDefExt;
+    LPARAM       lCustData;
+    LPOFNHOOKPROC lpfnHook;
+    LPCWSTR      lpTemplateName;
+#ifdef _MAC
+    LPEDITMENU   lpEditInfo;
+    LPCSTR       lpstrPrompt;*/
+
+
+    OPENFILENAME sFilename1;
+    ZeroMemory(&sFilename1, sizeof(sFilename1));
+    sFilename1.lStructSize = sizeof(sFilename1);
+    sFilename1.hwndOwner = g_hDlg;
+    sFilename1.hInstance = GetModuleHandle(NULL);
+    sFilename1.lpstrFile = szFileName;
+    sFilename1.lpstrFile[0] = '\0';
+    sFilename1.nMaxFile = sizeof(szList);
+    sFilename1.lpstrFilter = szList;
+    sFilename1.nFilterIndex = 1;
+    sFilename1.lpstrFileTitle = NULL;
+    sFilename1.nMaxFileTitle = 0;
+    sFilename1.lpstrInitialDir = NULL;
+    sFilename1.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
+    /*OPENFILENAME sFilename1 = {
         sizeof(OPENFILENAME),
-        g_hDlg,GetModuleHandle(NULL), szList, NULL, 0, 1,
+        g_hDlg, GetModuleHandle(NULL), szList, NULL, 0, 1,
         szFileName, MAX_PATH, NULL, 0, NULL,
         "Import Asset into ASSIMP",
         OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
         0, 1, ".x", 0, NULL, NULL
-    };
+    };*/
     if (GetOpenFileName(&sFilename1) == 0) {
         return;
     }

+ 10 - 15
tools/assimp_view/assimp_view.cpp

@@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <map>
 
 #ifdef __MINGW32__
-#include <mmsystem.h>
+#   include <mmsystem.h>
 #else
-#include <timeapi.h>
+#   include <timeapi.h>
 #endif
 
 using namespace std;
@@ -310,9 +310,10 @@ int LoadAsset()
 // Delete the loaded asset
 // The function does nothing is no asset is loaded
 //-------------------------------------------------------------------------------
-int DeleteAsset(void)
-{
-    if (!g_pcAsset)return 0;
+int DeleteAsset(void) {
+    if (!g_pcAsset) {
+        return 0;
+    }
 
     // don't anymore know why this was necessary ...
     CDisplay::Instance().OnRender();
@@ -349,9 +350,7 @@ int DeleteAsset(void)
 // p_avOut Receives the min/max boundaries. Must point to 2 vec3s
 // piMatrix Transformation matrix of the graph at this position
 //-------------------------------------------------------------------------------
-int CalculateBounds(aiNode* piNode, aiVector3D* p_avOut, 
-    const aiMatrix4x4& piMatrix)
-{
+int CalculateBounds(aiNode* piNode, aiVector3D* p_avOut, const aiMatrix4x4& piMatrix) {
     ai_assert(NULL != piNode);
     ai_assert(NULL != p_avOut);
 
@@ -739,7 +738,7 @@ int DeleteAssetData(bool bNoMaterials)
 
 
 //-------------------------------------------------------------------------------
-// Switch beetween zoom/rotate view and the standatd FPS view
+// Switch between zoom/rotate view and the standard FPS view
 // g_bFPSView specifies the view mode to setup
 //-------------------------------------------------------------------------------
 int SetupFPSView()
@@ -982,7 +981,7 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
         sParams.MultiSampleType = sMSOut;
     }
 
-    // preget the device capabilities. If the hardware vertex shader is too old, we prefer software vertex processing
+    // get the device capabilities. If the hardware vertex shader is too old, we prefer software vertex processing
     g_piD3D->GetDeviceCaps( 0, D3DDEVTYPE_HAL, &g_sCaps);
     DWORD creationFlags = D3DCREATE_MULTITHREADED;
     if( g_sCaps.VertexShaderVersion >= D3DVS_VERSION( 2, 0))
@@ -1099,17 +1098,13 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
     return 1;
 }
 
-
-//-------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------
-int CreateDevice (void)
+int CreateDevice()
 {
     return CreateDevice(g_sOptions.bMultiSample,
         g_sOptions.bSuperSample);
 }
 
-
-//-------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------
 int GetProjectionMatrix (aiMatrix4x4& p_mOut)
 {