foliage
Foliage types, procedural foliage, painting, and instance edits.
What it’s for
This namespace works with Unreal’s foliage systems: the foliage type assets that describe what gets scattered, the procedural foliage volumes that scatter it, and the instanced foliage data placed in the current level. You use it to set up a foliage type from a static mesh, drop or paint instances, query what is already placed, and clear instances back out again.
Reach for it when you want to dress a level with grass, rocks, trees, or debris as instanced foliage rather than as standalone actors. It handles the density, scale, alignment, and yaw settings that make a scatter look natural, and it can build a procedural foliage spawner over a bounded volume so the engine populates the region for you.
Prefer this over generic actor placement whenever the content is meant to live as foliage. It reads
and writes foliage types and instanced foliage data, not standalone StaticMeshActor
edits, so the instances stay cheap and behave like the rest of the level’s foliage.
Examples
Turn a static mesh into a foliage type
Ask for a new foliage type and the assistant creates the asset with your density and scale settings.
You: Make a grass foliage type from SM_GrassClump, denser and with some scale variation.
call("foliage.add_type", {name:"FT_GrassClump", meshPath:"/Game/Foliage/SM_GrassClump",
density:250, minScale:0.8, maxScale:1.4})
→ {ok:true, path:"/Game/Foliage/FT_GrassClump"}
Done. Created FT_GrassClump with density 250 and scale 0.8–1.4.
Paint foliage across a set of points
Give it a foliage type and the spots to fill, and it places instances at each one.
You: Scatter that grass along these three points near the path.
call("foliage.paint", {foliageTypePath:"/Game/Foliage/FT_GrassClump",
locations:[{x:1200,y:400,z:0}, {x:1350,y:420,z:0}, {x:1500,y:410,z:0}]})
→ {ok:true, painted:3}
Done. Painted 3 grass instances along the path.
Clear foliage out of the level
Remove one foliage type’s instances, or wipe every instance in one call.
You: How much grass is placed, then remove all foliage so I can start over.
call("foliage.get_instances", {foliageTypePath:"/Game/Foliage/FT_GrassClump"})
→ {ok:true, count:3}
call("foliage.remove", {removeAll:true})
→ {ok:true, removed:3}
Done. Reported 3 grass instances, then removed all foliage.