carl.sutton Posted January 16, 2012 Share Posted January 16, 2012 Hi, I create my scenes almost completely script based and when I add objects, I load in their materials using either engine.materials.load(materialName) OR loading directly from the material library specified in a .node file. My problem is, is that when I come to save the world by calling engine.console.run("world_save"), everything gets saved, except for the material libraries of the <materials> tag in the .world xml. So when I come to reload my world I get multiple errors of not being able to find materials as the libraries havn't loaded because they weren't written to the world file. So how do declare a material library in the script to enable it to be saved to the .world file? Thanks. Link to comment
carl.sutton Posted January 16, 2012 Author Share Posted January 16, 2012 I've now fixed the issue after finding the engine.materials.addWorldLibrary Link to comment
carl.sutton Posted January 16, 2012 Author Share Posted January 16, 2012 are there world material library equivalent functions for; int engine.materials.findLibrary(string name) string engine.materials.getMaterialName(int library, int num) ...? as I'm having real trouble managing my materials via script now that they are added to the world. Link to comment
frustum Posted January 16, 2012 Share Posted January 16, 2012 Engine materials is just a list of material libraries which will will be loaded/saved at world loading/saving. This list is stored at the begging of the corresponded *.world file. You can manually edit it via engine.materials.* functions. Link to comment
carl.sutton Posted January 16, 2012 Author Share Posted January 16, 2012 Thanks for clarifing that. Its helped me realise that my libraries are saving their directory paths from the project folder which resulted in me incorrectly specifying the wrong library name string, hence I could not find these libraries with those functions. Thanks again Link to comment
manguste Posted January 31, 2012 Share Posted January 31, 2012 Added description to engine.materials for it to be more clear. Link to comment
Recommended Posts