From: James Turner Date: Sun, 24 Jan 2016 19:01:12 +0000 (-0600) Subject: View offset/target-offset props are tied X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5b81333768b1d84093cf5c312977bed56f1cc0a0;p=flightgear.git View offset/target-offset props are tied - make these View properties work like all the others, i.e bound and unbound when the view changes. --- diff --git a/src/Viewer/viewer.cxx b/src/Viewer/viewer.cxx index 16eaeec83..a2d555a9e 100644 --- a/src/Viewer/viewer.cxx +++ b/src/Viewer/viewer.cxx @@ -270,6 +270,20 @@ View::bind () _tiedProperties.Tie("viewer-lat-deg", this, &View::getLat_deg); _tiedProperties.Tie("viewer-elev-ft", this, &View::getElev_ft); + _tiedProperties.Tie("x-offset-m", this, &View::getXOffset_m, + &View::setXOffset_m, false); + _tiedProperties.Tie("y-offset-m", this, &View::getYOffset_m, + &View::setYOffset_m, false); + _tiedProperties.Tie("z-offset-m", this, &View::getZOffset_m, + &View::setZOffset_m, false); + + _tiedProperties.Tie("target-x-offset-m", this, &View::getTargetXOffset_m, + &View::setTargetXOffset_m, false); + _tiedProperties.Tie("target-y-offset-m", this, &View::getTargetYOffset_m, + &View::setTargetYOffset_m, false); + _tiedProperties.Tie("target-z-offset-m", this, &View::getTargetZOffset_m, + &View::setTargetZOffset_m, false); + // expose various quaternions under the debug/ subtree _tiedProperties.Tie("debug/orientation-w", this, &View::getOrientation_w); _tiedProperties.Tie("debug/orientation-x", this, &View::getOrientation_x); @@ -314,17 +328,6 @@ View::bind () config->setDoubleValue("pitch-offset-deg", _configPitchOffsetDeg); config->setDoubleValue("roll-offset-deg", _configRollOffsetDeg); config->setDoubleValue("default-field-of-view-deg", _configFOV_deg); - -// following properties are not tied, but copied each frame (for now). -// copying /in/ happens in FGViewMgr::update; this is where we copy our current -// values /out/ when we are activated - _tiedProperties.getRoot()->setDoubleValue("x-offset-m", getXOffset_m()); - _tiedProperties.getRoot()->setDoubleValue("y-offset-m", getYOffset_m()); - _tiedProperties.getRoot()->setDoubleValue("z-offset-m", getZOffset_m()); - - _tiedProperties.getRoot()->setDoubleValue("target-x-offset-m", getTargetXOffset_m()); - _tiedProperties.getRoot()->setDoubleValue("target-y-offset-m", getTargetYOffset_m()); - _tiedProperties.getRoot()->setDoubleValue("target-z-offset-m", getTargetZOffset_m()); } void diff --git a/src/Viewer/viewmgr.cxx b/src/Viewer/viewmgr.cxx index 962fa3b05..27226252e 100644 --- a/src/Viewer/viewmgr.cxx +++ b/src/Viewer/viewmgr.cxx @@ -111,13 +111,6 @@ FGViewMgr::bind() _viewNumberProp = _tiedProperties.getRoot()->getNode("view-number"); _viewNumberProp->setAttribute(SGPropertyNode::ARCHIVE, false); _viewNumberProp->setAttribute(SGPropertyNode::PRESERVE, true); - - current_x_offs = fgGetNode("/sim/current-view/x-offset-m", true); - current_y_offs = fgGetNode("/sim/current-view/y-offset-m", true); - current_z_offs = fgGetNode("/sim/current-view/z-offset-m", true); - target_x_offs = fgGetNode("/sim/current-view/target-x-offset-m", true); - target_y_offs = fgGetNode("/sim/current-view/target-y-offset-m", true); - target_z_offs = fgGetNode("/sim/current-view/target-z-offset-m", true); } @@ -131,14 +124,6 @@ FGViewMgr::unbind () _tiedProperties.Untie(); _viewNumberProp.clear(); - - config_list.clear(); - target_x_offs.clear(); - target_y_offs.clear(); - target_z_offs.clear(); - current_x_offs.clear(); - current_y_offs.clear(); - current_z_offs.clear(); } void @@ -152,16 +137,6 @@ FGViewMgr::update (double dt) // Set up view location and orientation currentView->updateData(); - // these properties aren't tied - manually propogate them to the - // currently active view - currentView->setXOffset_m(current_x_offs->getDoubleValue()); - currentView->setYOffset_m(current_y_offs->getDoubleValue()); - currentView->setZOffset_m(current_z_offs->getDoubleValue()); - - currentView->setTargetXOffset_m(target_x_offs->getDoubleValue()); - currentView->setTargetYOffset_m(target_y_offs->getDoubleValue()); - currentView->setTargetZOffset_m(target_z_offs->getDoubleValue()); - // Update the current view currentView->update(dt); diff --git a/src/Viewer/viewmgr.hxx b/src/Viewer/viewmgr.hxx index 5054539d0..8093323d8 100644 --- a/src/Viewer/viewmgr.hxx +++ b/src/Viewer/viewmgr.hxx @@ -91,9 +91,6 @@ private: viewer_list views; int current; - - SGPropertyNode_ptr current_x_offs, current_y_offs, current_z_offs; - SGPropertyNode_ptr target_x_offs, target_y_offs, target_z_offs; };