Editing mesh_poly_reduce script


I have been studying scripts in Blender and I think many of you know the script mesh_poly_reduce:

My question is: how hard is to change this script? I wanted to include some lines that could allow me to save the vertexes that were merged to simplify the mesh. But I want to do this per face. What I actually want to do is save the relationship between the dense mesh and the sparse mesh, in a way that I can know which vertexes were removed to form the simplified patch, but I need this information per face. So, let’s say that to form the new face X in the sparse mesh, I used the neighborhood vertexes of faces x1 and x2 from the dense mesh. I want to save the vertexes from x1 and x2 used to form the patch X. Is this possible? :rolleyes:
If you have some suggestion or a better solution than this, it would be very helpful too.

Thanks in advance,

Tim M.