maps4fs 1.8.237__py3-none-any.whl → 1.8.239__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.
@@ -3,7 +3,6 @@ around the map."""
3
3
 
4
4
  from __future__ import annotations
5
5
 
6
- import json
7
6
  import os
8
7
  import shutil
9
8
  from copy import deepcopy
@@ -145,7 +144,7 @@ class Background(MeshComponent, ImageComponent):
145
144
 
146
145
  mean_value = cv2.mean(dem_image, mask=mask)[0]
147
146
  mean_value = np.round(mean_value).astype(dem_image.dtype)
148
- self.logger.info("Mean value of the building area: %s", mean_value)
147
+ self.logger.debug("Mean value of the building area: %s", mean_value)
149
148
 
150
149
  # Set the pixel values in the DEM to the average pixel value.
151
150
  dem_image[mask == 255] = mean_value
@@ -401,13 +400,11 @@ class Background(MeshComponent, ImageComponent):
401
400
 
402
401
  def create_background_textures(self) -> None:
403
402
  """Creates background textures for the map."""
404
- if not os.path.isfile(self.game.texture_schema):
405
- self.logger.warning("Texture schema file not found: %s", self.game.texture_schema)
403
+ layers_schema = self.map.texture_schema
404
+ if not layers_schema:
405
+ self.logger.warning("No texture schema found.")
406
406
  return
407
407
 
408
- with open(self.game.texture_schema, "r", encoding="utf-8") as f:
409
- layers_schema = json.load(f)
410
-
411
408
  background_layers = []
412
409
  for layer in layers_schema:
413
410
  if layer.get("background") is True:
@@ -104,10 +104,8 @@ class GRLE(ImageComponent, XMLComponent):
104
104
  self.logger.warning("Invalid InfoLayer schema: %s.", info_layer)
105
105
 
106
106
  self._add_farmlands()
107
- if self.game.plants_processing:
107
+ if self.game.plants_processing and self.map.grle_settings.add_grass:
108
108
  self._add_plants()
109
- else:
110
- self.logger.warning("Adding plants it's not supported for the %s.", self.game.code)
111
109
 
112
110
  def previews(self) -> list[str]:
113
111
  """Returns a list of paths to the preview images (empty list).
@@ -56,7 +56,9 @@ class I3d(XMLComponent):
56
56
 
57
57
  if self.game.i3d_processing:
58
58
  self._add_fields()
59
- self._add_forests()
59
+
60
+ if self.map.i3d_settings.add_trees:
61
+ self._add_forests()
60
62
  self._add_splines()
61
63
 
62
64
  def update_height_scale(self, value: int | None = None) -> None:
maps4fs/generator/map.py CHANGED
@@ -184,6 +184,18 @@ class Map:
184
184
  except Exception as e:
185
185
  raise RuntimeError(f"Can not unpack map template due to error: {e}") from e
186
186
 
187
+ @property
188
+ def texture_schema(self) -> list[dict[str, Any]] | None:
189
+ """Return texture schema (custom if provided, default otherwise).
190
+
191
+ Returns:
192
+ list[dict[str, Any]] | None: Texture schema.
193
+ """
194
+ if self.texture_custom_schema:
195
+ return self.texture_custom_schema
196
+ with open(self.game.texture_schema, "r", encoding="utf-8") as file:
197
+ return json.load(file)
198
+
187
199
  def generate(self) -> Generator[str, None, None]:
188
200
  """Launch map generation using all components. Yield component names during the process.
189
201
 
@@ -167,11 +167,12 @@ class GRLESettings(SettingsModel):
167
167
  """
168
168
 
169
169
  farmland_margin: int = 0
170
- random_plants: bool = True
171
170
  add_farmyards: bool = False
172
171
  base_price: int = 60000
173
172
  price_scale: int = 100
173
+ add_grass: bool = True
174
174
  base_grass: tuple | str = ("smallDenseMix", "meadow")
175
+ random_plants: bool = True
175
176
  plants_island_minimum_size: int = 10
176
177
  plants_island_maximum_size: int = 200
177
178
  plants_island_vertex_count: int = 30
@@ -187,6 +188,7 @@ class I3DSettings(SettingsModel):
187
188
  forest_density (int): density of the forest (distance between trees).
188
189
  """
189
190
 
191
+ add_trees: bool = True
190
192
  forest_density: int = 10
191
193
  trees_relative_shift: int = 20
192
194
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.237
3
+ Version: 1.8.239
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
@@ -613,6 +613,8 @@ You can also apply some advanced settings to the map generation process.<br>
613
613
 
614
614
  - 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.
615
615
 
616
+ - Add grass - if enabled, the tool will add grass to all the empty areas (without roads, fields, buildings, etc.). By default, it's set to True.
617
+
616
618
  - 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.
617
619
 
618
620
  - Add Farmyards - if enabled, the tool will create farmlands from the regions that are marked as farmyards in the OSM data. Those farmlands will not have fields and also will not be drawn on textures. By default, it's turned off.
@@ -637,6 +639,8 @@ You can also apply some advanced settings to the map generation process.<br>
637
639
 
638
640
  ### I3D Advanced settings
639
641
 
642
+ - Add trees - if enabled, the tool will add trees to the map on the areas, that defined as forests in the OSM data. By default, it's set to True.
643
+
640
644
  - Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
641
645
 
642
646
  - Trees relative shift - represents the maximum possible shift of the tree from it's original position in percents of the forest density value. The higher the value, the more the trees will be shifted from their original positions. Warning: higher values can lead to overlapping trees.
@@ -3,15 +3,15 @@ maps4fs/logger.py,sha256=HQrDyj72mUjVYo25aR_-_SxVn2rfFjDCNbj-JKJdSnE,1488
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
4
  maps4fs/generator/dem.py,sha256=a9B3tatj7pzvvdLIyLw7BA3JoDTibFczpqiXJnx054U,12864
5
5
  maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
6
- maps4fs/generator/map.py,sha256=tgbpu3xxtFFWMualvaOnfnBXjDYWqAa_xIpu-OvcnbQ,12636
6
+ maps4fs/generator/map.py,sha256=9tQTEMYvh4RSC5ACp7fE7RhVDGa7Mc-P5W95h-Zineg,13069
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
- maps4fs/generator/settings.py,sha256=-QdpmIoMiWXPeqYX5QQ5Pplz9xHk2OnyBdzRIc7aB44,6848
8
+ maps4fs/generator/settings.py,sha256=KFyzqtJ2BwjuESRzqSWyNuFlHS7W_wc8K_1tkLRKHwQ,6902
9
9
  maps4fs/generator/statistics.py,sha256=aynS3zbAtiwnU_YLKHPTiiaKW98_suvQUhy1SGBA6mc,2448
10
10
  maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
11
- maps4fs/generator/component/background.py,sha256=RhUDOTfo7Ph9B2bM5tp85wTg6FKycpsf1L_pHYa2TLc,21152
11
+ maps4fs/generator/component/background.py,sha256=Pr2dKNghC4ds9Gm8pj7LPWdAX-twYGy1Nfj7QY7pXX4,21012
12
12
  maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
13
- maps4fs/generator/component/grle.py,sha256=C6wpYQrJBVRb3vVbEAY5BYTRYU9BaefmoWCXoPrVn2A,19454
14
- maps4fs/generator/component/i3d.py,sha256=yWGs5eBuBT7V4F6SbTNAmF-8fj2Zy4kcC5OKZ_XVICs,21329
13
+ maps4fs/generator/component/grle.py,sha256=KlNbbYY4oyFfB_0qTInrweBTyLUW0koSSpqclkRw-Lk,19381
14
+ maps4fs/generator/component/i3d.py,sha256=9OhGHFrgf8i9ZV9sKKVPLGMAUcSGZjNOxwSC38zRa9k,21382
15
15
  maps4fs/generator/component/layer.py,sha256=QPcEzTv_8N9wYvHAZy8OezfATaVLG-YetSfCXf2lnFI,5892
16
16
  maps4fs/generator/component/satellite.py,sha256=oZBHjP_QY0ik1-Vk7JqMS__zIG8ffw2voeozB7-HUQc,4946
17
17
  maps4fs/generator/component/texture.py,sha256=GWOE7w2maydB2LDku-YEC1w1oc8kcnnZ1SPTL6b82H8,30966
@@ -53,8 +53,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
53
53
  maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
54
54
  maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
55
55
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
56
- maps4fs-1.8.237.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
57
- maps4fs-1.8.237.dist-info/METADATA,sha256=cYwHiebwnB_vFE-JNMqZBw2xXiU4XNL5rJjWAOpldCY,46159
58
- maps4fs-1.8.237.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
- maps4fs-1.8.237.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
60
- maps4fs-1.8.237.dist-info/RECORD,,
56
+ maps4fs-1.8.239.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
57
+ maps4fs-1.8.239.dist-info/METADATA,sha256=L0YjvVUo7vfcZFyThtfKyEhJTfME1X8q_PXiwlb8nXY,46452
58
+ maps4fs-1.8.239.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
+ maps4fs-1.8.239.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
60
+ maps4fs-1.8.239.dist-info/RECORD,,