Procedural¶
20 tools. Back to the index.
add_pcg_component¶
Additive, idempotent.
Attach a PCG component (the procedural generation engine) to an actor and optionally point it at a PCG graph -- what turns a plain actor or volume into something that scatters meshes and points by rule. Idempotent: an actor that already has one gets it back. The component generates within the actor's BOUNDS, so on a volume with no brush geometry it produces zero instances with no error at all -- confirm the extent with get_actor_bounds first. Then run generate_pcg_component and inspect with get_pcg_component_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Display label or internal name of the target editor-world actor (required) |
pcg_graph_path |
string | no | Optional /Game/... path of a UPCGGraph to assign to the component |
Returns: { actor_name, component_name, already_existed, graph_path, graph_assigned }
add_pcg_graph_parameter¶
Additive, idempotent.
Expose a tunable on a PCG graph (bool / int / float / double / string) so density, radius or a toggle can be driven from outside instead of being welded into a node. Idempotent (already_existed when the name is taken). Only worth doing on graphs you own -- adding one to a library graph means editing that asset. Set a value with set_pcg_graph_parameter and list them with get_pcg_graph_parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | /Game/... path to the UPCGGraph (required) |
name |
string | yes | Parameter name (required) |
type |
string | yes | "bool" | "int" | "float" | "double" | "string" (required) |
Returns: { pcg_graph_path, name, type, added, already_existed, parameter_count }
add_pcg_node¶
Additive.
Adds a node of the given UPCGSettings subclass to a PCG graph. Uses UPCGGraph::AddNodeOfType, which creates the node's settings in the transient package and reparents the node into the graph (headless-safe). The graph is re-saved after the mutation.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example" or fully-qualified "/Game/PCG/PCG_Example.PCG_Example"). |
node_type |
string | yes | A concrete UPCGSettings subclass name, e.g. "PCGSurfaceSamplerSettings", "PCGStaticMeshSpawnerSettings", or a fully-qualified "/Script/PCG.PCGSurfaceSamplerSettings". |
Returns: { graph_name: string, asset_path: string, node_title: string, node_name: string, settings_class: string, node_count: int, saved: bool, save_error: string }
add_pcg_subgraph_node¶
Additive.
Embed one PCG graph inside another as a Subgraph node -- how you reuse a scatter or filter recipe across biomes instead of duplicating nodes, and how you consume a library graph without editing it. Check first with get_pcg_graph_info that the target graph actually USES its input node (a graph with no edges from its default input cannot be fed filtered data and will ignore whatever you wire in), and with get_pcg_graph_parameters whether it exposes anything tunable.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | /Game/... path to the host UPCGGraph (required) |
subgraph_path |
string | yes | /Game/... path to the UPCGGraph to embed as a subgraph (required) |
Returns: { graph_name, asset_path, node_name, node_title, subgraph_path, subgraph_set, node_count, saved }
cleanup_pcg_component¶
Destructive.
Wipe a PCG component's generated output synchronously -- and the step you must not skip after editing a graph: a plain generate_pcg_component with force reuses the CACHED result, so the world keeps the STALE meshes and settings while every flag reads generated:true. Call this with remove_components=true FIRST, then generate, then verify by re-reading the actor's spawned components rather than the generated flag. Also the way to clear procedural content before moving or resizing the volume.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Actor holding the UPCGComponent (required) |
remove_components |
boolean | no | Optional; also remove spawned managed components (default false) |
Returns: { actor_name, cleaned, generated }
connect_pcg_nodes¶
Destructive, idempotent.
Connects two PCG nodes by adding a directed edge from an output pin to an input pin. Node names come from get_pcg_graph_info; the implicit graph endpoints are addressable as "Input"/"Output". from_pin/to_pin default to the node's "Out"/"In" pin (else its first pin); the resolved labels are echoed in the response. Idempotent: an existing edge reports already_connected without error. The graph is re-saved after a new edge is added.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example" or fully-qualified "/Game/PCG/PCG_Example.PCG_Example"). |
from_node |
string | yes | Upstream node: a node_name from get_pcg_graph_info, or the token "Input" for the graph's implicit input node. |
to_node |
string | yes | Downstream node: a node_name, or the token "Output" for the graph's implicit output node. |
from_pin |
string | no | Optional output-pin label on from_node (default the node's "Out" pin, else its first output pin). |
to_pin |
string | no | Optional input-pin label on to_node (default the node's "In" pin, else its first input pin). |
Returns: { graph_name: string, asset_path: string, from_node: string, from_pin: string, to_node: string, to_pin: string, already_connected: bool, connected: bool, edge_count: int, saved: bool, save_error: string }
create_pcg_graph¶
Additive.
Creates (or loads, idempotently) a UPCGGraph asset and saves it. Uses CreatePackage + NewObject<UPCGGraph> (headless-safe). A fresh PCG graph has the implicit Input/Output nodes; node_count counts user-added nodes only (initially 0). Requires the PCG plugin to be enabled.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Name of the PCG Graph asset to create. |
package_path |
string | no | Destination /Game folder (default /Game/PCG). |
Returns: { graph_name: string, asset_path: string, created: bool, already_exists: bool, node_count: int, saved: bool, save_error: string }
disconnect_pcg_nodes¶
Destructive, idempotent.
Removes the directed edge between two PCG nodes' pins. Pin labels default to the node's "Out"/"In" pin (else its first pin) and the resolved labels are echoed. Idempotent: if no such edge exists it reports already_disconnected without error. The graph is re-saved after an edge is removed.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example"). |
from_node |
string | yes | Upstream node name, or the token "Input". |
to_node |
string | yes | Downstream node name, or the token "Output". |
from_pin |
string | no | Optional output-pin label on from_node (default the node's "Out" pin, else its first output pin). |
to_pin |
string | no | Optional input-pin label on to_node (default the node's "In" pin, else its first input pin). |
Returns: { graph_name: string, asset_path: string, from_node: string, from_pin: string, to_node: string, to_pin: string, already_disconnected: bool, removed: bool, disconnected: bool, edge_count: int, saved: bool, save_error: string }
generate_pcg_component¶
Additive.
Triggers PCG generation on an actor's UPCGComponent. Generation is ASYNCHRONOUS (scheduled on the PCG subsystem, resolved over subsequent editor ticks) — this returns the scheduled task id, NOT a finished result. Poll get_pcg_component_info / get_pcg_generated_data for completion (honest).
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Actor holding the UPCGComponent (required) |
force |
boolean | no | Optional; force regeneration even if already generated (default true) |
Returns: { actor_name, scheduled, task_id, is_generating, generated, note }
get_pcg_component_info¶
Read-only.
Read an actor's PCG component: which graph it runs, its seed, whether it is generating or already generated, activated, partitioned, and its generation trigger. Read-only. Use it to find which graph is driving an actor and to confirm a seed for deterministic scatter -- but NOT as proof the world matches the graph: generated:true is satisfied by a cached result, so after editing a graph the flag says done while the spawned meshes are stale. The real check is the actor's spawned components (get_pcg_generated_data / get_components_by_class), after cleanup_pcg_component + generate_pcg_component.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Actor holding the UPCGComponent (required) |
Returns: { actor_name, has_component, graph_path, is_generating, generated, seed, activated, is_partitioned, generation_trigger }
get_pcg_generated_data¶
Read-only.
Reports the generated output of an actor's UPCGComponent: per output item, its pin, tags and data class. Read-only; empty until a generation completes (generation is asynchronous).
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Actor holding the UPCGComponent (required) |
Returns: { actor_name, has_component, output_data_count, data:[{index, pin, data_class, tags:[...]}], note? }
get_pcg_graph_info¶
Read-only.
Reads the structure of a UPCGGraph: node count, per-node titles and pin labels, and every directed edge. Pin labels and the input_node_name/output_node_name feed connect_pcg_nodes / disconnect_pcg_nodes; the implicit graph endpoints are also addressable by the tokens "Input"/"Output".
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example" or fully-qualified "/Game/PCG/PCG_Example.PCG_Example"). |
Returns: { graph_name: string, asset_path: string, node_count: int, nodes: [{node_name, title, settings_class, input_pins: [string], output_pins: [string]}], has_input_node: bool, has_output_node: bool, input_node_name: string, output_node_name: string, edges: [{from_node, from_pin, to_node, to_pin}], edge_count: int }
get_pcg_graph_parameters¶
Read-only.
List a PCG graph's user parameters with name, type and current value -- and the read that decides whether a THIRD-PARTY graph can be reused without editing it. An empty list means nothing is exposed: meshes, densities and exclusions are welded inside, so the only way to change them is to edit the asset, which is not an option for a read-only library graph. Read-only. Note it accepts a PCGGraph asset, not a PCGGraphInstance -- overriding a parameter on an instance has no headless route and must be ticked in the details panel.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | /Game/... path to the UPCGGraph (required) |
Returns: { pcg_graph_path, parameter_count, parameters:[{name, type, value}] }
get_pcg_node_properties¶
Read-only.
Reads every editable property of a PCG node's settings object via reflection. The node is resolved by name from get_pcg_graph_info (or the "Input"/"Output" tokens); its UPCGSettings is serialized to JSON. Read-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example" or fully-qualified "/Game/PCG/PCG_Example.PCG_Example"). |
node_name |
string | yes | The node_name from get_pcg_graph_info of the node to read (the tokens "Input"/"Output" address the implicit endpoints). |
Returns: { graph_name: string, asset_path: string, node_name: string, settings_class: string, properties: object }
list_pcg_node_types¶
Read-only.
Enumerate every PCG node type available in this build (all concrete PCGSettings subclasses, including plugin- and project-added ones), with class names and paths. Run it before add_pcg_node so you pass a class that exists instead of guessing a name from documentation that may not match this engine version. Read-only reflection.
No parameters.
Returns: { base_class, count, types:[{name, path}] }
remove_pcg_node¶
Destructive, idempotent.
Removes a user-added node from a PCG graph by name. Uses UPCGGraph::RemoveNode, which auto-breaks the node's edges and notifies its neighbours; the graph is re-saved after the mutation. The implicit Input/Output endpoint nodes cannot be removed (doing so would silently corrupt the graph) and are rejected with an honest error. Idempotent: a node that is not present reports already_removed without error.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example" or fully-qualified "/Game/PCG/PCG_Example.PCG_Example"). |
node_name |
string | yes | The node_name from get_pcg_graph_info of the node to remove. The tokens "Input"/"Output" (and the endpoints' real names) are rejected: the implicit graph endpoints cannot be removed. |
Returns: { graph_name: string, asset_path: string, node_name: string, removed: bool, already_removed: bool, node_count: int, saved: bool, save_error: string }
set_pcg_component_properties¶
Destructive, idempotent.
Sets properties on an actor's UPCGComponent by reflection (Seed, bActivated, bIsComponentPartitioned, GenerationTrigger, ...). Reads the stored values back into the response.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Actor holding the UPCGComponent (required) |
properties |
object | yes | JSON object { PropertyName: value, ... } applied to the component |
Returns: { actor_name, set:[name], failed:[{name, error}], applied:{name: stored_value_text} }
set_pcg_graph_parameter¶
Destructive, idempotent.
Write the value of an existing PCG graph user parameter (bool / int / float / double) and read the stored value back, so the reply is its own oracle -- how you tune scatter density or a rule threshold without opening the graph. The parameter must already exist (add_pcg_graph_parameter) and the value type must match. IMPORTANT: it accepts a PCGGraph ASSET only and answers "PCG graph not found" for a PCGGraphInstance -- per-instance overrides have no headless route and must be ticked in the details panel. Changing a parameter does not update the world: cleanup_pcg_component then generate_pcg_component, or the cached output is reused.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | /Game/... path to the UPCGGraph (required) |
name |
string | yes | Parameter name (must already exist; add with add_pcg_graph_parameter) (required) |
value |
string | no | New value; its type must match the parameter's declared type (required) |
Returns: { pcg_graph_path, name, type, set, value }
set_pcg_node_properties¶
Destructive, idempotent.
Authors a PCG node's settings object via reflection (partial merge + clamp). Only the keys present in properties are written; absent keys are untouched. After the merge, PostEditChange() invalidates the node's cached CRC and regenerates its pins. The graph is re-saved and the persisted settings are read back. Idempotent: re-applying the same values is a no-op.
| Parameter | Type | Required | Description |
|---|---|---|---|
pcg_graph_path |
string | yes | Asset path of the PCG Graph (e.g. "/Game/PCG/PCG_Example" or fully-qualified "/Game/PCG/PCG_Example.PCG_Example"). |
node_name |
string | yes | The node_name from get_pcg_graph_info of the node to author (the tokens "Input"/"Output" address the implicit endpoints). |
properties |
object | yes | Object of UPCGSettings fields to merge (e.g. for a SurfaceSampler: bApplyDensityToPoints(bool), PointsPerSquaredMeter(float>=0), Looseness(float)); absent keys untouched. |
Returns: { graph_name: string, asset_path: string, node_name: string, settings_class: string, applied_keys: [string], properties: object, saved: bool, save_error: string }
spawn_pcg_volume¶
Additive.
Spawns an APCGVolume in the editor world with a REAL cube brush (from extent), optionally assigning a graph. Bounds, origin, scale and brush geometry are RE-READ from the spawned actor, never echoed. Without extent the volume is spawned brush-less (kept for compatibility) and the response says so explicitly, because a PCG component with null bounds generates 0 instances in total silence.
| Parameter | Type | Required | Description |
|---|---|---|---|
location |
array | no | World location [X, Y, Z] for the volume. |
extent |
array | no | Cube HALF-size [x, y, z] in unreal units, each > 0 (same convention as spawn_box_volume / spawn_navmesh_bounds_volume). STRONGLY RECOMMENDED: omitting it leaves the volume with extent (0,0,0) and the PCG component generates 0 instances with no error and no warning. |
rotation |
array | no | Optional [pitch, yaw, roll] rotation for the volume (default 0,0,0). |
pcg_graph_path |
string | no | Optional content path of a UPCGGraph to assign to the spawned volume's PCG component. |
name |
string | no | Optional explicit name (skipped if already used in the current level to avoid Rename-onto-occupied crash). |
Returns: { actor_name: string, actor_label: string, actor_class: string, has_pcg_component: bool, pcg_graph_path: string, graph_assigned: bool, location: [float], bounds_extent_actual: [float], bounds_origin_actual: [float], actor_scale: [float], has_brush_geometry: bool, brush_poly_count: int, brush_requested: bool, scale_normalized: bool, warning?: string, requested: {...} }