Notifications
Clear all

[Closed] check if uv shell is out of the first patch?

Hi,
I’d like to know how can I find out if a UV shell is out of range (out of the first UV patch). I’ve made a screenshot to show what I mean.

UV_out_of_range

You can see that one of the UV shells is outside of the first UV patch. I’d like to find out if the object has a UV shell that is out of range.

Thanks

3 Replies

Great! This is just what I needed.

You need to check if any of the vertices of the UV Shells are out of the given range. If 1 vertex is out of this range then the mapping is tiled.

Using either the total width or height of the UV Shells will fail if they are <= 1 and the Shells are shifted. For example a plane with planar mapping that covers the full 0-1 area but is moved out the 0-1 space.

(

	fn HasTiledUVs node t0:0 t1:1 channel:1 =
	(
		tmesh = snapshotasmesh node
		if not (meshop.getmapsupport tmesh channel) do return messagebox "Unsupported Map Channel"
		
		numtverts = meshop.getnummapverts tmesh channel
		
		for j = 1 to numtverts do
		(
			pos = meshop.getmapvert tmesh channel j
			if pos.x < t0 or pos.x > t1 or pos.y < t0 or pos.y > t1 do return true
		)
		return false
	)
	
	HasTiledUVs $
	
)