Jump to content

saving loaded materials to world file


photo

Recommended Posts

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

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

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
  • 2 weeks later...
×
×
  • Create New...