I’m writing a blender python mesh exporter, and when trying to get the material index of a polygon, I come across some odd behavior… Basically, I narrowed the problem down to this: I have 2 material variables, and if i print them, they show the exact same material, but blender will not recognize them as equal, which is essential to do a .index on a list. The relevant code is as follows:
print "_",mat,"_ is _",ms.materials,"_" if mat == ms.materials: print "ITIS" else: print "NOT!"
which results in the output:
_ [Material "Material"] _ is _ [Material "Material"] _ NOT!
and the mat and ms variables were derived from the following pieces of code:
mat = Blender.Material.Get()
ol = Blender.Object.Get() ... for obj in ol: ... ms = obj.getData()
I am using blender 2.40 with python 2.4. I would appreciate any feedback =] I spent a good while trying to figure this out, comparing their .class es and everything else. The only thing I can think of is their ‘=’ operators weren’t overloaded [dunno how that works in python]. If anyone needs the blender python .py, it is here:
Thanks for any help =]