maps4fs 1.8.184__tar.gz → 1.8.186__tar.gz

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.
Files changed (60) hide show
  1. {maps4fs-1.8.184 → maps4fs-1.8.186}/PKG-INFO +23 -21
  2. {maps4fs-1.8.184 → maps4fs-1.8.186}/README.md +22 -20
  3. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/__init__.py +2 -0
  4. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/background.py +1 -1
  5. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/base/component_image.py +22 -0
  6. maps4fs-1.8.186/maps4fs/generator/component/layer.py +162 -0
  7. {maps4fs-1.8.184/maps4fs/generator → maps4fs-1.8.186/maps4fs/generator/component}/texture.py +161 -286
  8. maps4fs-1.8.186/maps4fs/generator/dtm/baden.py +31 -0
  9. maps4fs-1.8.186/maps4fs/generator/dtm/mv.py +42 -0
  10. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/game.py +11 -2
  11. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/map.py +4 -3
  12. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs.egg-info/PKG-INFO +23 -21
  13. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs.egg-info/SOURCES.txt +4 -1
  14. {maps4fs-1.8.184 → maps4fs-1.8.186}/pyproject.toml +1 -1
  15. {maps4fs-1.8.184 → maps4fs-1.8.186}/LICENSE.md +0 -0
  16. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/__init__.py +0 -0
  17. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/__init__.py +0 -0
  18. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/base/__init__.py +0 -0
  19. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/base/component.py +0 -0
  20. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/base/component_mesh.py +0 -0
  21. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/base/component_xml.py +0 -0
  22. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/config.py +0 -0
  23. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/grle.py +0 -0
  24. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/i3d.py +0 -0
  25. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/component/satellite.py +0 -0
  26. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dem.py +0 -0
  27. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/__init__.py +0 -0
  28. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/base/wcs.py +0 -0
  29. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/base/wms.py +0 -0
  30. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/bavaria.py +0 -0
  31. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/canada.py +0 -0
  32. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/denmark.py +0 -0
  33. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/dtm.py +0 -0
  34. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/england.py +0 -0
  35. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/finland.py +0 -0
  36. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/flanders.py +0 -0
  37. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/france.py +0 -0
  38. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/hessen.py +0 -0
  39. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/italy.py +0 -0
  40. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/niedersachsen.py +0 -0
  41. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/norway.py +0 -0
  42. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/nrw.py +0 -0
  43. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/scotland.py +0 -0
  44. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/spain.py +0 -0
  45. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/srtm.py +0 -0
  46. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/switzerland.py +0 -0
  47. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/usgs.py +0 -0
  48. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/dtm/utils.py +0 -0
  49. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/qgis.py +0 -0
  50. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/generator/settings.py +0 -0
  51. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/logger.py +0 -0
  52. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/toolbox/__init__.py +0 -0
  53. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/toolbox/background.py +0 -0
  54. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/toolbox/custom_osm.py +0 -0
  55. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs/toolbox/dem.py +0 -0
  56. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs.egg-info/dependency_links.txt +0 -0
  57. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs.egg-info/requires.txt +0 -0
  58. {maps4fs-1.8.184 → maps4fs-1.8.186}/maps4fs.egg-info/top_level.txt +0 -0
  59. {maps4fs-1.8.184 → maps4fs-1.8.186}/setup.cfg +0 -0
  60. {maps4fs-1.8.184 → maps4fs-1.8.186}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.184
3
+ Version: 1.8.186
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
@@ -686,29 +686,31 @@ The generator supports adding the own DTM providers, please refer to the [DTM Pr
686
686
 
687
687
  ### Supported DTM providers
688
688
 
689
- ![coverage map](https://github.com/user-attachments/assets/138fa637-ce63-4dd9-bd11-bf92fe038a74)
689
+ ![coverage map](https://github.com/user-attachments/assets/e02a4b5e-c5a9-4e6f-826f-048081704ef9)
690
690
 
691
691
  In addition to SRTM 30m, which provides global coverage, the map above highlights all countries and/or regions where higher resolution coverage is provided by one of the DTM providers.
692
692
 
693
- | Provider Name | Resolution | Developer |
694
- | ------------------------------- | ------------ | ------------------------------------------- |
695
- | 🌎 SRTM30 | 30 meters | [iwatkot](https://github.com/iwatkot) |
696
- | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
697
- | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
698
- | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
699
- | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
700
- | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
701
- | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
702
- | 🇩🇪 Nordrhein-Westfalen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
703
- | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
- | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
705
- | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
- | 🇮🇹 Italy | 10 meter | [kbrandwijk](https://github.com/kbrandwijk) |
707
- | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
708
- | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
709
- | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
710
- | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
711
- | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
693
+ | Provider Name | Resolution | Developer |
694
+ | ---------------------------------- | ------------ | ------------------------------------------- |
695
+ | 🌎 SRTM30 | 30 meters | [iwatkot](https://github.com/iwatkot) |
696
+ | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
697
+ | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
698
+ | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
699
+ | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
700
+ | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
701
+ | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
702
+ | 🇩🇪 Nordrhein-Westfalen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
703
+ | 🇩🇪 Mecklenburg-Vorpommern, Germany | 1-25 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
+ | 🇩🇪 Baden-Württemberg, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
705
+ | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
+ | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
707
+ | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
708
+ | 🇮🇹 Italy | 10 meter | [kbrandwijk](https://github.com/kbrandwijk) |
709
+ | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
710
+ | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
711
+ | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
712
+ | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
713
+ | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
712
714
 
713
715
  ## Special thanks
714
716
 
@@ -656,29 +656,31 @@ The generator supports adding the own DTM providers, please refer to the [DTM Pr
656
656
 
657
657
  ### Supported DTM providers
658
658
 
659
- ![coverage map](https://github.com/user-attachments/assets/138fa637-ce63-4dd9-bd11-bf92fe038a74)
659
+ ![coverage map](https://github.com/user-attachments/assets/e02a4b5e-c5a9-4e6f-826f-048081704ef9)
660
660
 
661
661
  In addition to SRTM 30m, which provides global coverage, the map above highlights all countries and/or regions where higher resolution coverage is provided by one of the DTM providers.
662
662
 
663
- | Provider Name | Resolution | Developer |
664
- | ------------------------------- | ------------ | ------------------------------------------- |
665
- | 🌎 SRTM30 | 30 meters | [iwatkot](https://github.com/iwatkot) |
666
- | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
667
- | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
668
- | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
669
- | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
670
- | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
671
- | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
672
- | 🇩🇪 Nordrhein-Westfalen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
673
- | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
674
- | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
675
- | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
676
- | 🇮🇹 Italy | 10 meter | [kbrandwijk](https://github.com/kbrandwijk) |
677
- | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
678
- | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
679
- | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
680
- | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
681
- | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
663
+ | Provider Name | Resolution | Developer |
664
+ | ---------------------------------- | ------------ | ------------------------------------------- |
665
+ | 🌎 SRTM30 | 30 meters | [iwatkot](https://github.com/iwatkot) |
666
+ | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
667
+ | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
668
+ | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
669
+ | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
670
+ | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
671
+ | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
672
+ | 🇩🇪 Nordrhein-Westfalen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
673
+ | 🇩🇪 Mecklenburg-Vorpommern, Germany | 1-25 meter | [kbrandwijk](https://github.com/kbrandwijk) |
674
+ | 🇩🇪 Baden-Württemberg, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
675
+ | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
676
+ | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
677
+ | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
678
+ | 🇮🇹 Italy | 10 meter | [kbrandwijk](https://github.com/kbrandwijk) |
679
+ | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
680
+ | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
681
+ | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
682
+ | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
683
+ | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
682
684
 
683
685
  ## Special thanks
684
686
 
@@ -17,6 +17,8 @@ from maps4fs.generator.dtm.france import FranceProvider
17
17
  from maps4fs.generator.dtm.norway import NorwayProvider
18
18
  from maps4fs.generator.dtm.denmark import DenmarkProvider
19
19
  from maps4fs.generator.dtm.switzerland import SwitzerlandProvider
20
+ from maps4fs.generator.dtm.mv import MecklenburgVorpommernProvider
21
+ from maps4fs.generator.dtm.baden import BadenWurttembergProvider
20
22
  from maps4fs.generator.game import Game
21
23
  from maps4fs.generator.map import Map
22
24
  from maps4fs.generator.settings import (
@@ -13,9 +13,9 @@ import numpy as np
13
13
 
14
14
  from maps4fs.generator.component.base.component_image import ImageComponent
15
15
  from maps4fs.generator.component.base.component_mesh import MeshComponent
16
+ from maps4fs.generator.component.texture import Texture
16
17
  from maps4fs.generator.dem import DEM
17
18
  from maps4fs.generator.settings import Parameters
18
- from maps4fs.generator.texture import Texture
19
19
 
20
20
 
21
21
  class Background(MeshComponent, ImageComponent):
@@ -116,3 +116,25 @@ class ImageComponent(Component):
116
116
  )
117
117
 
118
118
  cv2.imwrite(save_path, image)
119
+
120
+ @staticmethod
121
+ def transfer_border(src_image: np.ndarray, dst_image: np.ndarray | None, border: int) -> None:
122
+ """Transfers the border of the source image to the destination image.
123
+
124
+ Arguments:
125
+ src_image (np.ndarray): The source image.
126
+ dst_image (np.ndarray, optional): The destination image.
127
+ border (int): The border size.
128
+ """
129
+ borders = [
130
+ (slice(None, border), slice(None)),
131
+ (slice(None), slice(-border, None)),
132
+ (slice(-border, None), slice(None)),
133
+ (slice(None), slice(None, border)),
134
+ ]
135
+
136
+ for row_slice, col_slice in borders:
137
+ border_slice = (row_slice, col_slice)
138
+ if dst_image is not None:
139
+ dst_image[border_slice][src_image[border_slice] != 0] = 255
140
+ src_image[border_slice] = 0
@@ -0,0 +1,162 @@
1
+ """This module contains the class representing a layer with textures and tags."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import re
7
+
8
+
9
+ class Layer:
10
+ """Class which represents a layer with textures and tags.
11
+ It's using to obtain data from OSM using tags and make changes into corresponding textures.
12
+
13
+ Arguments:
14
+ name (str): Name of the layer.
15
+ tags (dict[str, str | list[str]]): Dictionary of tags to search for.
16
+ width (int | None): Width of the polygon in meters (only for LineString).
17
+ color (tuple[int, int, int]): Color of the layer in BGR format.
18
+ exclude_weight (bool): Flag to exclude weight from the texture.
19
+ priority (int | None): Priority of the layer.
20
+ info_layer (str | None): Name of the corresnponding info layer.
21
+ usage (str | None): Usage of the layer.
22
+ background (bool): Flag to determine if the layer is a background.
23
+ invisible (bool): Flag to determine if the layer is invisible.
24
+
25
+ Attributes:
26
+ name (str): Name of the layer.
27
+ tags (dict[str, str | list[str]]): Dictionary of tags to search for.
28
+ width (int | None): Width of the polygon in meters (only for LineString).
29
+ """
30
+
31
+ # pylint: disable=R0913
32
+ def __init__( # pylint: disable=R0917
33
+ self,
34
+ name: str,
35
+ count: int,
36
+ tags: dict[str, str | list[str] | bool] | None = None,
37
+ width: int | None = None,
38
+ color: tuple[int, int, int] | list[int] | None = None,
39
+ exclude_weight: bool = False,
40
+ priority: int | None = None,
41
+ info_layer: str | None = None,
42
+ usage: str | None = None,
43
+ background: bool = False,
44
+ invisible: bool = False,
45
+ procedural: list[str] | None = None,
46
+ border: int | None = None,
47
+ ):
48
+ self.name = name
49
+ self.count = count
50
+ self.tags = tags
51
+ self.width = width
52
+ self.color = color if color else (255, 255, 255)
53
+ self.exclude_weight = exclude_weight
54
+ self.priority = priority
55
+ self.info_layer = info_layer
56
+ self.usage = usage
57
+ self.background = background
58
+ self.invisible = invisible
59
+ self.procedural = procedural
60
+ self.border = border
61
+
62
+ def to_json(self) -> dict[str, str | list[str] | bool]: # type: ignore
63
+ """Returns dictionary with layer data.
64
+
65
+ Returns:
66
+ dict: Dictionary with layer data."""
67
+ data = {
68
+ "name": self.name,
69
+ "count": self.count,
70
+ "tags": self.tags,
71
+ "width": self.width,
72
+ "color": list(self.color),
73
+ "exclude_weight": self.exclude_weight,
74
+ "priority": self.priority,
75
+ "info_layer": self.info_layer,
76
+ "usage": self.usage,
77
+ "background": self.background,
78
+ "invisible": self.invisible,
79
+ "procedural": self.procedural,
80
+ "border": self.border,
81
+ }
82
+
83
+ data = {k: v for k, v in data.items() if v is not None}
84
+ return data # type: ignore
85
+
86
+ @classmethod
87
+ def from_json(cls, data: dict[str, str | list[str] | bool]) -> Layer:
88
+ """Creates a new instance of the class from dictionary.
89
+
90
+ Arguments:
91
+ data (dict[str, str | list[str] | bool]): Dictionary with layer data.
92
+
93
+ Returns:
94
+ Layer: New instance of the class.
95
+ """
96
+ return cls(**data) # type: ignore
97
+
98
+ def path(self, weights_directory: str) -> str:
99
+ """Returns path to the first texture of the layer.
100
+
101
+ Arguments:
102
+ weights_directory (str): Path to the directory with weights.
103
+
104
+ Returns:
105
+ str: Path to the texture.
106
+ """
107
+ idx = "01" if self.count > 0 else ""
108
+ weight_postfix = "_weight" if not self.exclude_weight else ""
109
+ return os.path.join(weights_directory, f"{self.name}{idx}{weight_postfix}.png")
110
+
111
+ def path_preview(self, weights_directory: str) -> str:
112
+ """Returns path to the preview of the first texture of the layer.
113
+
114
+ Arguments:
115
+ weights_directory (str): Path to the directory with weights.
116
+
117
+ Returns:
118
+ str: Path to the preview.
119
+ """
120
+ return self.path(weights_directory).replace(".png", "_preview.png")
121
+
122
+ def get_preview_or_path(self, weights_directory: str) -> str:
123
+ """Returns path to the preview of the first texture of the layer if it exists,
124
+ otherwise returns path to the texture.
125
+
126
+ Arguments:
127
+ weights_directory (str): Path to the directory with weights.
128
+
129
+ Returns:
130
+ str: Path to the preview or texture.
131
+ """
132
+ preview_path = self.path_preview(weights_directory)
133
+ return preview_path if os.path.isfile(preview_path) else self.path(weights_directory)
134
+
135
+ def paths(self, weights_directory: str) -> list[str]:
136
+ """Returns a list of paths to the textures of the layer.
137
+ NOTE: Works only after the textures are generated, since it just lists the directory.
138
+
139
+ Arguments:
140
+ weights_directory (str): Path to the directory with weights.
141
+
142
+ Returns:
143
+ list[str]: List of paths to the textures.
144
+ """
145
+ weight_files = os.listdir(weights_directory)
146
+
147
+ # Inconsistent names are the name of textures that are not following the pattern
148
+ # of texture_name{idx}_weight.png.
149
+ inconsistent_names = ["forestRockRoot", "waterPuddle"]
150
+
151
+ if self.name in inconsistent_names:
152
+ return [
153
+ os.path.join(weights_directory, weight_file)
154
+ for weight_file in weight_files
155
+ if weight_file.startswith(self.name)
156
+ ]
157
+
158
+ return [
159
+ os.path.join(weights_directory, weight_file)
160
+ for weight_file in weight_files
161
+ if re.match(rf"{self.name}\d{{2}}_weight.png", weight_file)
162
+ ]