Crash - using MFnMesh::setFaceVertexNormals

Crash - using MFnMesh::setFaceVertexNormals

golaem
Enthusiast Enthusiast
513 Views
2 Replies
Message 1 of 3

Crash - using MFnMesh::setFaceVertexNormals

golaem
Enthusiast
Enthusiast

Hello,

 

We have a mesh translator for importing/exporting from/to our own format. When creating the mesh without UVs, via create() method, MStatus returns kSuccess.

 

Once this is done, the normals are set via setFaceVertexNormals (in one call for efficiency). 

The documentation of the methods mentions that 

"Set Normals for the given face/vertex pairs. Note that if there is a vertex-face mismatch anywhere in the list, this method will return an error, and not set any of the normals.". However, we are experiencing a crash if we have a badly formed polygon.

 

For example, we have a customer case, were the last face of a mesh has some vertexIDs looking like '10,11,12,10,13', which does look like a poor face (notice the loop on four first IDs, then adding one). This asset was exported from a maya mesh already having this bad format. It is odd that the symmetric method getFaceVertexNormals() for a given poly does return the normals for this face.

 

Using setFaceVertexNormal() (single normal version) on each face allowed to determine that this face is faulty : it does return kInvalidParameter (& internal code 18) when setting this face normal. But the array based setFaceVertexNormals() crashes with the same content.

 

Is this crash already logged on your side ?

How could we reliably detect unsuitable geometry before this crash ?

 

0 Likes
514 Views
2 Replies
Replies (2)
Message 2 of 3

golaem
Enthusiast
Enthusiast

Additional details : when exporting to custom file format, some normals are unnormalized on this face. Back at import time, setFaceVertexNormal on this face fails at the first vertex (with a correct normal value, but it is part of the partially degenerated face).

On the setFaceVertexNormals (array version), the crash occurs even if the normals are cleaned up to normalized values.

0 Likes
Message 3 of 3

lanh.hong
Alumni
Alumni

Hi golaem,

 

Sorry for the late response. Can you share a reproducible sample for me to help?

 

Thanks,

Lanh


Lanh Hong
Developer Technical Services
Autodesk Developer Network



0 Likes