maps4fs 1.8.250__py3-none-any.whl → 1.8.252__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.
@@ -510,6 +510,18 @@ class Background(MeshComponent, ImageComponent):
510
510
  cv2.imwrite(self.output_path, dem_image)
511
511
  self.logger.debug("Water depth subtracted from DEM data: %s", self.output_path)
512
512
 
513
+ def _get_blur_power(self) -> int:
514
+ """Returns the blur power for the water resources to apply Gaussian blur.
515
+
516
+ Returns:
517
+ int: The blur power for the water resources.
518
+ """
519
+ blur_power = max(3, min(self.map.background_settings.water_blurriness, 99))
520
+ if blur_power % 2 == 0:
521
+ blur_power += 1
522
+
523
+ return blur_power
524
+
513
525
  def generate_water_resources_obj(self) -> None:
514
526
  """Generates 3D obj files based on water resources data."""
515
527
  if not os.path.isfile(self.water_resources_path):
@@ -533,6 +545,13 @@ class Background(MeshComponent, ImageComponent):
533
545
  # Single channeled 16 bit DEM image of terrain.
534
546
  background_dem = cv2.imread(self.not_substracted_path, cv2.IMREAD_UNCHANGED)
535
547
 
548
+ if self.map.background_settings.water_blurriness:
549
+ # Apply Gaussian blur to the background dem.
550
+ blur_power = self._get_blur_power()
551
+ background_dem = cv2.GaussianBlur(
552
+ background_dem, (blur_power, blur_power), sigmaX=blur_power, sigmaY=blur_power
553
+ )
554
+
536
555
  # Remove all the values from the background dem where the plane_water is 0.
537
556
  background_dem[plane_water == 0] = 0
538
557
 
@@ -173,18 +173,22 @@ class GRLE(ImageComponent, XMLComponent):
173
173
  def _add_farmlands(self) -> None:
174
174
  """Adds farmlands to the InfoLayer PNG file."""
175
175
  farmlands = []
176
+
177
+ fields = self.get_infolayer_data(Parameters.TEXTURES, Parameters.FIELDS)
178
+ if fields:
179
+ self.logger.debug("Found %s fields in textures info layer.", len(fields))
180
+ farmlands.extend(fields)
181
+
176
182
  farmyards = self.get_infolayer_data(Parameters.TEXTURES, Parameters.FARMYARDS)
177
183
  if farmyards and self.map.grle_settings.add_farmyards:
178
184
  farmlands.extend(farmyards)
179
185
  self.logger.debug("Found %s farmyards in textures info layer.", len(farmyards))
180
186
 
181
- fields = self.get_infolayer_data(Parameters.TEXTURES, Parameters.FIELDS)
182
- if not fields:
183
- self.logger.debug("Fields data not found in textures info layer.")
187
+ if not farmlands:
188
+ self.logger.warning(
189
+ "No farmlands was obtained from fields or farmyards, skipping the processing."
190
+ )
184
191
  return
185
- farmlands.extend(fields)
186
-
187
- self.logger.debug("Found %s fields in textures info layer.", len(fields))
188
192
 
189
193
  info_layer_farmlands_path = self.game.get_farmlands_path(self.map_directory)
190
194
 
@@ -149,6 +149,7 @@ class BackgroundSettings(SettingsModel):
149
149
 
150
150
  generate_background: bool = False
151
151
  generate_water: bool = False
152
+ water_blurriness: int = 20
152
153
  resize_factor: int = 8
153
154
  remove_center: bool = True
154
155
  apply_decimation: bool = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 1.8.250
3
+ Version: 1.8.252
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
@@ -601,6 +601,8 @@ You can also apply some advanced settings to the map generation process.<br>
601
601
 
602
602
  - 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.
603
603
 
604
+ - Water blurriness - used to make the water surface smoother. The higher the value, the more flat surface of the water planes will be. However, too high values can lead to the water planes mesh not matching the terrain.
605
+
604
606
  - Resize factor - the factor by which the background terrain will be resized. It will be used as 1 / resize_factor while generating the models. Which means that the larger the value the more the terrain will be resized. The lowest value is 1, in this case background terrain will not be resized. Note, than low values will lead to long processing and enormous size of the obj files.
605
607
 
606
608
  - Remove center - if enabled, the playable region (map terrain) will be removed from the background terrain. By default, it's set to True.
@@ -5,12 +5,12 @@ maps4fs/generator/dem.py,sha256=CDfdDGCWhFn2_QYY5TtxgsXm3lgJ4W4qD-46UU3u-ck,1320
5
5
  maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
6
6
  maps4fs/generator/map.py,sha256=64uIHCwfpFyFXZJSayB0tuRFn0LVuTwf0wrAi4KMv00,13600
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
- maps4fs/generator/settings.py,sha256=285LjC5mUuzpHNPubBqd928MU7Yd_ZlLEnkBY3RbiHs,6937
8
+ maps4fs/generator/settings.py,sha256=E5sfkfJgcjh9QHpa7ILlV_jnrF6USpsOFxkooVnxrbs,6968
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=gqKQnyHZ58i54KkU6m-zhZui5081Z7GaXAimGB-xJgM,22153
11
+ maps4fs/generator/component/background.py,sha256=hsyNmHgi9NUcp3SoSawJeCDJY3tJNDMwmb_x1ovi0Fg,22852
12
12
  maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
13
- maps4fs/generator/component/grle.py,sha256=KlNbbYY4oyFfB_0qTInrweBTyLUW0koSSpqclkRw-Lk,19381
13
+ maps4fs/generator/component/grle.py,sha256=99CFheRn2aDuE041iZj2usmh5spKSryKg3L848jVWdg,19475
14
14
  maps4fs/generator/component/i3d.py,sha256=iVXYYGzDpSp5J7vAo_LFnDA8GDAy43Y6aUIf7yP_ZTI,23101
15
15
  maps4fs/generator/component/layer.py,sha256=hbTBMLamKOWv_MXbnk-LjLyNV91jPsF33UEc17rBZCM,6185
16
16
  maps4fs/generator/component/satellite.py,sha256=oZBHjP_QY0ik1-Vk7JqMS__zIG8ffw2voeozB7-HUQc,4946
@@ -54,8 +54,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
54
54
  maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
55
55
  maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
56
56
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
57
- maps4fs-1.8.250.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
58
- maps4fs-1.8.250.dist-info/METADATA,sha256=1Z_9w4Lf6h6jhymM3eANMJZz9gX3M0pnzy48hQRfv1g,47222
59
- maps4fs-1.8.250.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
60
- maps4fs-1.8.250.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
61
- maps4fs-1.8.250.dist-info/RECORD,,
57
+ maps4fs-1.8.252.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
58
+ maps4fs-1.8.252.dist-info/METADATA,sha256=mzBKk-bH_1vcnlmLvPM9WRrvKIpmaPU2mhDcCzAxSSQ,47443
59
+ maps4fs-1.8.252.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
60
+ maps4fs-1.8.252.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
61
+ maps4fs-1.8.252.dist-info/RECORD,,