1
0
Fork 0

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.
This commit is contained in:
James Turner 2016-01-24 13:01:12 -06:00
parent 5629cf1a8d
commit 5b81333768
3 changed files with 14 additions and 39 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;
};