I'm trying to get the material assignments for Redshift materials but I'm getting inconsistent results.
The code is:
material = doc.GetFirstMaterial() while material: assignment_list = material[c4d.ID_MATERIALASSIGNMENTS] print (material.GetName(), assignment_list.GetObjectCount()) material = material.GetNext()
Initially the assignment list shows the correct number of objects. But as soon as you interact the material, e.g. select it or rename it, then it shows 1 extra number of objects:
Not sure how should I get the correct assignment list consistently, does anyone have any ideas?
Here is an example file for convenience: