UV Export: add option to export UV tiles #104940
@ -213,11 +213,11 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
# Ignore UVs at corners - precisely touching the right or upper edge
|
||||
pioverfour marked this conversation as resolved
Outdated
|
||||
# of a tile should not load its right/upper neighbor as well.
|
||||
# From intern/cycles/scene/attribute.cpp
|
||||
u, v = (uv[0], uv[1])
|
||||
x, y = (floor(u), floor(v))
|
||||
if (x > 0 and (u < x + 1e-6)):
|
||||
u, v = uv[0], uv[1]
|
||||
x, y = floor(u), floor(v)
|
||||
if x > 0 and u < x + 1e-6:
|
||||
x -= 1
|
||||
if (y > 0 and (v < y + 1e-6)):
|
||||
if y > 0 and v < y + 1e-6:
|
||||
y -= 1
|
||||
tiles.add((x, y))
|
||||
return tiles
|
||||
|
Loading…
Reference in New Issue
Block a user
There's a small gotcha here in that UV coords that "touch" the upper edge or the right edge of a tile might be categorized as existing in the tile above or to the right of its "real" tile. I.e. export the default Cube in UDIM layout and you'll get 2 tiles, 1001 and 1011.
You can mimic what's done in Cycles here to lie about such UV coords: https://projects.blender.org/blender/blender/blame/branch/main/intern/cycles/scene/attribute.cpp#L461
This works well on the cube!