[prev in list] [next in list] [prev in thread] [next in thread]
List: flightgear-devel
Subject: Re: [Flightgear-devel] Aircraft/an24b/Models/An-24B.xml does not execute its nasal/load script
From: Stuart Buchanan <stuart13 () gmail ! com>
Date: 2019-02-15 0:28:46
Message-ID: CAP3ntyuVw-_q2J8t2jfAbr=75xX_0EoWuJOGc8-niK=2GztueQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi All,
I think I've found the culprit based on a code read, but I don't (yet) know
how to fix it. I'm documenting this here if anyone else is interested, as
I've run out of brain-cells for tonight!
We've got some code that defers initialization of model Nasal code until
the first call to FGAIBase::update(double dt)
(flightgear/src/AIModel/AIBase.cxx:270).
if ((_modeldata)&&(_modeldata->needInitilization()))
{
// process deferred nasal initialization,
// which must be done in main thread
_modeldata->init();
_modeldata->init() executes any <load> Nasal code. There are two problems:
1) It's only ever initialized once, whereas we need it to be initialized if
a new model has been loaded via the PagedLOD mechanism. I'm not quite sure
how to do that - perhaps with some form of call-back on the loader to reset
the initialized flag?
2) When a model is loaded, the contents of the mode XML file are copied
across into the property tree (which includes any <load> or <unload>
blocks). I suspect when a second model for a PagedLoD is loaded this is
simply added to the existing property tree rather than replacing what was
already there. So if both the low-poly and detailed models both have
<load> blocks, we'll end up with two. That's probably not good.
This doesn't explain the MiG-15 vs An-24 behaviour yet.
-Stuart
[Attachment #5 (text/html)]
<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi \
All,</div><div><br></div><div>I think I've found the culprit based on a code \
read, but I don't (yet) know how to fix it. I'm documenting this here if \
anyone else is interested, as I've run out of brain-cells for \
tonight!<br></div><div><br></div><div>We've got some code that defers \
initialization of model Nasal code until the first call to FGAIBase::update(double \
dt) (flightgear/src/AIModel/AIBase.cxx:270). <br></div><div><br></div><div>if \
((_modeldata)&&(_modeldata->needInitilization()))<br> {<br> \
// process deferred nasal initialization,<br> // which must be done in \
main thread<br> _modeldata->init();<br></div><div><br></div><div> \
_modeldata->init() executes any <load> Nasal code. There are two \
problems:</div><div><br></div><div>1) It's only ever initialized once, whereas we \
need it to be initialized if a new model has been loaded via the PagedLOD mechanism. \
I'm not quite sure how to do that - perhaps with some form of call-back on the \
loader to reset the initialized flag?<br></div><div>2) When a model is loaded, the \
contents of the mode XML file are copied across into the property tree (which \
includes any <load> or <unload> blocks). I suspect when a second model \
for a PagedLoD is loaded this is simply added to the existing property tree rather \
than replacing what was already there. So if both the low-poly and detailed models \
both have <load> blocks, we'll end up with two. That's probably not \
good.</div><div><br></div><div>This doesn't explain the MiG-15 vs An-24 behaviour \
yet.</div><div><br></div><div>-Stuart<br></div><br></div></div></div></div>
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic