Skip to content

UVMapping

4 tools for UV channels and UV health.

Back to the index.

clear_uv_channel

Destructive Idempotent

Drop every UV from one UV channel of LOD 0 of a UStaticMesh asset: LOD 0 (its source model, or its render data when it has none) is copied to a transient dynamic mesh, the channel's UVs are cleared there, and the copy is written back over LOD 0 in one undo step and the package saved. The channel itself stays, so the channel count does not change, and an already-empty channel is still written and saved. A uv_channel LOD 0 lacks, a mesh with no source model, a path that does not load or a mesh under /Engine is an error and nothing changes; a failed save makes success false. Inventory first: list_uv_channels; one triangle: set_triangle_uvs; channel count of a DynamicMeshActor: set_num_uv_channels.

Parameter Type Required Description
static_mesh_path string yes Asset path to the UStaticMesh
uv_channel number no Index of the UV channel to clear (0-based; default 0); one LOD 0 does not have is an error

Returns: { static_mesh_path, uv_channel, uv_channel_count_before, uv_channel_count_after, cleared, saved }

get_uv_health_report

Read-only

Check the layout of one UV channel of one LOD of a static mesh asset, reading its built render data: in_unit_square_triangle_ratio (share of triangles with all three UVs inside 0..1), overlapping_triangle_count (triangles whose UV triangle overlaps another one's with positive area; a shared edge or corner does not count, so a clean unwrap gives 0 and a lightmap channel should), overlap_test_complete, approx_unique_islands, plus vertex and triangle counts, lightmap_coordinate_index and is_lightmap_hard_failing (no lightmap index set, or no UV channels). Pick the LOD and channel with list_uv_channels first; change the lightmap channel with set_static_mesh_lightmap, and edit the asset's UVs with set_triangle_uvs or clear_uv_channel. Read-only and idempotent; nothing dirtied or saved. A mesh that does not load, or a LOD or channel out of range, is an error.

Parameter Type Required Description
mesh_path string yes Content path of the UStaticMesh asset, e.g. "/Game/Meshes/SM_Rock" (the object path "/Game/Meshes/SM_Rock.SM_Rock" also works); find_assets_by_name finds it
lod_index integer no 0-based LOD to inspect (default 0), below the total_lods list_uv_channels reports
uv_channel integer no 0-based UV channel to inspect (default 0), below that LOD's uv_channel_count from list_uv_channels

Returns: { mesh_path, lod_index, uv_channel, vertex_count, triangle_count, lightmap_coordinate_index, no_lightmap_configured: bool, is_lightmap_hard_failing: bool, overlapping_triangle_count: int, overlap_test_complete: bool, in_unit_square_triangle_ratio, approx_unique_islands, per_triangle_iteration_error?: string } -- overlapping_triangle_count: triangles overlapping another in UV space with positive area (a lower bound when overlap_test_complete is false: the test stops after 20 million pair visits); approx_unique_islands counts distinct UV positions (rounded to 4 decimals), not islands; when per_triangle_iteration_error is set the per-triangle counters stay 0.

list_uv_channels

Read-only

List the UV channels of a static mesh asset per LOD: for each LOD uv_channel_count, vertex_count, triangle_count, the mesh's lightmap_coordinate_index and has_lightmap (that index names an existing channel), and one entry per channel with is_lightmap. Use it first to see which LODs and channels exist; then get_uv_health_report checks one channel's layout, get_static_mesh_geometry_stats measures UV area, and set_static_mesh_lightmap changes the lightmap channel. Read-only and idempotent: no undo step, nothing dirtied or saved. Channel and vertex counts come from the built render data, triangle_count from the LOD's source mesh description (0 when it has none); each channel's vertex_count is the LOD's vertex count. A mesh that does not load, or a lod_index past the last LOD, is an error.

Parameter Type Required Description
mesh_path string yes Content path of the UStaticMesh asset, e.g. "/Game/Meshes/SM_Rock" (the object path "/Game/Meshes/SM_Rock.SM_Rock" also works); find_assets_by_name finds it
lod_index integer no Optional 0-based LOD to inspect, or -1 to list every LOD (default -1); total_lods in the reply says how many exist, and one past the last is an error

Returns: { mesh_path: string, total_lods: int, lods: [{lod_index, uv_channel_count, vertex_count, triangle_count, lightmap_coordinate_index, has_lightmap, channels: [{channel, is_lightmap, vertex_count}]}] }

set_triangle_uvs

Destructive Idempotent

Set the three UV corners of one triangle in one UV channel of LOD 0 of a UStaticMesh asset, a granular edit without a repack: LOD 0 (its source model, or its render data when it has none) is copied to a transient dynamic mesh, the triangle gets three new UV elements there, so it becomes its own UV island, and the copy is written back over LOD 0 in one undo step and the package saved. triangle_id counts the copy's triangles from 0. A negative uv_channel, a triangle or channel the copy lacks, a missing corner, a path that does not load or a mesh under /Engine is an error and nothing changes; a failed save makes success false. Whole channel: clear_uv_channel; check the result: get_uv_health_report.

Parameter Type Required Description
static_mesh_path string yes Asset path to the UStaticMesh
uv_channel number no UV channel index (default 0); a negative one, or one LOD 0 does not have, is an error
triangle_id number no Triangle ID to update (0-based; default 0)
uv0 array no First triangle corner as a [u, v] pair of numbers (required).
uv1 array no Second corner as [u, v] (required).
uv2 array no Third corner as [u, v] (required).

Returns: { static_mesh_path, uv_channel, triangle_id, is_valid_triangle, modified, saved }