by Hooray » Fri Sep 25, 2015 7:20 am
The evaluation time of the XML/model loader and Nasal are different, so there is no straightforward way to do this. Unless you are willing to make a feature request, i.e. to support property rules and/or embedded Nasal in model.xml files..
As a workaround, you could associate _each_ model with a condition (property), OSG's PagedLOD will usually defer model loading until it is necessary/visible. Thus, you could create a boilerplate XML snippet with a configurable file name, and then parametrize that using the params directive (when including it).
During initialization, your Nasal module would then check if the 3D model exists or not, and if it does, set the "display" property to "true", so that the OSG model loader (switch node) will actually display/load the filesh
Depending on how well the code is integrated, you may however have to run a fgcommand to re-init the model subsystem.
Either way you are in uncharted waters here, and the approach/idea is kinda flawed - but if you are willing to experiment a little, you could probably get this working without touching any code.
In layman's terms, imagine it like this: there are certain parts of your model that are invisible and that can be toggled on/off using properties. You would use this mechanism to dynamically enable/disable loading of models. And you would accomplish that by having a Nasal function that checks for each required model file, and then sets a true/false property for the switch animation.