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: case LC_VIEW_ZOOM_IN:
if (ActiveView) if (ActiveView)
lcGetActiveModel()->Zoom(ActiveView->mCamera, 10.0f); ActiveView->Zoom(10.0f);
break; break;
case LC_VIEW_ZOOM_OUT: case LC_VIEW_ZOOM_OUT:
if (ActiveView) if (ActiveView)
lcGetActiveModel()->Zoom(ActiveView->mCamera, -10.0f); ActiveView->Zoom(-10.0f);
break; break;
case LC_VIEW_ZOOM_EXTENTS: case LC_VIEW_ZOOM_EXTENTS:

View file

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

View file

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