maps4fs 1.2.8__py3-none-any.whl → 1.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maps4fs/__init__.py +8 -1
- maps4fs/generator/background.py +9 -19
- maps4fs/generator/component.py +9 -2
- maps4fs/generator/dem.py +11 -14
- maps4fs/generator/grle.py +2 -5
- maps4fs/generator/i3d.py +5 -8
- maps4fs/generator/map.py +82 -5
- maps4fs/generator/texture.py +10 -14
- {maps4fs-1.2.8.dist-info → maps4fs-1.3.1.dist-info}/METADATA +16 -15
- maps4fs-1.3.1.dist-info/RECORD +21 -0
- maps4fs-1.2.8.dist-info/RECORD +0 -21
- {maps4fs-1.2.8.dist-info → maps4fs-1.3.1.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.2.8.dist-info → maps4fs-1.3.1.dist-info}/WHEEL +0 -0
- {maps4fs-1.2.8.dist-info → maps4fs-1.3.1.dist-info}/top_level.txt +0 -0
maps4fs/__init__.py
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
# pylint: disable=missing-module-docstring
|
2
2
|
from maps4fs.generator.game import Game
|
3
|
-
from maps4fs.generator.map import
|
3
|
+
from maps4fs.generator.map import (
|
4
|
+
BackgroundSettings,
|
5
|
+
DEMSettings,
|
6
|
+
GRLESettings,
|
7
|
+
I3DSettings,
|
8
|
+
Map,
|
9
|
+
TextureSettings,
|
10
|
+
)
|
4
11
|
from maps4fs.logger import Logger
|
maps4fs/generator/background.py
CHANGED
@@ -13,12 +13,7 @@ import numpy as np
|
|
13
13
|
import trimesh # type: ignore
|
14
14
|
|
15
15
|
from maps4fs.generator.component import Component
|
16
|
-
from maps4fs.generator.dem import
|
17
|
-
DEFAULT_BLUR_RADIUS,
|
18
|
-
DEFAULT_MULTIPLIER,
|
19
|
-
DEFAULT_PLATEAU,
|
20
|
-
DEM,
|
21
|
-
)
|
16
|
+
from maps4fs.generator.dem import DEM
|
22
17
|
from maps4fs.generator.texture import Texture
|
23
18
|
|
24
19
|
DEFAULT_DISTANCE = 2048
|
@@ -46,8 +41,6 @@ class Background(Component):
|
|
46
41
|
# pylint: disable=R0801
|
47
42
|
def preprocess(self) -> None:
|
48
43
|
"""Registers the DEMs for the background terrain."""
|
49
|
-
self.light_version = self.kwargs.get("light_version", False)
|
50
|
-
self.water_depth = self.kwargs.get("water_depth", 0)
|
51
44
|
self.stl_preview_path: str | None = None
|
52
45
|
self.water_resources_path: str | None = None
|
53
46
|
|
@@ -65,7 +58,7 @@ class Background(Component):
|
|
65
58
|
os.makedirs(self.background_directory, exist_ok=True)
|
66
59
|
os.makedirs(self.water_directory, exist_ok=True)
|
67
60
|
|
68
|
-
autoprocesses = [self.
|
61
|
+
autoprocesses = [self.map.dem_settings.auto_process, False]
|
69
62
|
self.output_paths = [
|
70
63
|
os.path.join(self.background_directory, f"{name}.png") for name in ELEMENTS
|
71
64
|
]
|
@@ -83,11 +76,8 @@ class Background(Component):
|
|
83
76
|
self.rotation,
|
84
77
|
self.map_directory,
|
85
78
|
self.logger,
|
86
|
-
auto_process=autoprocess,
|
87
|
-
blur_radius=self.kwargs.get("blur_radius", DEFAULT_BLUR_RADIUS),
|
88
|
-
multiplier=self.kwargs.get("multiplier", DEFAULT_MULTIPLIER),
|
89
|
-
plateau=self.kwargs.get("plateau", DEFAULT_PLATEAU),
|
90
79
|
)
|
80
|
+
dem.auto_process = autoprocess
|
91
81
|
dem.preprocess()
|
92
82
|
dem.is_preview = self.is_preview(name) # type: ignore
|
93
83
|
dem.set_output_resolution((self.rotated_size, self.rotated_size))
|
@@ -118,7 +108,7 @@ class Background(Component):
|
|
118
108
|
if not dem.is_preview: # type: ignore
|
119
109
|
shutil.copyfile(dem.dem_path, self.not_substracted_path)
|
120
110
|
|
121
|
-
if self.water_depth:
|
111
|
+
if self.map.dem_settings.water_depth:
|
122
112
|
self.subtraction()
|
123
113
|
|
124
114
|
for dem in self.dems:
|
@@ -127,8 +117,9 @@ class Background(Component):
|
|
127
117
|
if self.game.additional_dem_name is not None:
|
128
118
|
self.make_copy(cutted_dem_path, self.game.additional_dem_name)
|
129
119
|
|
130
|
-
if
|
120
|
+
if self.map.background_settings.generate_background:
|
131
121
|
self.generate_obj_files()
|
122
|
+
if self.map.background_settings.generate_water:
|
132
123
|
self.generate_water_resources_obj()
|
133
124
|
else:
|
134
125
|
self.logger.info("Light version is enabled, obj files will not be generated.")
|
@@ -325,7 +316,7 @@ class Background(Component):
|
|
325
316
|
self.mesh_to_stl(mesh)
|
326
317
|
else:
|
327
318
|
if not include_zeros:
|
328
|
-
multiplier = self.
|
319
|
+
multiplier = self.map.dem_settings.multiplier
|
329
320
|
if multiplier != 1:
|
330
321
|
z_scaling_factor = 1 / multiplier
|
331
322
|
else:
|
@@ -485,8 +476,7 @@ class Background(Component):
|
|
485
476
|
rotation=self.rotation,
|
486
477
|
map_directory=self.map_directory,
|
487
478
|
logger=self.logger,
|
488
|
-
|
489
|
-
custom_schema=background_layers,
|
479
|
+
custom_schema=background_layers, # type: ignore
|
490
480
|
)
|
491
481
|
|
492
482
|
self.background_texture.preprocess()
|
@@ -534,7 +524,7 @@ class Background(Component):
|
|
534
524
|
|
535
525
|
# Create a mask where water_resources_image is 255 (or not 0)
|
536
526
|
# Subtract water_depth from dem_image where mask is True
|
537
|
-
dem_image[mask] = dem_image[mask] - self.water_depth
|
527
|
+
dem_image[mask] = dem_image[mask] - self.map.dem_settings.water_depth
|
538
528
|
|
539
529
|
# Save the modified dem_image back to the output path
|
540
530
|
cv2.imwrite(output_path, dem_image)
|
maps4fs/generator/component.py
CHANGED
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
|
|
20
20
|
from maps4fs.generator.map import Map
|
21
21
|
|
22
22
|
|
23
|
-
# pylint: disable=R0801, R0903, R0902, R0904
|
23
|
+
# pylint: disable=R0801, R0903, R0902, R0904, R0913, R0917
|
24
24
|
class Component:
|
25
25
|
"""Base class for all map generation components.
|
26
26
|
|
@@ -46,7 +46,7 @@ class Component:
|
|
46
46
|
rotation: int,
|
47
47
|
map_directory: str,
|
48
48
|
logger: Any = None,
|
49
|
-
**kwargs
|
49
|
+
**kwargs: dict[str, Any],
|
50
50
|
):
|
51
51
|
self.game = game
|
52
52
|
self.map = map
|
@@ -58,6 +58,13 @@ class Component:
|
|
58
58
|
self.logger = logger
|
59
59
|
self.kwargs = kwargs
|
60
60
|
|
61
|
+
self.logger.info(
|
62
|
+
"Component %s initialized. Map size: %s, map rotated size: %s", # type: ignore
|
63
|
+
self.__class__.__name__,
|
64
|
+
self.map_size,
|
65
|
+
self.map_rotated_size,
|
66
|
+
)
|
67
|
+
|
61
68
|
os.makedirs(self.previews_directory, exist_ok=True)
|
62
69
|
os.makedirs(self.scripts_directory, exist_ok=True)
|
63
70
|
os.makedirs(self.info_layers_directory, exist_ok=True)
|
maps4fs/generator/dem.py
CHANGED
@@ -14,9 +14,6 @@ from pympler import asizeof # type: ignore
|
|
14
14
|
from maps4fs.generator.component import Component
|
15
15
|
|
16
16
|
SRTM = "https://elevation-tiles-prod.s3.amazonaws.com/skadi/{latitude_band}/{tile_name}.hgt.gz"
|
17
|
-
DEFAULT_MULTIPLIER = 1
|
18
|
-
DEFAULT_BLUR_RADIUS = 35
|
19
|
-
DEFAULT_PLATEAU = 0
|
20
17
|
|
21
18
|
|
22
19
|
# pylint: disable=R0903, R0902
|
@@ -50,8 +47,7 @@ class DEM(Component):
|
|
50
47
|
self.output_resolution = self.get_output_resolution()
|
51
48
|
self.logger.debug("Output resolution for DEM data: %s.", self.output_resolution)
|
52
49
|
|
53
|
-
|
54
|
-
blur_radius = self.kwargs.get("blur_radius", DEFAULT_BLUR_RADIUS)
|
50
|
+
blur_radius = self.map.dem_settings.blur_radius
|
55
51
|
if blur_radius is None or blur_radius <= 0:
|
56
52
|
# We'll disable blur if the radius is 0 or negative.
|
57
53
|
blur_radius = 0
|
@@ -59,11 +55,12 @@ class DEM(Component):
|
|
59
55
|
blur_radius += 1
|
60
56
|
self.blur_radius = blur_radius
|
61
57
|
self.logger.debug(
|
62
|
-
"DEM value multiplier is %s, blur radius is %s.",
|
58
|
+
"DEM value multiplier is %s, blur radius is %s.",
|
59
|
+
self.map.dem_settings.multiplier,
|
60
|
+
self.blur_radius,
|
63
61
|
)
|
64
62
|
|
65
|
-
self.auto_process = self.
|
66
|
-
self.plateau = self.kwargs.get("plateau", False)
|
63
|
+
self.auto_process = self.map.dem_settings.auto_process
|
67
64
|
|
68
65
|
@property
|
69
66
|
def dem_path(self) -> str:
|
@@ -191,11 +188,11 @@ class DEM(Component):
|
|
191
188
|
resampled_data = self._normalize_dem(resampled_data)
|
192
189
|
else:
|
193
190
|
self.logger.debug("Auto processing is disabled, DEM data will not be normalized.")
|
194
|
-
resampled_data = resampled_data * self.multiplier
|
191
|
+
resampled_data = resampled_data * self.map.dem_settings.multiplier
|
195
192
|
|
196
193
|
self.logger.debug(
|
197
194
|
"DEM data was multiplied by %s. Min: %s, max: %s. Data type: %s.",
|
198
|
-
self.multiplier,
|
195
|
+
self.map.dem_settings.multiplier,
|
199
196
|
resampled_data.min(),
|
200
197
|
resampled_data.max(),
|
201
198
|
resampled_data.dtype,
|
@@ -210,7 +207,7 @@ class DEM(Component):
|
|
210
207
|
self.logger.debug(
|
211
208
|
"DEM data was multiplied by %s and clipped to 16-bit unsigned integer range. "
|
212
209
|
"Min: %s, max: %s.",
|
213
|
-
self.multiplier,
|
210
|
+
self.map.dem_settings.multiplier,
|
214
211
|
resampled_data.min(),
|
215
212
|
resampled_data.max(),
|
216
213
|
)
|
@@ -240,18 +237,18 @@ class DEM(Component):
|
|
240
237
|
resampled_data.max(),
|
241
238
|
)
|
242
239
|
|
243
|
-
if self.plateau:
|
240
|
+
if self.map.dem_settings.plateau:
|
244
241
|
# Plateau is a flat area with a constant height.
|
245
242
|
# So we just add this value to each pixel of the DEM.
|
246
243
|
# And also need to ensure that there will be no values with height greater than
|
247
244
|
# it's allowed in 16-bit unsigned integer.
|
248
245
|
|
249
|
-
resampled_data += self.plateau
|
246
|
+
resampled_data += self.map.dem_settings.plateau
|
250
247
|
resampled_data = np.clip(resampled_data, 0, 65535)
|
251
248
|
|
252
249
|
self.logger.debug(
|
253
250
|
"Plateau with height %s was added to DEM data. Min: %s, max: %s.",
|
254
|
-
self.plateau,
|
251
|
+
self.map.dem_settings.plateau,
|
255
252
|
resampled_data.min(),
|
256
253
|
resampled_data.max(),
|
257
254
|
)
|
maps4fs/generator/grle.py
CHANGED
@@ -40,9 +40,6 @@ class GRLE(Component):
|
|
40
40
|
"""Gets the path to the map I3D file from the game instance and saves it to the instance
|
41
41
|
attribute. If the game does not support I3D files, the attribute is set to None."""
|
42
42
|
|
43
|
-
self.farmland_margin = self.kwargs.get("farmland_margin", 0)
|
44
|
-
self.randomize_plants = self.kwargs.get("randomize_plants", True)
|
45
|
-
|
46
43
|
try:
|
47
44
|
grle_schema_path = self.game.grle_schema
|
48
45
|
except ValueError:
|
@@ -148,7 +145,7 @@ class GRLE(Component):
|
|
148
145
|
for field in fields:
|
149
146
|
try:
|
150
147
|
fitted_field = self.fit_polygon_into_bounds(
|
151
|
-
field, self.farmland_margin, angle=self.rotation
|
148
|
+
field, self.map.grle_settings.farmland_margin, angle=self.rotation
|
152
149
|
)
|
153
150
|
except ValueError as e:
|
154
151
|
self.logger.warning(
|
@@ -358,7 +355,7 @@ class GRLE(Component):
|
|
358
355
|
# Add islands of plants to the base image.
|
359
356
|
island_count = self.map_size
|
360
357
|
self.logger.info("Adding %s islands of plants to the base image.", island_count)
|
361
|
-
if self.
|
358
|
+
if self.map.grle_settings.random_plants:
|
362
359
|
grass_image_copy = create_island_of_plants(grass_image_copy, island_count)
|
363
360
|
self.logger.debug("Islands of plants added to the base image.")
|
364
361
|
|
maps4fs/generator/i3d.py
CHANGED
@@ -43,8 +43,6 @@ class I3d(Component):
|
|
43
43
|
def preprocess(self) -> None:
|
44
44
|
"""Gets the path to the map I3D file from the game instance and saves it to the instance
|
45
45
|
attribute. If the game does not support I3D files, the attribute is set to None."""
|
46
|
-
self.auto_process = self.kwargs.get("auto_process", False)
|
47
|
-
|
48
46
|
try:
|
49
47
|
self._map_i3d_path = self.game.i3d_file_path(self.map_directory)
|
50
48
|
self.logger.debug("Map I3D path: %s.", self._map_i3d_path)
|
@@ -52,9 +50,6 @@ class I3d(Component):
|
|
52
50
|
self.logger.info("I3D file processing is not implemented for this game.")
|
53
51
|
self._map_i3d_path = None
|
54
52
|
|
55
|
-
self.forest_density = self.kwargs.get("forest_density", DEFAULT_FOREST_DENSITY)
|
56
|
-
self.logger.info("Forest density: %s.", self.forest_density)
|
57
|
-
|
58
53
|
def process(self) -> None:
|
59
54
|
"""Updates the map I3D file with the default settings."""
|
60
55
|
self._update_i3d_file()
|
@@ -84,7 +79,7 @@ class I3d(Component):
|
|
84
79
|
root = tree.getroot()
|
85
80
|
for map_elem in root.iter("Scene"):
|
86
81
|
for terrain_elem in map_elem.iter("TerrainTransformGroup"):
|
87
|
-
if self.auto_process:
|
82
|
+
if self.map.dem_settings.auto_process:
|
88
83
|
terrain_elem.set("heightScale", str(DEFAULT_HEIGHT_SCALE))
|
89
84
|
self.logger.debug(
|
90
85
|
"heightScale attribute set to %s in TerrainTransformGroup element.",
|
@@ -395,12 +390,14 @@ class I3d(Component):
|
|
395
390
|
forest_image = cv2.imread(forest_image_path, cv2.IMREAD_UNCHANGED)
|
396
391
|
|
397
392
|
tree_count = 0
|
398
|
-
for x, y in self.non_empty_pixels(forest_image, step=self.forest_density):
|
393
|
+
for x, y in self.non_empty_pixels(forest_image, step=self.map.i3d_settings.forest_density):
|
399
394
|
xcs, ycs = self.top_left_coordinates_to_center((x, y))
|
400
395
|
node_id += 1
|
401
396
|
|
402
397
|
rotation = randint(-180, 180)
|
403
|
-
xcs, ycs = self.randomize_coordinates(
|
398
|
+
xcs, ycs = self.randomize_coordinates( # type: ignore
|
399
|
+
(xcs, ycs), self.map.i3d_settings.forest_density
|
400
|
+
)
|
404
401
|
|
405
402
|
random_tree = choice(tree_schema)
|
406
403
|
tree_name = random_tree["name"]
|
maps4fs/generator/map.py
CHANGED
@@ -4,13 +4,79 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
import os
|
6
6
|
import shutil
|
7
|
-
from typing import Any, Generator
|
7
|
+
from typing import Any, Generator, NamedTuple
|
8
8
|
|
9
9
|
from maps4fs.generator.component import Component
|
10
10
|
from maps4fs.generator.game import Game
|
11
11
|
from maps4fs.logger import Logger
|
12
12
|
|
13
13
|
|
14
|
+
class DEMSettings(NamedTuple):
|
15
|
+
"""Represents the advanced settings for DEM component.
|
16
|
+
|
17
|
+
Attributes:
|
18
|
+
auto_process (bool): use the auto preset to change the multiplier.
|
19
|
+
multiplier (int): multiplier for the heightmap, every pixel will be multiplied by this
|
20
|
+
value.
|
21
|
+
blur_radius (int): radius of the blur filter.
|
22
|
+
plateau (int): plateau height, will be added to each pixel.
|
23
|
+
water_depth (int): water depth, will be subtracted from each pixel where the water
|
24
|
+
is present.
|
25
|
+
"""
|
26
|
+
|
27
|
+
auto_process: bool = True
|
28
|
+
multiplier: int = 1
|
29
|
+
blur_radius: int = 35
|
30
|
+
plateau: int = 0
|
31
|
+
water_depth: int = 0
|
32
|
+
|
33
|
+
|
34
|
+
class BackgroundSettings(NamedTuple):
|
35
|
+
"""Represents the advanced settings for background component.
|
36
|
+
|
37
|
+
Attributes:
|
38
|
+
generate_background (bool): generate obj files for the background terrain.
|
39
|
+
generate_water (bool): generate obj files for the water.
|
40
|
+
"""
|
41
|
+
|
42
|
+
generate_background: bool = True
|
43
|
+
generate_water: bool = True
|
44
|
+
|
45
|
+
|
46
|
+
class GRLESettings(NamedTuple):
|
47
|
+
"""Represents the advanced settings for GRLE component.
|
48
|
+
|
49
|
+
Attributes:
|
50
|
+
farmland_margin (int): margin around the farmland.
|
51
|
+
random_plants (bool): generate random plants on the map or use the default one.
|
52
|
+
"""
|
53
|
+
|
54
|
+
farmland_margin: int = 0
|
55
|
+
random_plants: bool = True
|
56
|
+
|
57
|
+
|
58
|
+
class I3DSettings(NamedTuple):
|
59
|
+
"""Represents the advanced settings for I3D component.
|
60
|
+
|
61
|
+
Attributes:
|
62
|
+
forest_density (int): density of the forest (distance between trees).
|
63
|
+
"""
|
64
|
+
|
65
|
+
forest_density: int = 10
|
66
|
+
|
67
|
+
|
68
|
+
class TextureSettings(NamedTuple):
|
69
|
+
"""Represents the advanced settings for texture component.
|
70
|
+
|
71
|
+
Attributes:
|
72
|
+
dissolve (bool): dissolve the texture into several images.
|
73
|
+
fields_padding (int): padding around the fields.
|
74
|
+
"""
|
75
|
+
|
76
|
+
dissolve: bool = True
|
77
|
+
fields_padding: int = 0
|
78
|
+
|
79
|
+
|
14
80
|
# pylint: disable=R0913, R0902
|
15
81
|
class Map:
|
16
82
|
"""Class used to generate map using all components.
|
@@ -31,7 +97,11 @@ class Map:
|
|
31
97
|
rotation: int,
|
32
98
|
map_directory: str,
|
33
99
|
logger: Any = None,
|
34
|
-
|
100
|
+
dem_settings: DEMSettings = DEMSettings(),
|
101
|
+
background_settings: BackgroundSettings = BackgroundSettings(),
|
102
|
+
grle_settings: GRLESettings = GRLESettings(),
|
103
|
+
i3d_settings: I3DSettings = I3DSettings(),
|
104
|
+
texture_settings: TextureSettings = TextureSettings(),
|
35
105
|
):
|
36
106
|
if not logger:
|
37
107
|
logger = Logger(to_stdout=True, to_file=False)
|
@@ -53,8 +123,16 @@ class Map:
|
|
53
123
|
|
54
124
|
self.logger.info("Game was set to %s", game.code)
|
55
125
|
|
56
|
-
self.
|
57
|
-
self.logger.info("
|
126
|
+
self.dem_settings = dem_settings
|
127
|
+
self.logger.info("DEM settings: %s", dem_settings)
|
128
|
+
self.background_settings = background_settings
|
129
|
+
self.logger.info("Background settings: %s", background_settings)
|
130
|
+
self.grle_settings = grle_settings
|
131
|
+
self.logger.info("GRLE settings: %s", grle_settings)
|
132
|
+
self.i3d_settings = i3d_settings
|
133
|
+
self.logger.info("I3D settings: %s", i3d_settings)
|
134
|
+
self.texture_settings = texture_settings
|
135
|
+
self.logger.info("Texture settings: %s", texture_settings)
|
58
136
|
|
59
137
|
os.makedirs(self.map_directory, exist_ok=True)
|
60
138
|
self.logger.debug("Map directory created: %s", self.map_directory)
|
@@ -81,7 +159,6 @@ class Map:
|
|
81
159
|
self.rotation,
|
82
160
|
self.map_directory,
|
83
161
|
self.logger,
|
84
|
-
**self.kwargs,
|
85
162
|
)
|
86
163
|
self.components.append(component)
|
87
164
|
|
maps4fs/generator/texture.py
CHANGED
@@ -177,16 +177,10 @@ class Texture(Component):
|
|
177
177
|
]
|
178
178
|
|
179
179
|
def preprocess(self) -> None:
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
self.custom_schema: list[dict[str, str | dict[str, str] | int]] | None = self.kwargs.get(
|
185
|
-
"custom_schema"
|
186
|
-
)
|
187
|
-
|
188
|
-
if self.custom_schema:
|
189
|
-
layers_schema = self.custom_schema
|
180
|
+
"""Preprocesses the data before the generation."""
|
181
|
+
custom_schema = self.kwargs.get("custom_schema")
|
182
|
+
if custom_schema:
|
183
|
+
layers_schema = custom_schema # type: ignore
|
190
184
|
self.logger.info("Custom schema loaded with %s layers.", len(layers_schema))
|
191
185
|
else:
|
192
186
|
if not os.path.isfile(self.game.texture_schema):
|
@@ -201,7 +195,7 @@ class Texture(Component):
|
|
201
195
|
raise ValueError(f"Error loading texture layers schema: {e}") from e
|
202
196
|
|
203
197
|
try:
|
204
|
-
self.layers = [self.Layer.from_json(layer) for layer in layers_schema]
|
198
|
+
self.layers = [self.Layer.from_json(layer) for layer in layers_schema] # type: ignore
|
205
199
|
self.logger.info("Loaded %s layers.", len(self.layers))
|
206
200
|
except Exception as e: # pylint: disable=W0703
|
207
201
|
raise ValueError(f"Error loading texture layers: {e}") from e
|
@@ -431,7 +425,9 @@ class Texture(Component):
|
|
431
425
|
if cumulative_image is not None:
|
432
426
|
self.draw_base_layer(cumulative_image)
|
433
427
|
|
434
|
-
if
|
428
|
+
if self.map.texture_settings.dissolve and self.game.code != "FS22":
|
429
|
+
# FS22 has textures splitted into 4 sublayers, which leads to a very
|
430
|
+
# long processing time when dissolving them.
|
435
431
|
self.dissolve()
|
436
432
|
else:
|
437
433
|
self.logger.debug("Skipping dissolve in light version of the map.")
|
@@ -651,8 +647,8 @@ class Texture(Component):
|
|
651
647
|
if polygon is None:
|
652
648
|
continue
|
653
649
|
|
654
|
-
if is_fieds and self.fields_padding > 0:
|
655
|
-
padded_polygon = polygon.buffer(-self.fields_padding)
|
650
|
+
if is_fieds and self.map.texture_settings.fields_padding > 0:
|
651
|
+
padded_polygon = polygon.buffer(-self.map.texture_settings.fields_padding)
|
656
652
|
|
657
653
|
if not isinstance(padded_polygon, shapely.geometry.polygon.Polygon):
|
658
654
|
self.logger.warning("The padding value is too high, field will not padded.")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: maps4fs
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3.1
|
4
4
|
Summary: Generate map templates for Farming Simulator from real places.
|
5
5
|
Author-email: iwatkot <iwatkot@gmail.com>
|
6
6
|
License: MIT License
|
@@ -110,14 +110,7 @@ Requires-Dist: pympler
|
|
110
110
|
## Quick Start
|
111
111
|
There are several ways to use the tool. You obviously need the **first one**, but you can choose any of the others depending on your needs.<br>
|
112
112
|
### 🚜 For most users
|
113
|
-
**Option 1:** Open the [maps4fs](https://maps4fs.
|
114
|
-
<i>Note, that StreamLit community hosting has some limitations, such as: <br>
|
115
|
-
1. Maximum map size is 4096x4096 meters. <br>
|
116
|
-
2. Advanced settings are disabled. <br>
|
117
|
-
3. Texture dissolving is disabled (they will look worse). </i><br>
|
118
|
-
|
119
|
-
If you run the application locally, you won't have any of these limitations and will be able to generate maps of any size with any settings you want and nice looking textures.<br>
|
120
|
-
So, jump to [Docker version](#option-2-docker-version) to launch the tool with one command and get the full experience.<br>
|
113
|
+
**Option 1:** Open the [maps4fs](https://maps4fs.xyz) and generate a map template in a few clicks.<br>
|
121
114
|
|
122
115
|

|
123
116
|
|
@@ -165,13 +158,13 @@ Don't know where to start? Don't worry, just follow this [step-by-step guide](do
|
|
165
158
|
|
166
159
|
## How-To-Run
|
167
160
|
|
168
|
-
### Option 1:
|
169
|
-
🟢 Recommended for all users.
|
161
|
+
### Option 1: Public version
|
162
|
+
🟢 Recommended for all users.
|
170
163
|
🛠️ Don't need to install anything.
|
171
|
-
🗺️ Supported map sizes: 2x2, 4x4 km.
|
172
|
-
⚙️ Advanced settings:
|
173
|
-
🖼️ Texture dissolving:
|
174
|
-
Using the [
|
164
|
+
🗺️ Supported map sizes: 2x2, 4x4, 8x8 km.
|
165
|
+
⚙️ Advanced settings: enabled.
|
166
|
+
🖼️ Texture dissolving: enabled.
|
167
|
+
Using the public version on [maps4fs.xyz](https://maps4fs.xyz) is the easiest way to generate a map template. Just open the link and follow the instructions.
|
175
168
|
Note: due to CPU and RAM limitations of the hosting, the generation may take some time. If you need faster processing, use the [Docker version](#option-2-docker-version).<br>
|
176
169
|
|
177
170
|
Using it is easy and doesn't require any guides. Enjoy!
|
@@ -488,6 +481,8 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
488
481
|
|
489
482
|
- Fields padding - this value (in meters) will be applied to each field, making it smaller. It's useful when the fields are too close to each other and you want to make them smaller. By default, it's set to 0.
|
490
483
|
|
484
|
+
- Texture dissolving - if enabled, the values from one layer will be splitted between different layers of texture, making it look more natural. By default, it's set to True. Can be turned of for faster processing.
|
485
|
+
|
491
486
|
### Farmlands Advanced settings
|
492
487
|
|
493
488
|
- Farmlands margin - this value (in meters) will be applied to each farmland, making it bigger. You can use the value to adjust how much the farmland should be bigger than the actual field. By default, it's set to 3.
|
@@ -498,6 +493,12 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
498
493
|
|
499
494
|
- Random plants - when adding decorative foliage, enabling this option will add different species of plants to the map. If unchecked only basic grass (smallDenseMix) will be added. Defaults to True.
|
500
495
|
|
496
|
+
### Background terrain Advanced settings
|
497
|
+
|
498
|
+
- Generate background - if enabled, the obj files for the background terrain will be generated. You can turn it off if you already have those files or don't need them. By default, it's set to True.
|
499
|
+
|
500
|
+
- Generate water - if enabled, the water planes obj files will be generated. You can turn it off if you already have those files or don't need them. By default, it's set to True.
|
501
|
+
|
501
502
|
## Resources
|
502
503
|
In this section, you'll find a list of the resources that you need to create a map for the Farming Simulator.<br>
|
503
504
|
To create a basic map, you only need the Giants Editor. But if you want to create a background terrain - the world around the map, so it won't look like it's floating in the void - you also need Blender and the Blender Exporter Plugins. To create realistic textures for the background terrain, the QGIS is required to obtain high-resolution satellite images.<br>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
maps4fs/__init__.py,sha256=MlM_vkLH_22xoBwhoRD52JDECCmeAJ8gBQr7RMQZmis,261
|
2
|
+
maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
|
3
|
+
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
+
maps4fs/generator/background.py,sha256=mVffAsVyerd8t17c3pLQMStkdM_cYVoqreQq1XeqfVo,22318
|
5
|
+
maps4fs/generator/component.py,sha256=XN-3Zx0bujugpuRk3YB-pYNwUHREdyt_cLxPd7pr57g,17967
|
6
|
+
maps4fs/generator/config.py,sha256=b7qY0luC-_WM_c72Ohtlf4FrB37X5cALInbestSdUsw,4382
|
7
|
+
maps4fs/generator/dem.py,sha256=5PMooBbDk_HrSOwu3ha7QvWc2AyzBNf-ELmZoIFzPL0,15946
|
8
|
+
maps4fs/generator/game.py,sha256=ZQeYzPzPB3CG41avdhNCyTZpHEeedqNBuAbNevTZuXg,7931
|
9
|
+
maps4fs/generator/grle.py,sha256=zdYM-MHGfa3CHKgnOnd4EpCKF6HfY_sUfeJbo7-cic0,17489
|
10
|
+
maps4fs/generator/i3d.py,sha256=fsKveRWQk68fpWRwMYqSL4RfHkD0dLUyNHi_iAyANso,18225
|
11
|
+
maps4fs/generator/map.py,sha256=r0yEqQB56aqo0MxZMVLdP8w9xmQao0R3WTp6Sg-C4bY,7913
|
12
|
+
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
13
|
+
maps4fs/generator/texture.py,sha256=57R0v4QuB-tnr_75hgGxfUTX5ennrULkhqiDNTgzi4s,27629
|
14
|
+
maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
15
|
+
maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
|
16
|
+
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
17
|
+
maps4fs-1.3.1.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
18
|
+
maps4fs-1.3.1.dist-info/METADATA,sha256=bL-S19qV6nsg22XWF2CRepeyyGHWABFKrq4O3eCQk0E,30673
|
19
|
+
maps4fs-1.3.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
20
|
+
maps4fs-1.3.1.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
21
|
+
maps4fs-1.3.1.dist-info/RECORD,,
|
maps4fs-1.2.8.dist-info/RECORD
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
maps4fs/__init__.py,sha256=da4jmND2Ths9AffnkAKgzLHNkvKFOc_l21gJisPXqWY,155
|
2
|
-
maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
|
3
|
-
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
-
maps4fs/generator/background.py,sha256=21xB-xn2A6QGdX9UVWqvzoW-L6JWPAZOqCcIhR8nxKU,22689
|
5
|
-
maps4fs/generator/component.py,sha256=SeI1xfwo9I4lrkcOcHyjxMffHsG8OXc80-mNsR2zpPw,17748
|
6
|
-
maps4fs/generator/config.py,sha256=b7qY0luC-_WM_c72Ohtlf4FrB37X5cALInbestSdUsw,4382
|
7
|
-
maps4fs/generator/dem.py,sha256=rc7ADzjvlZzStOqagsWW0Vrm9-X86aPpoR1RhBF_-OE,16025
|
8
|
-
maps4fs/generator/game.py,sha256=ZQeYzPzPB3CG41avdhNCyTZpHEeedqNBuAbNevTZuXg,7931
|
9
|
-
maps4fs/generator/grle.py,sha256=3hcr5e2YLXemFi-_x2cLHWbMVb06591k0PZxaBVovH8,17600
|
10
|
-
maps4fs/generator/i3d.py,sha256=oK5pKjzvT-gydma5Q6CcDYTVODGxK7MIGajLrAV9JkU,18370
|
11
|
-
maps4fs/generator/map.py,sha256=lA1MNAcMwsDtsYxbwwm7DjwP3zraHKnri_xnLUu30j0,5326
|
12
|
-
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
13
|
-
maps4fs/generator/texture.py,sha256=lde8BiI0ANuwvG1zupUjm-ESoyf_KSqwYjVT993nj8g,27612
|
14
|
-
maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
15
|
-
maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
|
16
|
-
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
17
|
-
maps4fs-1.2.8.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
18
|
-
maps4fs-1.2.8.dist-info/METADATA,sha256=dnsI_u7IAvNE5onxGEM7tFhmOpA1LlQGar3iRmyPhn0,30600
|
19
|
-
maps4fs-1.2.8.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
20
|
-
maps4fs-1.2.8.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
21
|
-
maps4fs-1.2.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|