Avoid view-manager returning default SGGeod
- when switching views, force an update() to ensure view position is valid. Otherwise various subsystems such as AI traffic and the tile manager see a request for a 0,0 location. - when switching to model view, we still generate a 0,0 location initially - to be fixed.
This commit is contained in:
parent
335fda719d
commit
9e4e6a6fbf
2 changed files with 15 additions and 1 deletions
|
@ -139,6 +139,14 @@ FGViewMgr::init ()
|
||||||
do_bind();
|
do_bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGViewMgr::postinit()
|
||||||
|
{
|
||||||
|
// force update now so many properties of the current view are valid,
|
||||||
|
// eg view position and orientation (as exposed via globals)
|
||||||
|
update(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGViewMgr::shutdown()
|
FGViewMgr::shutdown()
|
||||||
{
|
{
|
||||||
|
@ -732,6 +740,11 @@ FGViewMgr::setView (int newview)
|
||||||
current = newview;
|
current = newview;
|
||||||
// copy in view data
|
// copy in view data
|
||||||
copyToCurrent();
|
copyToCurrent();
|
||||||
|
|
||||||
|
// force an update now, to avoid returning bogus data.
|
||||||
|
// real fix would to be make all the accessors use the dirty mechanism
|
||||||
|
// on FGViewer, so update() is a no-op.
|
||||||
|
update(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
~FGViewMgr( void );
|
~FGViewMgr( void );
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
virtual void postinit();
|
||||||
virtual void bind ();
|
virtual void bind ();
|
||||||
virtual void unbind ();
|
virtual void unbind ();
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
@ -73,7 +74,7 @@ public:
|
||||||
|
|
||||||
void add_view( FGViewer * v );
|
void add_view( FGViewer * v );
|
||||||
|
|
||||||
static const char* subsystemName() { return "view-mgr"; }
|
static const char* subsystemName() { return "view-manager"; }
|
||||||
private:
|
private:
|
||||||
void do_bind();
|
void do_bind();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue