Add debug print

This commit is contained in:
2024-06-16 20:11:06 +02:00
parent c1aa61ca95
commit 66d6cd17e6
2 changed files with 8 additions and 5 deletions

View File

@@ -21,8 +21,8 @@ def main():
buildArea = editor.getBuildArea() buildArea = editor.getBuildArea()
origin = ((buildArea.begin).x, (buildArea.begin).z) origin = ((buildArea.begin).x, (buildArea.begin).z)
# remove_trees('./world_maker/data/heightmap.png', './world_maker/data/treemap.png', remove_trees('./world_maker/data/heightmap.png', './world_maker/data/treemap.png',
# './world_maker/data/smooth_sobel_watermap.png') './world_maker/data/smooth_sobel_watermap.png')
smooth_terrain('./world_maker/data/heightmap.png', smooth_terrain('./world_maker/data/heightmap.png',
'./world_maker/data/heightmap_smooth.png', './world_maker/data/smooth_sobel_watermap.png') './world_maker/data/heightmap_smooth.png', './world_maker/data/smooth_sobel_watermap.png')

View File

@@ -9,7 +9,7 @@ from world_maker.data_analysis import handle_import_image
def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask: Union[str, Image]): def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask: Union[str, Image]):
print(["Remove tree"] Starting...)
editor = Editor(buffering=True) editor = Editor(buffering=True)
build_area = editor.getBuildArea() build_area = editor.getBuildArea()
build_rectangle = build_area.toRect() build_rectangle = build_area.toRect()
@@ -42,8 +42,6 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask
removed.append((x, z)) removed.append((x, z))
print(x, z) print(x, z)
removed_treesmap.save('./world_maker/data/removed_treesmap.png')
for x in range(0, distance[0]): for x in range(0, distance[0]):
for z in range(0, distance[1]): for z in range(0, distance[1]):
print("removing tree in ", start[0] + x, start[1] + z) print("removing tree in ", start[0] + x, start[1] + z)
@@ -53,9 +51,13 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask
geometry.placeLine( geometry.placeLine(
editor, (start[0] + x, y+1, start[1] + z), (start[0] + x, y_top, start[1] + z), Block('air')) editor, (start[0] + x, y+1, start[1] + z), (start[0] + x, y_top, start[1] + z), Block('air'))
removed_treesmap.save('./world_maker/data/removed_treesmap.png')
print(["Remove tree"] Done.)
def smooth_terrain(heightmap: Union[str, Image], heightmap_smooth: Union[str, Image], mask: Union[str, Image]): def smooth_terrain(heightmap: Union[str, Image], heightmap_smooth: Union[str, Image], mask: Union[str, Image]):
print(["Smooth terrain"] Starting...)
editor = Editor() editor = Editor()
build_area = editor.getBuildArea() build_area = editor.getBuildArea()
build_rectangle = build_area.toRect() build_rectangle = build_area.toRect()
@@ -97,3 +99,4 @@ def smooth_terrain(heightmap: Union[str, Image], heightmap_smooth: Union[str, Im
editor, (start[0] + x, y, start[1] + z), (start[0] + x, y_smooth, start[1] + z), block) editor, (start[0] + x, y, start[1] + z), (start[0] + x, y_smooth, start[1] + z), block)
smooth_terrain_delta.save('./world_maker/data/smooth_terrain_delta.png') smooth_terrain_delta.save('./world_maker/data/smooth_terrain_delta.png')
print(["Smoothing terrain"] Done.)