Detecting overlapping Uvs on a certain uvset

Detecting overlapping Uvs on a certain uvset

Craig_Lamorte
Advocate Advocate
1,855 Views
8 Replies
Message 1 of 9

Detecting overlapping Uvs on a certain uvset

Craig_Lamorte
Advocate
Advocate

Hi, 

 

I am trying to write some code that will detect if there are overlapping Uvs only on the 2nd uvset (not map1).  I did find this command polyUVOverlap(selected_uvs, oc=True), and it appears to work if there is only one uvset, and will properly return any uvs that are overlapping.  However when I am working with 2 uv_sets on a mesh, and i select that second uv set and it's uvs, no matter what it will return nothing.  But it will return something if its selected on map1.  Anyone have any ideas?

0 Likes
Accepted solutions (1)
1,856 Views
8 Replies
Replies (8)
Message 2 of 9

mspeer
Consultant
Consultant

Hi!

 

You need first to define the "current" UV Set.

MEL example:

polyUVSet -cuv -uvSet "uvSet";

 

0 Likes
Message 3 of 9

Craig_Lamorte
Advocate
Advocate

oh yes, I do define which uv set before i select the Uvs and run the polyoverlap command.

 

polyUVSet(uvSet='uvSet', currentUVSet=True)

 

If i define the uvSet as 'map1' it will detect overlapping uvs, but not when i make it select the 2nd uv set

0 Likes
Message 4 of 9

mcw0
Advisor
Advisor

First thought would be to duplicate your mesh.  Copy the second uvSet to map1.  Do your detection and transfer the results back to your original mesh.

0 Likes
Message 5 of 9

mspeer
Consultant
Consultant

Hi!

 

What Maya version are you using?

(Here it works fine with Maya 2020.3)

 

Please provide an example scene and the complete script for the second UV Set, which does not work.

0 Likes
Message 6 of 9

Craig_Lamorte
Advocate
Advocate

hmm Im having troubles now getting the pm.polyUVOverlap command even working on a more complicated mesh with just 1 uvset.  I messed up the uvs so they are definitely overlapping each other and run this

mesh = pm.ls(sl=True)
uvs = pm.polyListComponentConversion(mesh, toUV=True)
pm.select(uvs)
print pm.polyUVOverlap(uvs, oc=True)

 

with the mesh selected it returns None everytime.

0 Likes
Message 7 of 9

mcw0
Advisor
Advisor
Accepted solution

polyUVOverlap takes faces.  Your polyListComponentConversion is returning uvs.

0 Likes
Message 8 of 9

Craig_Lamorte
Advocate
Advocate

ohhhh, oops.  Thats where it was messing up, thanks.  I guess I assumed it would be fed UVS, not faces. Thanks

0 Likes
Message 9 of 9

mspeer
Consultant
Consultant

Hi!

 

@Craig_Lamorte  and @mcw0 

Edges would also work. Overlapping is really checking for individual overlapping areas (faces) or lines (edges).

This does not work with points.

0 Likes