Detach camera when diving into a submodel.

This commit is contained in:
Leonardo Zide 2019-02-09 16:30:11 -08:00
parent 378ece224f
commit 8f59a67924
3 changed files with 11 additions and 2 deletions

View file

@ -2775,12 +2775,12 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
case LC_VIEW_ZOOM_IN:
if (ActiveView)
lcGetActiveModel()->Zoom(ActiveView->mCamera, 10.0f);
ActiveView->Zoom(10.0f);
break;
case LC_VIEW_ZOOM_OUT:
if (ActiveView)
lcGetActiveModel()->Zoom(ActiveView->mCamera, -10.0f);
ActiveView->Zoom(-10.0f);
break;
case LC_VIEW_ZOOM_EXTENTS:

View file

@ -84,6 +84,7 @@ void View::SetSelectedSubmodelActive()
mActiveSubmodelInstance = Piece;
ActiveModel = mActiveSubmodelInstance->mPieceInfo->GetModel();
ActiveModel->SetActive(true);
RemoveCamera();
}
}
@ -1968,6 +1969,13 @@ void View::MoveCamera(const lcVector3& Direction)
ActiveModel->MoveCamera(mCamera, Direction);
}
void View::Zoom(float Amount)
{
lcModel* ActiveModel = GetActiveModel();
if (ActiveModel)
ActiveModel->Zoom(mCamera, Amount);
}
void View::UpdateTrackTool()
{
lcTool CurrentTool = gMainWindow->GetTool();

View file

@ -112,6 +112,7 @@ public:
void LookAt();
void ZoomExtents();
void MoveCamera(const lcVector3& Direction);
void Zoom(float Amount);
void RemoveCamera();
void SetCamera(lcCamera* Camera, bool ForceCopy);