Jump to content

saving loaded materials to world file


photo

Recommended Posts

Posted

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.

Posted

I've now fixed the issue after finding the engine.materials.addWorldLibrary

Posted

are there world material library equivalent functions for;

...?

 

 

as I'm having real trouble managing my materials via script now that they are added to the world.

Posted

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.

Posted

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

  • 2 weeks later...
Posted

Added description to engine.materials for it to be more clear.

×
×
  • Create New...