Hi ladies and gentlemen,
I'm adding a decimate modifier to all objects in my scene and try to change the ratio-property afterwards on demand. I want all my objects to have a maximum of 1000 polygons, so my code for Blender looks as follows:
for obj in bpy.data.objects:
modDec = obj.modifiers.new("dec", type = "DECIMATE")
if (modDec.face_count > 1000):
modDec.ratio = 1000 / modDec.face_count
I actually thought this was pretty simple and straightforward but it won't work. All my objects get the modifier but the ratio remains "1". If I leave out the if-statement and just write something like modDec.ratio = 0.5
it works...the objects get the modifier and the ratio is actual 0.5. I don't get what's wrong with my code. Can someone please help me with this?
[EDIT] I forgot to mention that I work with Blender 2.78b. Sorry for that.