maps4fs 1.3.4__py3-none-any.whl → 1.3.6__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.
Potentially problematic release.
This version of maps4fs might be problematic. Click here for more details.
- maps4fs/generator/background.py +1 -1
- maps4fs/generator/i3d.py +25 -20
- maps4fs/generator/map.py +8 -0
- maps4fs/generator/texture.py +4 -1
- {maps4fs-1.3.4.dist-info → maps4fs-1.3.6.dist-info}/METADATA +3 -1
- {maps4fs-1.3.4.dist-info → maps4fs-1.3.6.dist-info}/RECORD +9 -9
- {maps4fs-1.3.4.dist-info → maps4fs-1.3.6.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.3.4.dist-info → maps4fs-1.3.6.dist-info}/WHEEL +0 -0
- {maps4fs-1.3.4.dist-info → maps4fs-1.3.6.dist-info}/top_level.txt +0 -0
maps4fs/generator/background.py
CHANGED
@@ -476,7 +476,7 @@ class Background(Component):
|
|
476
476
|
rotation=self.rotation,
|
477
477
|
map_directory=self.map_directory,
|
478
478
|
logger=self.logger,
|
479
|
-
|
479
|
+
texture_custom_schema=background_layers, # type: ignore
|
480
480
|
)
|
481
481
|
|
482
482
|
self.background_texture.preprocess()
|
maps4fs/generator/i3d.py
CHANGED
@@ -54,7 +54,8 @@ class I3d(Component):
|
|
54
54
|
"""Updates the map I3D file with the default settings."""
|
55
55
|
self._update_i3d_file()
|
56
56
|
self._add_fields()
|
57
|
-
self.
|
57
|
+
if self.game.code == "FS25":
|
58
|
+
self._add_forests()
|
58
59
|
|
59
60
|
def _get_tree(self) -> ET.ElementTree | None:
|
60
61
|
"""Returns the ElementTree instance of the map I3D file."""
|
@@ -327,24 +328,28 @@ class I3d(Component):
|
|
327
328
|
# pylint: disable=R0911
|
328
329
|
def _add_forests(self) -> None:
|
329
330
|
"""Adds forests to the map I3D file."""
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
331
|
+
custom_schema = self.kwargs.get("tree_custom_schema")
|
332
|
+
if custom_schema:
|
333
|
+
tree_schema = custom_schema
|
334
|
+
else:
|
335
|
+
try:
|
336
|
+
tree_schema_path = self.game.tree_schema
|
337
|
+
except ValueError:
|
338
|
+
self.logger.warning("Tree schema path not set for the Game %s.", self.game.code)
|
339
|
+
return
|
340
|
+
|
341
|
+
if not os.path.isfile(tree_schema_path):
|
342
|
+
self.logger.warning("Tree schema file was not found: %s.", tree_schema_path)
|
343
|
+
return
|
344
|
+
|
345
|
+
try:
|
346
|
+
with open(tree_schema_path, "r", encoding="utf-8") as tree_schema_file:
|
347
|
+
tree_schema = json.load(tree_schema_file) # type: ignore
|
348
|
+
except json.JSONDecodeError as e:
|
349
|
+
self.logger.warning(
|
350
|
+
"Could not load tree schema from %s with error: %s", tree_schema_path, e
|
351
|
+
)
|
352
|
+
return
|
348
353
|
|
349
354
|
texture_component: Texture | None = self.map.get_component("Texture") # type: ignore
|
350
355
|
if not texture_component:
|
@@ -399,7 +404,7 @@ class I3d(Component):
|
|
399
404
|
(xcs, ycs), self.map.i3d_settings.forest_density
|
400
405
|
)
|
401
406
|
|
402
|
-
random_tree = choice(tree_schema)
|
407
|
+
random_tree = choice(tree_schema) # type: ignore
|
403
408
|
tree_name = random_tree["name"]
|
404
409
|
tree_id = random_tree["reference_id"]
|
405
410
|
|
maps4fs/generator/map.py
CHANGED
@@ -71,10 +71,12 @@ class TextureSettings(NamedTuple):
|
|
71
71
|
Attributes:
|
72
72
|
dissolve (bool): dissolve the texture into several images.
|
73
73
|
fields_padding (int): padding around the fields.
|
74
|
+
skip_drains (bool): skip drains generation.
|
74
75
|
"""
|
75
76
|
|
76
77
|
dissolve: bool = True
|
77
78
|
fields_padding: int = 0
|
79
|
+
skip_drains: bool = False
|
78
80
|
|
79
81
|
|
80
82
|
# pylint: disable=R0913, R0902
|
@@ -102,6 +104,7 @@ class Map:
|
|
102
104
|
grle_settings: GRLESettings = GRLESettings(),
|
103
105
|
i3d_settings: I3DSettings = I3DSettings(),
|
104
106
|
texture_settings: TextureSettings = TextureSettings(),
|
107
|
+
**kwargs,
|
105
108
|
):
|
106
109
|
if not logger:
|
107
110
|
logger = Logger(to_stdout=True, to_file=False)
|
@@ -137,6 +140,9 @@ class Map:
|
|
137
140
|
os.makedirs(self.map_directory, exist_ok=True)
|
138
141
|
self.logger.debug("Map directory created: %s", self.map_directory)
|
139
142
|
|
143
|
+
self.texture_custom_schema = kwargs.get("texture_custom_schema", None)
|
144
|
+
self.tree_custom_schema = kwargs.get("tree_custom_schema", None)
|
145
|
+
|
140
146
|
try:
|
141
147
|
shutil.unpack_archive(game.template_path, self.map_directory)
|
142
148
|
self.logger.debug("Map template unpacked to %s", self.map_directory)
|
@@ -167,6 +173,8 @@ class Map:
|
|
167
173
|
self.rotation,
|
168
174
|
self.map_directory,
|
169
175
|
self.logger,
|
176
|
+
texture_custom_schema=self.texture_custom_schema,
|
177
|
+
tree_custom_schema=self.tree_custom_schema,
|
170
178
|
)
|
171
179
|
self.components.append(component)
|
172
180
|
|
maps4fs/generator/texture.py
CHANGED
@@ -178,7 +178,7 @@ class Texture(Component):
|
|
178
178
|
|
179
179
|
def preprocess(self) -> None:
|
180
180
|
"""Preprocesses the data before the generation."""
|
181
|
-
custom_schema = self.kwargs.get("
|
181
|
+
custom_schema = self.kwargs.get("texture_custom_schema")
|
182
182
|
if custom_schema:
|
183
183
|
layers_schema = custom_schema # type: ignore
|
184
184
|
self.logger.info("Custom schema loaded with %s layers.", len(layers_schema))
|
@@ -388,6 +388,9 @@ class Texture(Component):
|
|
388
388
|
info_layer_data = defaultdict(list)
|
389
389
|
|
390
390
|
for layer in layers:
|
391
|
+
if self.map.texture_settings.skip_drains and layer.usage == "drain":
|
392
|
+
self.logger.debug("Skipping layer %s because of the usage.", layer.name)
|
393
|
+
continue
|
391
394
|
if not layer.tags:
|
392
395
|
self.logger.debug("Layer %s has no tags, there's nothing to draw.", layer.name)
|
393
396
|
continue
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: maps4fs
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.6
|
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
|
@@ -483,6 +483,8 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
483
483
|
|
484
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
485
|
|
486
|
+
- Skip drains - if enabled, the tool will not generate the drains and ditches on the map. By default, it's set to False. Use this if you don't need the drains on the map.
|
487
|
+
|
486
488
|
### Farmlands Advanced settings
|
487
489
|
|
488
490
|
- 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.
|
@@ -1,21 +1,21 @@
|
|
1
1
|
maps4fs/__init__.py,sha256=MlM_vkLH_22xoBwhoRD52JDECCmeAJ8gBQr7RMQZmis,261
|
2
2
|
maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
|
3
3
|
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
-
maps4fs/generator/background.py,sha256=
|
4
|
+
maps4fs/generator/background.py,sha256=KFoO6GKaNrJDUoMrDyeroZG63Cv9aGkMgHaa0QYEpiU,22306
|
5
5
|
maps4fs/generator/component.py,sha256=XN-3Zx0bujugpuRk3YB-pYNwUHREdyt_cLxPd7pr57g,17967
|
6
6
|
maps4fs/generator/config.py,sha256=0QmK052B8bxyHVhg3jzCORLfOBMMmqVfhhbqXKf6OMk,4383
|
7
7
|
maps4fs/generator/dem.py,sha256=MZf3ZjawJ977TxqB1q9nNpvPZUNwfmm2EaJDtVU-eCU,15939
|
8
8
|
maps4fs/generator/game.py,sha256=ZQeYzPzPB3CG41avdhNCyTZpHEeedqNBuAbNevTZuXg,7931
|
9
9
|
maps4fs/generator/grle.py,sha256=xKIpyhYsZol-IXcBULbX7wWZ1n83BWTZqaf8FLodchE,17499
|
10
|
-
maps4fs/generator/i3d.py,sha256=
|
11
|
-
maps4fs/generator/map.py,sha256=
|
10
|
+
maps4fs/generator/i3d.py,sha256=bW7FLAISFKCPUmad7ANz1loWI07oEZlEQOEL_tv0YmQ,18483
|
11
|
+
maps4fs/generator/map.py,sha256=a-nwDsKq6u9RLB2htueXtJtdDZbocpj_KxGhBw5AoEI,8776
|
12
12
|
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
13
|
-
maps4fs/generator/texture.py,sha256=
|
13
|
+
maps4fs/generator/texture.py,sha256=tNhv-_AOrv4Wf7knbrN9LZBkvApgsrGffGPAzZScr7g,27745
|
14
14
|
maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
15
15
|
maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
|
16
16
|
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
17
|
-
maps4fs-1.3.
|
18
|
-
maps4fs-1.3.
|
19
|
-
maps4fs-1.3.
|
20
|
-
maps4fs-1.3.
|
21
|
-
maps4fs-1.3.
|
17
|
+
maps4fs-1.3.6.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
18
|
+
maps4fs-1.3.6.dist-info/METADATA,sha256=pczjM5FWcRCAJiNtW3JRwl0SeNYEAlQUwc1V2UWyjtY,31082
|
19
|
+
maps4fs-1.3.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
20
|
+
maps4fs-1.3.6.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
21
|
+
maps4fs-1.3.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|