Number of indices for a face

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

damix
Posts: 21
Joined: Wed Dec 07, 2011 4:42 pm

Number of indices for a face

Postby damix » Wed May 23, 2012 8:00 am

Hi everybody, I'm not sure this is the right place to report this. However I was browsing the documentation of bpy.types.MeshPolygon and I found the following. I think the the number 3 is not correct, since there may be more than 3 vertices.

vertices
Vertex indices

Type : int array of 3 items in [0, inf], default (0, 0, 0)

I'll be happy to report this in the appropriate forum or wiki if it is really an error.

Thank you for all your work on this amazing software.

Dario "damix" D'Amico

ldo
Posts: 544
Joined: Sun Nov 07, 2010 11:30 pm
Location: Hamilton, New Zealand

Postby ldo » Wed May 23, 2012 11:19 am

Yup:

Code: Select all

>>> list(bpy.data.meshes["Cube"].polygons[0].vertices)
[4, 5, 1, 0]


I don’t think any of the Blender developers read these forums, to be honest. Not sure if this is a code bug; perhaps documentation corrections should be mentioned in the “Foundation and Websites” forum.

ideasman
Posts: 1000
Joined: Tue Feb 25, 2003 2:37 pm

Postby ideasman » Wed May 23, 2012 8:01 pm

They are vertex index values.

Code: Select all

me = bpy.data.meshes["Cube"]
for v_index in me.polygons[0].vertices:
    print(me.vertices[v_index].co)

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed May 23, 2012 9:37 pm

it's not a real docu error, as property list get generated automatically from .c scripts (makesrna.exe?)

Polygon.vertices is initialized as 3 element RNA array, but flagged to be dynamical. The generator doesn't seem to take this flag into account.
I'm sitting, waiting, wishing, building Blender in superstition...

damix
Posts: 21
Joined: Wed Dec 07, 2011 4:42 pm

Postby damix » Thu May 24, 2012 8:36 am

Thank you for checking!


Return to “Python”

Who is online

Users browsing this forum: Bing [Bot] and 0 guests