Copy .obj file just before loading, to replace dataRefs and texture.
These routines make a copy of an .obj
file just before it gets loaded by X-Plane. This way we can replace dataRefs and textures.
xsb_aircraft.txt
formats vary by now out in the wild. For example, X-CSL/X-IvAp used to defined texture on the OBJ8
line. X-Plane, especially for instancing, cannot replace textures on the fly. The solution is to copy the .obj
file, replacing the up to two lines defining the texture to use, and then only have it loaded by X-Plane.
- CSL-Models might not use correct dataRefs as supported by XPMP2. For example are the widely used Bluebell models known to have translated only a limited set of dataRefs from their World Traffic origin into the libxplanemp world. XPMP2 now supports a lot more dataRefs. Replacing dataRef names in those models unlocks a number of feature like rotating props/rotors, turning wheels, or reversers.
- See also
- https://twinfan.github.io/XPMP2/XSBAircraftFormat.html for the
xsb_aircraft.txt
format definition as supported by XPMP2.
-
https://twinfan.github.io/XPMP2/CSLdataRefs.html for a list of animation dataRefs supported by XPMP2. And beyond that you can add even more using the XPMPAddModelDataRef() function.
- Author
- Birger Hoppe
- Copyright
- (c) 2020 Birger Hoppe
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.