0
$\begingroup$

I would like to understand if it is possible to determine and how, through Python, which of the materials of the ob.data.materials is really applied to the object of type Surface/Curve

This is my example The Brick material is what you see, while the other (Mat in this case) is not applied but is in the ob.data.materials

I would like to understand through Python how to check which material is really applied

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ I think you could go through splines and check its material index, something like ms=[s.material_index for s in ob.data.splines] should return a list of indices and show how many times a material is used... then check how many slots you have and delete those that are not in the list... and I think you need to remove them backwards, from last to first $\endgroup$
    – alambre
    Feb 20, 2022 at 0:55
  • $\begingroup$ Hey, that's it, yes it is! I think we can work in that direction. I am used to Mesh type, it is the first time that I try on objects of different types. I am not very familiar with the APIs of those objects. Excellent suggestion to continue my work. $\endgroup$
    – Noob Cat
    Feb 20, 2022 at 4:23

0

You must log in to answer this question.

Browse other questions tagged .