Archive 17/01/2023.

Several materails with AngelScript

berrymooor

Hi, simple question:
if i implementing model with one material via AngelScript, it’s look like this:

jack.material = cache.GetResource(“Material”, “mat.xml”);

But how about models with several matarials? How attach second material of model for example?

Dave82

Use the set_materials method which accepts the index of the material.The number of materials should be equal to number of vertex buffers per model

jack.set_materials(0 ,  cache.GetResource(“Material”, “mat.xml”));
jack.set_materials(1 ,  cache.GetResource(“Material”, “mat2.xml”));
jack.set_materials(2 ,  cache.GetResource(“Material”, “mat3.xml”));
Eugene

set_* and get_* methods are internal property accessors.
Just use properties: jack.materials[0]

1vanK

u can use ApplyMaterialList() for models with multiple materials (blender can generate this list)

Modanung