void CMainFrame::OnFileOpenProject() { using namespace engine; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); CFileDialog dlg(TRUE, L"gp", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, L"Game Project Files (*.gp)|*.gp||"); if(IDOK != dlg.DoModal()) { return; } ProjectPtr pProject = Project::Instance(); pProject->Close(); CString file = dlg.GetPathName(); if(pProject->Load(file) == false) { MessageBox(L"Fialed to load project.", L"error", MB_ICONERROR); pProject->Close(); return; } util_update_object_view(pProject->Root()); }
BOOL CGameEditorDoc::OnOpenDocument(LPCTSTR lpszPathName) { using namespace ld3d; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); ProjectPtr pProject = Project::Instance(); pProject->Close(); if(pProject->Load(lpszPathName) == false) { util_log_info(L"Failed to open project."); return FALSE; } util_log_info(L"Project openned."); util_update_object_view(Project::Instance()->Root()); return CDocument::OnOpenDocument(lpszPathName); }