unreal.GeometryScript_UVs
¶
- class unreal.GeometryScript_UVs(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
BlueprintFunctionLibrary
Geometry Script Library Mesh UVFunctions
C++ Source:
Plugin: GeometryScripting
Module: GeometryScriptingCore
File: MeshUVFunctions.h
- classmethod add_uv_element_to_mesh(target_mesh, uv_set_index, new_uv_position, defer_change_notifications=False) -> (DynamicMesh, new_uv_element_id=int32, is_valid_uv_set=bool)¶
Adds a new UV Element to the specified UV Channel of the Mesh and returns a new UV Element ID.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
new_uv_position (Vector2D) –
defer_change_notifications (bool) –
- Returns:
new_uv_element_id (int32):
is_valid_uv_set (bool):
- Return type:
tuple
- classmethod auto_generate_patch_builder_mesh_u_vs(target_mesh, uv_set_index, options, debug=None) DynamicMesh ¶
Computes new UVs for the specified UV Channel using PatchBuilder method in the Options, and optionally packs.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
options (GeometryScriptPatchBuilderOptions) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod auto_generate_x_atlas_mesh_u_vs(target_mesh, uv_set_index, options, debug=None) DynamicMesh ¶
Computes new UVs for the specified UV Channel using XAtlas, and optionally packs.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
options (GeometryScriptXAtlasOptions) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod compute_mesh_local_uv_param(target_mesh, center_point, center_point_triangle_id, radius=1.000000, use_interpolated_normal=False, tangent_y_direction=[0.000000, 0.000000, 0.000000], uv_rotation_deg=0.000000, debug=None) -> (DynamicMesh, vertex_i_ds=Array[int32], vertex_u_vs=Array[Vector2D])¶
Compute local UV parameterization on TargetMesh vertices around the given CenterPoint / Triangle. This method uses a Discrete Exponential Map parameterization, which unwraps the mesh locally based on geodesic distances and angles. The CenterPoint will have UV value (0,0), and the computed vertex UVs will be such that Length(UV) == geodesic distance.
- Parameters:
target_mesh (DynamicMesh) –
center_point (Vector) – the center point of the parameterization. This point must lie on the triangle specified by CenterPointTriangleID
center_point_triangle_id (int32) – the ID of the Triangle that contains CenterPoint
radius (double) – the parameterization will be computed out to this geodesic radius
use_interpolated_normal (bool) – if true (default false), the normal frame used for the parameterization will be taken from the normal overlay, otherwise the CenterPointTriangleID normal will be used
tangent_y_direction (Vector) –
uv_rotation_deg (double) –
debug (GeometryScriptDebug) –
- Returns:
vertex_i_ds (Array[int32]): output list of VertexIDs that UVs have been computed for, ie are within geodesic distance Radius from the CenterPoint
vertex_u_vs (Array[Vector2D]): output list of Vertex UVs that corresponds to VertexIDs
- Return type:
tuple
- classmethod copy_mesh_to_mesh_uv_layer(copy_from_uv_mesh, to_uv_set_index, copy_to_mesh, only_uv_positions=True, debug=None) -> (DynamicMesh, copy_to_mesh=DynamicMesh, copy_to_mesh_out=DynamicMesh, found_topology_errors=bool, is_valid_uv_set=bool)¶
Transfer the 3D vertex positions and triangles of CopyFromUVMesh to the given UV Channel identified by ToUVChannel of CopyToMesh. 3D positions (X,Y,Z) will be copied as UV positions (X,Y), ie Z is ignored.
bOnlyUVPositions controls whether only UV positions will be updated, or if the UV topology will be fully replaced. When false, CopyFromUVMesh must currently have a MaxVertexID <= that of the UV Channel MaxElementID When true, CopyFromUVMesh must currently have a MaxTriangleID <= that of CopyToMesh
- Parameters:
copy_from_uv_mesh (DynamicMesh) –
to_uv_set_index (int32) –
copy_to_mesh (DynamicMesh) –
only_uv_positions (bool) – if true, only (valid, matching) UV positions are updated, a full new UV topology is created
debug (GeometryScriptDebug) –
- Returns:
copy_to_mesh (DynamicMesh):
copy_to_mesh_out (DynamicMesh):
found_topology_errors (bool):
is_valid_uv_set (bool): will be returned false if To UV Channel is not available
- Return type:
tuple
- classmethod copy_mesh_uv_layer_to_mesh(copy_from_mesh, uv_set_index, copy_to_uv_mesh, debug=None) -> (DynamicMesh, copy_to_uv_mesh=DynamicMesh, copy_to_uv_mesh_out=DynamicMesh, invalid_topology=bool, is_valid_uv_set=bool)¶
Copy the 2D UVs from the given UV Channel in CopyFromMesh to the 3D vertex positions in CopyToUVMesh, with the triangle mesh topology defined by the UV Channel. Generally this “UV Mesh” topology will not be the same as the 3D mesh topology. PolyGroup IDs and Material IDs are preserved in the UVMesh.
2D UV Positions are copied to 3D as (X, Y, 0)
CopyMeshToMeshUVChannel will copy the 3D UV Mesh back to the UV Channel. This pair of functions can then be used to implement UV generation/editing via other mesh functions.
- Parameters:
copy_from_mesh (DynamicMesh) –
uv_set_index (int32) –
copy_to_uv_mesh (DynamicMesh) –
debug (GeometryScriptDebug) –
- Returns:
copy_to_uv_mesh (DynamicMesh):
copy_to_uv_mesh_out (DynamicMesh):
invalid_topology (bool): will be returned true if any topological issues were found
is_valid_uv_set (bool): will be returned false if UVSetIndex is not available
- Return type:
tuple
- classmethod copy_uv_set(target_mesh, from_uv_set, to_uv_set, debug=None) DynamicMesh ¶
Copy the data in one UV Channel to another UV Channel on the same Target Mesh.
- Parameters:
target_mesh (DynamicMesh) –
from_uv_set (int32) –
to_uv_set (int32) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod get_mesh_per_vertex_u_vs(target_mesh, uv_set_index, debug=None) -> (DynamicMesh, uv_list=GeometryScriptUVList, is_valid_uv_set=bool, has_vertex_id_gaps=bool, has_split_u_vs=bool)¶
Get a list of single vertex UVs for each mesh vertex in the TargetMesh, derived from the specified UV Channel. The UV Channel may store multiple UVs for a single vertex (along UV seams) In such cases an arbitrary UV will be stored for that vertex, and bHasSplitUVs will be returned as true
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) – index of UV Channel to read
debug (GeometryScriptDebug) –
- Returns:
uv_list (GeometryScriptUVList): output UV list will be stored here. Size will be equal to the MaxVertexID of TargetMesh (not the VertexCount!)
is_valid_uv_set (bool): will be set to true if the UV Channel was valid
has_vertex_id_gaps (bool): will be set to true if some vertex indices in TargetMesh were invalid, ie MaxVertexID > VertexCount
has_split_u_vs (bool): will be set to true if there were split UVs in the UV Channel
- Return type:
tuple
- classmethod get_mesh_triangle_uv_element_i_ds(target_mesh, uv_set_index, triangle_id) -> (DynamicMesh, triangle_uv_elements=IntVector, have_valid_u_vs=bool)¶
Returns the UV Element IDs associated with the three vertices of the triangle in the specified UV Channel. If the Triangle does not exist in the mesh or if no UVs are set in the specified UV Channel for the triangle, bHaveValidUVs will be returned as false.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
triangle_id (int32) –
- Returns:
triangle_uv_elements (IntVector):
have_valid_u_vs (bool):
- Return type:
tuple
- classmethod get_mesh_uv_element_position(target_mesh, uv_set_index, element_id) -> (DynamicMesh, uv_position=Vector2D, is_valid_element_id=bool)¶
Returns the UV Position for a given UV Element ID in the specified UV Channel. If the UV Set or Element ID does not exist, bIsValidElementID will be returned as false.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
element_id (int32) –
- Returns:
uv_position (Vector2D):
is_valid_element_id (bool):
- Return type:
tuple
- classmethod get_mesh_uv_size_info(target_mesh, uv_set_index, selection, only_include_valid_uv_tris=True, debug=None) -> (DynamicMesh, mesh_area=double, uv_area=double, mesh_bounds=Box, uv_bounds=Box2D, is_valid_uv_set=bool, found_unset_u_vs=bool)¶
Compute information about dimensions and areas for a UV Set of a Mesh, with an optional Mesh Selection
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) – index of UV Channel to query
selection (GeometryScriptMeshSelection) – subset of triangles to process, whole mesh is used if selection is not provided
only_include_valid_uv_tris (bool) – if true, only triangles with valid UVs are included in 3D Mesh Area/Bounds
debug (GeometryScriptDebug) –
- Returns:
mesh_area (double): output 3D area of queried triangles
uv_area (double): output 2D UV-space area of queried triangles
mesh_bounds (Box): output 3D bounding box of queried triangles
uv_bounds (Box2D): output 2D UV-space bounding box of queried triangles
is_valid_uv_set (bool): output flag set to false if UV Channel does not exist on the target mesh. In this case Areas and Bounds are not initialized.
found_unset_u_vs (bool): output flag set to true if any of the queried triangles do not have valid UVs set
- Return type:
tuple
- classmethod recompute_mesh_u_vs(target_mesh, uv_set_index, options, selection, debug=None) DynamicMesh ¶
Recomputes UVs in the UV Channel for a Mesh based on different types of well-defined UV islands, such as existing UV islands, PolyGroups, or a subset of the mesh based on a non-empty Selection.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
options (GeometryScriptRecomputeUVsOptions) –
selection (GeometryScriptMeshSelection) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod repack_mesh_u_vs(target_mesh, uv_set_index, repack_options, debug=None) DynamicMesh ¶
Packs the existing UV islands in the specified UV Channel into standard UV space based on the Repack Options.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
repack_options (GeometryScriptRepackUVsOptions) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod rotate_mesh_u_vs(target_mesh, uv_set_index, rotation_angle, rotation_origin, selection, debug=None) DynamicMesh ¶
Update all the selected UV values in the specified UV Channel by a rotation of Rotation Angle (in degrees) relative to the Rotation Origin. If the provided Selection is empty, the update is applied to the entire UV Channel.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
rotation_angle (float) –
rotation_origin (Vector2D) –
selection (GeometryScriptMeshSelection) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod scale_mesh_u_vs(target_mesh, uv_set_index, scale, scale_origin, selection, debug=None) DynamicMesh ¶
Update all selected UV values in the specified UV Channel by Scale, mathematically the new value is given by (UV - ScaleOrigin) * Scale + ScaleOrigin If the provided Selection is empty, the update is applied to the entire UV Channel.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
scale (Vector2D) –
scale_origin (Vector2D) –
selection (GeometryScriptMeshSelection) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod set_mesh_triangle_u_vs(target_mesh, uv_set_index, triangle_id, u_vs, defer_change_notifications=False) -> (DynamicMesh, is_valid_triangle=bool)¶
Sets the UVs of a mesh triangle in the given UV Channel. This function will create new UV elements for each vertex of the triangle, meaning that the triangle will become an isolated UV island.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
triangle_id (int32) –
u_vs (GeometryScriptUVTriangle) –
defer_change_notifications (bool) –
- Returns:
is_valid_triangle (bool):
- Return type:
- classmethod set_mesh_triangle_uv_element_i_ds(target_mesh, uv_set_index, triangle_id, triangle_uv_elements, defer_change_notifications=False) -> (DynamicMesh, is_valid_triangle=bool)¶
Sets the UV Element IDs for a given Triangle in the specified UV Channel, ie the “UV Triangle” indices. This function does not create new UVs, the provided UV Elements must already. The UV Triangle can only be set if the resulting topology would be valid, ie the Elements cannot be shared between different base Mesh Vertices, so they must either be unused by any other triangles, or already associated with the same mesh vertex in other UV triangles. If any conditions are not met, bIsValidTriangle will be returned as false.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
triangle_id (int32) –
triangle_uv_elements (IntVector) –
defer_change_notifications (bool) –
- Returns:
is_valid_triangle (bool):
- Return type:
- classmethod set_mesh_u_vs_from_box_projection(target_mesh, uv_set_index, box_transform, selection, min_island_tri_count=2, debug=None) DynamicMesh ¶
Using Box Projection, update the UVs in the UV Channel for an entire mesh or a subset defined by a non-empty Selection.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
box_transform (Transform) –
selection (GeometryScriptMeshSelection) –
min_island_tri_count (int32) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod set_mesh_u_vs_from_cylinder_projection(target_mesh, uv_set_index, cylinder_transform, selection, split_angle=45.000000, debug=None) DynamicMesh ¶
Using Cylinder Projection, update the UVs in the UV Channel for an entire mesh or a subset defined by a non-empty Selection.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
cylinder_transform (Transform) –
selection (GeometryScriptMeshSelection) –
split_angle (float) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod set_mesh_u_vs_from_planar_projection(target_mesh, uv_set_index, plane_transform, selection, debug=None) DynamicMesh ¶
Scale of PlaneTransform defines world-space dimension that maps to 1 UV dimension
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
plane_transform (Transform) –
selection (GeometryScriptMeshSelection) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod set_mesh_uv_element_position(target_mesh, uv_set_index, element_id, new_uv_position, defer_change_notifications=False) -> (DynamicMesh, is_valid_element_id=bool)¶
Sets the UV position of a specific ElementID in the given UV Set/Channel If the UV Set or Element ID does not exist, bIsValidElementID will be returned as false.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
element_id (int32) –
new_uv_position (Vector2D) –
defer_change_notifications (bool) –
- Returns:
is_valid_element_id (bool):
- Return type:
- classmethod set_num_uv_sets(target_mesh, num_uv_sets, debug=None) DynamicMesh ¶
Set the number of UV Channels on the Target Mesh. If not already enabled, this will enable the mesh attributes.
- Parameters:
target_mesh (DynamicMesh) –
num_uv_sets (int32) –
debug (GeometryScriptDebug) –
- Return type:
- classmethod translate_mesh_u_vs(target_mesh, uv_set_index, translation, selection, debug=None) DynamicMesh ¶
Update all selected UV values in the specified UV Channel by adding the Translation value to each. If the provided Selection is empty, the Translation is applied to the entire UV Channel.
- Parameters:
target_mesh (DynamicMesh) –
uv_set_index (int32) –
translation (Vector2D) –
selection (GeometryScriptMeshSelection) –
debug (GeometryScriptDebug) –
- Return type: