set_mesh_material_id
Writes a MaterialID to all or selected triangles of a DynamicMeshActor's live mesh, enabling material assignment for later static mesh conversion.
Instructions
Stamp a MaterialID onto triangles of a DynamicMeshActor's live dynamic mesh. scope='all' repaints every triangle (UGeometryScriptLibrary_MeshMaterialFunctions::ClearMaterialIDs); scope='triangles' repaints the listed triangle IDs (SetMaterialIDOnTriangles). Calls EnableMaterialIDs first, because on a mesh without that attribute the engine drops the write. An ID in triangle_ids that is not a triangle, or an empty mesh, is an error checked before anything is painted. The targeted triangles are read back: applied is true when all of them carry material_id, and the call fails otherwise.
Returns: { actor_name, material_id, scope, triangles_targeted: int, triangles_painted: int, max_material_id_after: int, distinct_material_ids_after: int, applied: bool }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | 'all' (default) or 'triangles'. | |
| actor_name | Yes | Label or name of the target DynamicMeshActor. | |
| material_id | No | MaterialID to write (>= 0). Index into the material list later passed to copy_dynamic_mesh_to_static_mesh. | |
| triangle_ids | No | Required when scope='triangles': array of triangle IDs to repaint (e.g. from select_mesh_triangles). |