Skip to content

Commit 50deff0

Browse files
author
Roberto De Ioris
authored
Update Landscape_API.md
1 parent 5678e1a commit 50deff0

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

docs/Landscape_API.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ https://docs.unrealengine.com/latest/INT/Engine/Landscape/TechnicalGuide/index.h
108108

109109
Informations about a Landscape/Terrain are stored in a special uobject called ULandscapeInfo.
110110

111-
To retrieve it (or eventually create a new one), you have the following two functions:
111+
To retrieve it (or eventually create a new one if you are making weird operations), you have the following two functions:
112112

113113
```python
114114
landscape_info = landscape.get_landscape_info()
@@ -130,3 +130,37 @@ for component in landscape.LandscapeComponents:
130130
```
131131

132132
this will print the texture width, height and data size of each landscape component.
133+
134+
## Exporting the Terrain to a FRawMesh
135+
136+
FRawMesh is a special structure representing a mesh. You can use it to generate new StaticMesh in UE4.
137+
138+
More infos can be retrieved here:
139+
140+
https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/SnippetsForStaticAndSkeletalMeshes.md
141+
142+
You can generate a new FRawMesh from a landscape with this function:
143+
144+
145+
```python
146+
# lod is optional, by default it is 0
147+
raw_mesh = landscape.landscape_export_to_raw_mesh([lod])
148+
```
149+
150+
Remember that terrains are generally huge in size :)
151+
152+
## The Heightmap api
153+
154+
A heightmap high-level api is exposed to simplify heightmap manipulation
155+
156+
```python
157+
# expand the heightmap to fit the new size
158+
expanded_data = ue.heightmap_expand(data, data_width, data_height, new_width, new_height)
159+
```
160+
161+
```python
162+
# import a heightmap file (r16 or grayscale 16bit png) and returns a bytearray
163+
data = ue.heightmap_import(filename[,width, height])
164+
```
165+
166+
if width and height are not specified, the system will try to retrieve them from the file

0 commit comments

Comments
 (0)