Maxscript to check for UVs outside 0-1 space?

I'm looking for a script that would check for UVs outside of the 0-1 space and then alert me if it found any. It would be really great if I could select multiple objects, run the script and then get a message that identifies the offending objects. In a perfect world it would also select the UV elements that have any vertices outside the 0-1 space. Any help would be appreciated, thanks!


  • leechdemon
    Without a maxscript, you could probably just apply a generic texture... say, a 2pxx2px black square, and then turn off tiling. Set your Diffuse to neon pink, and anything that shows up pink in the viewport is out of 0-1.

    Try this one:
    for obj in (selection as array) do
    ObjectError = 0
    for i = 1 to obj.modifiers[#unwrap_uvw].numbervertices() do
    ThisVert = obj.modifiers[#unwrap_uvw].getVertexposition 0 i
    If ObjectError == 0 then
    if (ThisVert [1]<0) then
    (ObjectError = 1)
    if (ThisVert [1]>1) then
    (ObjectError = 1)
    if (ThisVert [2]<0) then
    (ObjectError = 1)
    if (ThisVert [2]>1) then
    (ObjectError = 1)
    If ObjectError==1 then
    (Print ("Object '" + + "' is out of the 0-1 UV Range."))
    (Print ("Object '" + + "' is all set!"))
    Select the objects you want to test and open up the listener. Run the script, and it'll tell you what objects are 0-1 and which are not. It assumes a collapsed mesh with uvw_unwrap on top... not sure if it'll work outside of that.
  • miauu
    Offline / Send Message
    miauu polycounter lvl 8
    Go here and try my script.
    The script will add UVW_Unwrap modifier to selected objects, so there is no need you add it manualy. :)
  • erik!
    Oh man thanks for the hard work dudes! However PatJS is a boss and wrote a very delicious script last night that works perfectly. I'll have to converse with the fine gentleman to see if he's willing to release it into the wild. Thanks again!
Sign In or Register to comment.