#973 Linked views : Propagate change of parallell/perspective flag

This commit is contained in:
Magne Sjaastad 2016-11-24 12:19:05 +01:00
parent 6367522593
commit 6adc7eab7c
2 changed files with 13 additions and 8 deletions

View File

@ -46,8 +46,11 @@ void RicTogglePerspectiveViewFeature::onActionTriggered(bool isChecked)
{ {
bool isPerspective = RiaApplication::instance()->activeReservoirView()->isPerspectiveView(); bool isPerspective = RiaApplication::instance()->activeReservoirView()->isPerspectiveView();
RiaApplication::instance()->activeReservoirView()->isPerspectiveView = !isPerspective; RiaApplication::instance()->activeReservoirView()->isPerspectiveView = !isPerspective;
RiaApplication::instance()->activeReservoirView()->viewer()->enableParallelProjection(isPerspective);
RiaApplication::instance()->activeReservoirView()->isPerspectiveView.uiCapability()->updateConnectedEditors(); RiaApplication::instance()->activeReservoirView()->isPerspectiveView.uiCapability()->updateConnectedEditors();
RiaApplication::instance()->activeReservoirView()->viewer()->enableParallelProjection(isPerspective);
RiaApplication::instance()->activeReservoirView()->viewer()->navigationPolicyUpdate();
this->action(); // Retrieve the action to update the looks this->action(); // Retrieve the action to update the looks
} }
} }

View File

@ -516,19 +516,21 @@ void RimViewLinker::updateCamera(RimView* sourceView)
sourceSceneBB.transform(trans); sourceSceneBB.transform(trans);
} }
// Propagate view matrix to all relevant views for (RimView* destinationView : viewsToUpdate)
const cvf::Mat4d mat = sourceView->viewer()->mainCamera()->viewMatrix();
for (size_t i = 0; i < viewsToUpdate.size(); i++)
{ {
if (viewsToUpdate[i] && viewsToUpdate[i]->viewer()) if (!destinationView) continue;
destinationView->isPerspectiveView = sourceView->isPerspectiveView;
RiuViewer* destinationViewer = destinationView->viewer();
if (destinationViewer)
{ {
RiuViewer* destinationViewer = viewsToUpdate[i]->viewer(); destinationViewer->enableParallelProjection(!sourceView->isPerspectiveView);
// Destination bounding box in global coordinates including scaleZ // Destination bounding box in global coordinates including scaleZ
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox(); cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(viewsToUpdate[i]); RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(destinationView);
if (destEclipseView if (destEclipseView
&& destEclipseView->eclipseCase() && destEclipseView->eclipseCase()
&& destEclipseView->eclipseCase()->reservoirData() && destEclipseView->eclipseCase()->reservoirData()