Mesh¶
11 tools for procedural mesh components: sections, vertices, materials and slicing.
Back to the index.
clear_procedural_mesh¶
Destructive Idempotent
Empty the geometry of one section, or drop every section, of a UProceduralMeshComponent on an editor-world actor found by label, then rebuild its bounds and collision. A single cleared section keeps its slot (remaining_sections unchanged); with section_index omitted or -1 all sections go. Transient: nothing is marked dirty, saved or undoable. A missing actor or component_index is an error, and so is a section_index past the end or below -1. remove_procedural_mesh_component deletes the component itself.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
section_index |
number | no | Optional 0-based section to empty; omit it, or pass -1, to drop all sections |
Returns: { actor_label: string, section_cleared: int, remaining_sections: int }
create_procedural_box_mesh¶
Destructive
Generate a box mesh via UKismetProceduralMeshLibrary::GenerateBoxMesh and push it into a procedural mesh component as a single section: section_index replaces an existing section, or equals the section count to append a new one. A negative section_index, or one past the section count, is an error checked before anything changes.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
section_index |
number | no | Optional target section index, 0 to the current section count (which appends a new section); defaults to 0 |
box_radius |
array | no | Optional [x, y, z] half-extents; defaults to (50, 50, 50) |
create_collision |
boolean | no | Optional bool; defaults to false |
Returns: { actor_label: string, section_index: int, vertex_count: int, triangle_count: int, total_sections: int }
create_procedural_grid_mesh¶
Destructive
Build a flat welded grid of num_x by num_y vertices spaced grid_spacing apart, centred on the component origin in its XY plane with 0-1 UVs and +Z normals, and write it into section_index of a UProceduralMeshComponent on an editor-world actor found by label, replacing that section if it exists, or appending a new one when section_index equals the section count. A missing actor or component, or a section_index that is negative or past the section count, is an error checked before anything changes. num_x * num_y is capped at 1,000,000 vertices (1000 x 1000) because each grid vertex costs about 300 bytes across the generated arrays, the section copy and the render buffers, so one call stays near 300 MB with every index far inside int32; a larger grid, or a count outside int32, is an error too. Transient: nothing is marked dirty, saved or undoable. Add the component with create_procedural_mesh_component first; create_procedural_box_mesh builds a box.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
section_index |
number | no | Optional target section index, 0 to the current section count (which appends a new section); defaults to 0 |
num_x |
number | no | Optional vertex count along X (the grid has num_x - 1 cells; below 2 there is no geometry); defaults to 10; num_x * num_y at most 1000000 |
num_y |
number | no | Optional vertex count along Y (the grid has num_y - 1 cells; below 2 there is no geometry); defaults to 10; num_x * num_y at most 1000000 |
grid_spacing |
number | no | Optional grid cell size in world units; defaults to 16.0 |
create_collision |
boolean | no | Optional bool; defaults to false |
Returns: { actor_label: string, section_index: int, vertex_count: int, triangle_count: int, total_sections: int }
create_procedural_mesh_component¶
Additive Idempotent
Spawn a bare AActor labelled actor_label in the editor world with a new UProceduralMeshComponent as its root, the target the procedural-mesh tools find by label; spawn_actor has no bare actor, and add_component_to_actor adds a PMC to an existing one. The new actor stands at location (the origin when omitted; a location that is not 3 numbers is refused) and the PMC is an instance component, so save_level keeps both; one undo step, the level marked dirty, not saved. Idempotent: an actor already labelled actor_label that has a PMC is returned with reused:true and is not moved (location in the reply is where it stands). A label held by an actor WITHOUT a PMC is an error, since the procedural-mesh tools would find that actor first, and so is a label that is "None" or blank; nothing is spawned then.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label for the new actor; the procedural-mesh tools find the actor by it. An actor that already carries it is reused when it has a PMC and refused when it has none (those tools would find it first); a label that is not a valid actor label ("None", blank) is refused. Nothing is spawned on a refusal. |
location |
array | no | Optional [x, y, z] world location of a new actor; defaults to (0,0,0). A reused actor is not moved. |
Returns: { actor_label: string, actor_name: string, component_name: string, component_index: int, section_count: int, reused: bool, location: [number, number, number] }
get_procedural_mesh_info¶
Read-only
Read a summary of one procedural mesh component on an editor-world actor, without changing it: the section count, two collision settings (use_complex_as_simple_collision, use_async_cooking) and, per section, its index, vertex and triangle counts, whether it is visible and whether it has collision. Use it to find the section_index the section tools take, and to check that geometry landed after create_procedural_box_mesh, create_procedural_grid_mesh or set_procedural_mesh_section_vertices; for the raw positions, normals and UVs of one section use get_procedural_mesh_section_data. An actor with no such label, or one with no procedural mesh component at component_index, is an error. Editor world only, not PIE.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the component (whole label, case-insensitive; the object name is not matched), as create_procedural_mesh_component set it, e.g. "ProcMeshActor". |
component_index |
integer | no | Optional 0-based index among the actor's procedural mesh components, in component order (default 0); most actors have only one. |
Returns: { actor_label: string, num_sections: int, use_complex_as_simple_collision: bool, use_async_cooking: bool, sections: [{ index: int, vertex_count: int, triangle_count: int, visible: bool, collision_enabled: bool }] }
get_procedural_mesh_section_data¶
Read-only
Read back the raw geometry (vertices, triangles, normals, UV0, tangents, colors) of a single procedural mesh section. A negative or missing section is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
section_index |
integer | yes | Required target section index (>= 0) |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
Returns: { actor_label, section_index, vertex_count, triangle_count, vertices, triangles, normals, uv0, tangents, colors, local_box, collision_enabled, visible }
remove_procedural_mesh_component¶
Destructive
Destroy the UProceduralMeshComponent on a named actor in the editor world (inverse of create_procedural_mesh_component). It removes only the FIRST such component it finds, so an actor carrying several needs one call each; the response says whether one was found at all, and whether it was the actor's root.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the component |
Returns: { actor_label, removed, component_name?, was_root? }
set_procedural_mesh_material¶
Destructive Idempotent
Assign a material to one slot of the first UProceduralMeshComponent on an editor-world actor (found by label or object name) with SetMaterial, marking the actor package dirty without saving. Returns the loaded material_path, element_index and previous_material_path when the slot had a material. element_index may name a slot the component has (one per section, or an existing override) or the next one past them; a negative one, or one further past, is an error checked before anything changes. A slot that already holds the material succeeds with material_set false and a note, touching nothing; otherwise material_set is read back from the slot and the call fails when it is false.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label or object name of the actor; the first actor matching either is used |
material_path |
string | yes | Material or material instance asset path, e.g. "/Game/Materials/M_Rock" |
element_index |
number | no | Material slot index, usually the section index; default 0; from 0 up to the larger of the section count and the override count |
Returns: { actor_label, material_path, element_index, material_set, previous_material_path?, note? }
set_procedural_mesh_section_vertices¶
Destructive Idempotent
Move the vertices of an existing section of a UProceduralMeshComponent on an editor-world actor found by label: vertices sets every position in order, while triangles, normals, UVs, colors and tangents stay as they were (normals are not recomputed). When the section has collision its collision vertices follow, and the component bounds are rebuilt. Sending the same positions again leaves the section as it was, so the call is idempotent. A missing actor or component, a negative or nonexistent section, an empty vertices array or a count different from the section's is an error before anything changes. Transient: nothing is marked dirty, saved or undoable. New geometry or topology: create_procedural_box_mesh, create_procedural_grid_mesh; read the section back: get_procedural_mesh_section_data; counts: get_procedural_mesh_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
vertices |
array | yes | Required [[x, y, z], ...] array in component space with the same vertex count as the existing section; an entry that is not a 3-element array is skipped before the count is compared |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
section_index |
number | no | Optional target section index (>= 0); defaults to 0 |
Returns: { actor_label: string, section_index: int, vertex_count: int }
set_procedural_mesh_section_visible¶
Destructive Idempotent
Toggle the visibility of a single section on a procedural mesh component. Idempotent: sets the section's bSectionVisible flag directly.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
visible |
boolean | yes | Required bool; new visibility for the section |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
section_index |
number | no | Target section index; defaults to 0 |
Returns: { actor_label: string, section_index: int, visible: bool, total_sections: int }
slice_procedural_mesh¶
Destructive
Slice a procedural mesh in place with a plane, optionally spawning the other half as a new PMC on the same actor. NOT idempotent: mutates the mesh destructively; re-running slices the already-sliced result.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the actor carrying the PMC |
component_index |
integer | no | Optional 0-based PMC index on the actor; defaults to 0 |
plane_position |
array | no | [x,y,z] world-space point on the slice plane |
plane_normal |
array | no | [x,y,z] slice plane normal (must be non-zero); geometry on the positive side is kept |
create_other_half |
boolean | no | Optional bool; if true, the sliced-off half is spawned as a new PMC on the same actor |
cap_option |
string | no | Optional "NoCap" | "CreateNewSectionForCap" | "UseLastSectionForCap"; defaults to "NoCap" |
cap_material_path |
string | no | Optional /Game path to a UMaterialInterface for the cap |
Returns: { actor_label, sliced, total_sections, other_half_created, other_half_component_name?, other_half_sections? }