Detecting Side Count Of Ploygons?

Hi All,

I thought a sure fire way to detect the number of sides of a polygon was via the vertex count of a polygon.

This does not seem to be the case when you mix triangles and quads.

This short script counts the number of sides for each face in the mesh. As you can see by the image there are two quads and two triangles and no duplicate vertices.

However the script gets it wrong. It prints out that there are in fact 3 quads and 1 triangle which is clearly not what is displayed in the viewport.

What am I doing wrong? Is this an API bug?


Attachments

27_arnold_quads_triangle_colors_1a.blend (86.7 KB)

One of your triangles is actually a quad.

Attachments


What do you wanna do with this info?
Do you want to find certain faces only? Or count them by type all together?

Check my addon:
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Mesh/Face_Info_Select

Although it is not recommended to be used with heavy meshes, as the counting happens on every redraw…

@kastoria: Ah, I guess I was just using my eyes instead of counting the vertex points.

What do you wanna do with this info?

I am working on an exporter for the Arnold render system and have ran into a snag specifying a mix of triangles, quads and multiple shaders.

Blender Internal renders like this.


But Arnold renders like this.


So somehow a material_index is getting flipped when it shouldn’t…?

could it be a mismatch in indices? Blender is zero-based, not sure about Arnold.

It was my mistake. I was specifying the shaders in the ginstance node instead of the polymesh. Arnold needs multi-material shaders specified in the polymesh 1st before you can override them in a ginstance. I am still learning about that render system.