void CEditCameraWnd::OnSaveAsSceneInitClicked(wxCommandEvent& /*event*/) { CScene* pCurScene = CSceneManager::GetInstance()->GetCurrentScene(); if (pCurScene != NULL) { pCurScene->SetInitCameraPos(CVec3((float)m_pPosX->GetValue().GetDouble(), (float)m_pPosY->GetValue().GetDouble(), (float)m_pPosZ->GetValue().GetDouble())); UPDATE_PROXY_PROPERTY_BY_NAME(pCurScene, pCurScene->GetInitCameraPos(), "m_cameraInitPos"); pCurScene->SetInitCameraRotation(CVec3((float)m_pRotationX->GetValue().GetDouble(), (float)m_pRotationY->GetValue().GetDouble(), (float)m_pRotationZ->GetValue().GetDouble())); UPDATE_PROXY_PROPERTY_BY_NAME(pCurScene, pCurScene->GetInitCameraRotation(), "m_cameraInitRotation"); pCurScene->SetInitCameraNear((float)m_pClipNear->GetValue().GetDouble()); UPDATE_PROXY_PROPERTY_BY_NAME(pCurScene, pCurScene->GetInitCameraNear(), "m_fCameraInitNear"); pCurScene->SetInitCameraFar((float)m_pClipFar->GetValue().GetDouble()); UPDATE_PROXY_PROPERTY_BY_NAME(pCurScene, pCurScene->GetInitCameraFar(), "m_fCameraInitFar"); pCurScene->SetInitCameraFov((float)m_pFov->GetValue().GetDouble()); UPDATE_PROXY_PROPERTY_BY_NAME(pCurScene, pCurScene->GetInitCameraFov(), "m_fCameraInitFov"); CEditorMainFrame* pMainFrame = static_cast<CEngineEditor*>(wxApp::GetInstance())->GetMainFrame(); CComponentProxy* pProxy = pCurScene->GetProxyComponent(); BEATS_ASSERT(pProxy != NULL, _T("Can't find the proxy of Scene!")); if (pMainFrame->GetSelectedComponent() == pProxy) { //Refresh the current showing property grid. pMainFrame->SelectComponent(pProxy); } } }
void CEditCameraWnd::OnLoadSceneInitClicked(wxCommandEvent& /*event*/) { CScene* pCurScene = CSceneManager::GetInstance()->GetCurrentScene(); if (pCurScene != NULL) { CEditorMainFrame* pMainFrame = static_cast<CEngineEditor*>(wxApp::GetInstance())->GetMainFrame(); CBeyondEngineEditorGLWindow* pSceneWnd = pMainFrame->GetSceneWindow(); CCamera* pCurCamera = pSceneWnd->GetCamera(); if (pCurCamera != NULL) { const CVec3& rotation = pCurScene->GetInitCameraRotation(); pCurCamera->SetRotation(rotation); const CVec3& viewPos = pCurScene->GetInitCameraPos(); pCurCamera->SetViewPos(viewPos); float fNear = pCurScene->GetInitCameraNear(); pCurCamera->SetNear(fNear); float fFar = pCurScene->GetInitCameraFar(); pCurCamera->SetFar(fFar); float fFov = pCurScene->GetInitCameraFov(); pCurCamera->SetFOV(fFov); } } }