How do I split a bmesh and fix uvs?

Without bmesh, I used seams_from_islands(), then split the mesh by its seams. But it was slow, so I wanted to do it with bmesh instead. I have the mesh split, but the uvs don’t fix themselves. I thought of saving the uv cords on each side of the split before it happens, then fixing it after the split, but I don’t know how I could tell which loops belong to the uvs. Is there any way I could do this?

The only way is to compare UV positions- uv’s don’t have any other identifiable information you can reference since it’s just ‘extra data’ stuffed into a loop. You will run into problems with this method if you have stacked UVs (so- coordinates that are cospatial). seams_from_islands can indeed be slow if you have a ridiculous number of islands but the alternatives are all much worse (at least from my experience).

thanks, but the main problem is all the operations i have to do to do this without bmesh. its just for export, so i want to preserve the state of the scene before i do the splitting, so im duplicating the object, doing the seams thing on it, getting the data then deleting it. with a larger mesh it took like 20 seconds to do everything. is there anything i can do to speed it up?

I decided to manually reset the state of the scene by removing doubles and saving the seams before seams_from_islands() and resetting them.