mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Added option to not use a camera.
This commit is contained in:
parent
cd3ca79c0c
commit
d3a8e0b1f0
6 changed files with 45 additions and 28 deletions
|
@ -3273,7 +3273,7 @@ void Project::CreateImages(Image* images, int width, int height, unsigned short
|
|||
oldtime = m_bAnimation ? m_nCurFrame : m_nCurStep;
|
||||
|
||||
View view(this, m_ActiveView);
|
||||
view.SetCamera(m_ActiveView->mCamera);
|
||||
view.SetCamera(m_ActiveView->mCamera, false);
|
||||
view.OnSize(width, height);
|
||||
|
||||
if (!hilite)
|
||||
|
@ -5757,10 +5757,25 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
|
||||
case LC_VIEW_CAMERA_MENU:
|
||||
{
|
||||
Camera* pCamera = mCameras[nParam];
|
||||
Camera* pCamera = NULL;
|
||||
|
||||
if (nParam == 0)
|
||||
{
|
||||
pCamera = m_ActiveView->mCamera;
|
||||
|
||||
if (!pCamera->IsSimple())
|
||||
{
|
||||
m_ActiveView->SetCamera(pCamera, true);
|
||||
pCamera = m_ActiveView->mCamera;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pCamera = mCameras[nParam - 1];
|
||||
}
|
||||
|
||||
SystemUpdateCurrentCamera(m_ActiveView->mCamera, pCamera, mCameras);
|
||||
m_ActiveView->SetCamera(pCamera);
|
||||
m_ActiveView->SetCamera(pCamera, false);
|
||||
UpdateOverlayScale();
|
||||
UpdateAllViews();
|
||||
} break;
|
||||
|
|
|
@ -22,9 +22,9 @@ View::~View()
|
|||
delete mCamera;
|
||||
}
|
||||
|
||||
void View::SetCamera(Camera* camera)
|
||||
void View::SetCamera(Camera* camera, bool ForceCopy)
|
||||
{
|
||||
if (camera->IsSimple())
|
||||
if (camera->IsSimple() || ForceCopy)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new Camera(true);
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void OnRightButtonUp(int x, int y, bool bControl, bool bShift);
|
||||
void OnMouseMove(int x, int y, bool bControl, bool bShift);
|
||||
|
||||
void SetCamera(Camera* camera);
|
||||
void SetCamera(Camera* camera, bool ForceCopy);
|
||||
void SetDefaultCamera();
|
||||
|
||||
LC_CURSOR_TYPE GetCursor() const;
|
||||
|
|
|
@ -226,7 +226,7 @@ void CCADView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
|
|||
GL_DisableVertexBufferObject();
|
||||
|
||||
View view(project, project->m_ActiveView);
|
||||
view.SetCamera(project->m_ActiveView->mCamera);
|
||||
view.SetCamera(project->m_ActiveView->mCamera, false);
|
||||
view.CreateFromBitmap(hMemDC);
|
||||
view.MakeCurrent();
|
||||
view.OnSize(tw, th);
|
||||
|
@ -519,7 +519,7 @@ int CCADView::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|||
|
||||
m_pView = new View(project, project->m_ActiveView);
|
||||
if (project->m_ActiveView)
|
||||
m_pView->SetCamera(project->m_ActiveView->mCamera);
|
||||
m_pView->SetCamera(project->m_ActiveView->mCamera, false);
|
||||
else
|
||||
m_pView->SetDefaultCamera();
|
||||
m_pView->CreateFromWindow(m_hWnd);
|
||||
|
|
|
@ -286,7 +286,7 @@ BEGIN
|
|||
END
|
||||
POPUP "C&ameras"
|
||||
BEGIN
|
||||
MENUITEM "Reset", ID_VIEW_CAMERAS_RESET
|
||||
MENUITEM "Dummy", ID_CAMERA_FIRST
|
||||
END
|
||||
POPUP "Ste&p"
|
||||
BEGIN
|
||||
|
@ -1786,6 +1786,11 @@ BEGIN
|
|||
ID_VIEW_VIEWPOINT_HOME "View model from the default position."
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_CAMERA_FIRST "Do not use a camera"
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -397,14 +397,18 @@ void CMainFrame::OnUpdateLock(CCmdUI* pCmdUI)
|
|||
void CMainFrame::OnUpdateCamera(CCmdUI* pCmdUI)
|
||||
{
|
||||
Project* project = lcGetActiveProject();
|
||||
Camera* ActiveCamera = project->GetActiveView()->mCamera;
|
||||
int CameraIndex = pCmdUI->m_nID - ID_CAMERA_FIRST;
|
||||
|
||||
if (project->mCameras.GetSize())
|
||||
if (!CameraIndex)
|
||||
pCmdUI->SetRadio(ActiveCamera->IsSimple());
|
||||
else if (project->mCameras.GetSize() > CameraIndex - 1)
|
||||
{
|
||||
Camera* ActiveCamera = project->GetActiveView()->mCamera;
|
||||
Camera* MenuCamera = project->mCameras[pCmdUI->m_nID - ID_CAMERA_FIRST];
|
||||
|
||||
Camera* MenuCamera = project->mCameras[CameraIndex - 1];
|
||||
pCmdUI->SetRadio(MenuCamera == ActiveCamera);
|
||||
}
|
||||
else
|
||||
pCmdUI->SetRadio(FALSE);
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateSnapXY(CCmdUI* pCmdUI)
|
||||
|
@ -608,9 +612,9 @@ void CMainFrame::OnViewFullscreen()
|
|||
|
||||
void CMainFrame::GetMessageString(UINT nID, CString& rMessage) const
|
||||
{
|
||||
if (nID >= ID_CAMERA_FIRST && nID <= ID_CAMERA_LAST)
|
||||
if (nID > ID_CAMERA_FIRST && nID <= ID_CAMERA_LAST)
|
||||
{
|
||||
Camera* pCamera = lcGetActiveProject()->mCameras[nID - ID_CAMERA_FIRST];
|
||||
Camera* pCamera = lcGetActiveProject()->mCameras[nID - ID_CAMERA_FIRST - 1];
|
||||
rMessage = "Use the camera \"";
|
||||
rMessage += pCamera->GetName();
|
||||
rMessage += "\"";
|
||||
|
@ -629,30 +633,23 @@ BOOL CMainFrame::OnShowPopupMenu(CMFCPopupMenu* pMenuPopup)
|
|||
if (!CMFCToolBar::IsCustomizeMode() && pMenuPopup != NULL && pMenuPopup->GetHMenu() != NULL)
|
||||
{
|
||||
HMENU hMenuPop = pMenuPopup->GetHMenu();
|
||||
BOOL bIsCamerawMenu = FALSE;
|
||||
UINT nID = ::GetMenuItemID(hMenuPop, 0);
|
||||
|
||||
int iItemMax = ::GetMenuItemCount(hMenuPop);
|
||||
for (int iItemPop = 0; !bIsCamerawMenu && iItemPop < iItemMax; iItemPop ++)
|
||||
{
|
||||
UINT nID = ::GetMenuItemID( hMenuPop, iItemPop);
|
||||
bIsCamerawMenu = (nID == ID_VIEW_CAMERAS_RESET) || (nID >= ID_CAMERA_FIRST && nID <= ID_CAMERA_LAST);
|
||||
}
|
||||
|
||||
if (bIsCamerawMenu)
|
||||
if (nID == ID_CAMERA_FIRST)
|
||||
{
|
||||
Project* project = lcGetActiveProject();
|
||||
|
||||
pMenuPopup->RemoveAllItems();
|
||||
|
||||
pMenuPopup->InsertItem(CMFCToolBarMenuButton(ID_CAMERA_FIRST, NULL, -1, "No Camera"));
|
||||
|
||||
for (int CameraIdx = 0; CameraIdx < project->mCameras.GetSize(); CameraIdx++)
|
||||
{
|
||||
CMFCToolBarMenuButton newButton(ID_CAMERA_FIRST + CameraIdx, NULL, -1, project->mCameras[CameraIdx]->GetName());
|
||||
CMFCToolBarMenuButton newButton(ID_CAMERA_FIRST + CameraIdx + 1, NULL, -1, project->mCameras[CameraIdx]->GetName());
|
||||
pMenuPopup->InsertItem(newButton);
|
||||
}
|
||||
|
||||
if (project->mCameras.GetSize())
|
||||
pMenuPopup->InsertSeparator();
|
||||
|
||||
pMenuPopup->InsertSeparator();
|
||||
pMenuPopup->InsertItem(CMFCToolBarMenuButton(ID_VIEW_CAMERAS_RESET, NULL, -1, "Reset"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue