Maya setting face vertex normals

Ok I ran into a little hiccup with some normal tools I’ve written. I’m going to see if i can share the test scene here, but in the meantime, I figured I would ask to see if anyone has dealt with this before.

The process is that i set vertex normals based on a vector. If the vertex is on a hard edge, I need to set the per-face-per-vertex normal:


## mesh is an instance of MFnMesh
mesh.setFaceVertexNormal(normal, fid, vid)

All is well, whoever doing this will make all edges connected to the face/vertex pair hard, so I need to go back and turn these back to soft edges where necessary. Here comes the problem, if i set the edge to soft, it will SOMETIMES reset the vertex normal of the vert i just set.

It doesn’t happen all the time though. I have a test scene with seemingly identical topology and one edge resets the normal while the other doesn’t

I’ve hit a wall. Any ideas out there?

Thanks

Do you have history left on the mesh? Could it be that the way you have constructed your loops that you’re assuming the vert or vertface IDs have not changed when in fact you’ve done something that has changed them? IE, splitting one normal into two?

What do your UV’s look like? Any common situation on the problematic faces (ie are they always at UV seams, or never, or something)?

Ok so both edges are on UV seams so that didn’t yield anything, but it did get me looking at UVs. I was unaware that UVs would play any role in the normals of the mesh. Anyhow, if i run my functions and set the normals the way i need and revert the old and one edge has correct normals and the other is reset, at this point if i move any of the UVs the incorrect normals will correct themselves. Not moving the UVs to any particular place, just the instant they move, the normals will correct themselves.

So is it something wrong with the UVs of this particular object? What role do UVs play in normals?

Thanks