From f46e32310dcf3df10a1bbaa1f6baf860b526e1a0 Mon Sep 17 00:00:00 2001 From: Stan Soldatov Date: Fri, 20 Dec 2024 03:17:16 +0100 Subject: [PATCH] Preview rotation. --- maps4fs/generator/texture.py | 16 ++++++++++------ webui/generator.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/maps4fs/generator/texture.py b/maps4fs/generator/texture.py index 8f27d34..b1ce7d8 100644 --- a/maps4fs/generator/texture.py +++ b/maps4fs/generator/texture.py @@ -226,13 +226,17 @@ def rotate_textures(self) -> None: if layer.tags: self.logger.debug("Rotating layer %s.", layer.name) layer_paths = layer.paths(self._weights_dir) + layer_paths += [layer.path_preview(self._weights_dir)] for layer_path in layer_paths: - self.rotate_image( - layer_path, - self.rotation, - output_height=self.map_size, - output_width=self.map_size, - ) + if os.path.isfile(layer_path): + self.rotate_image( + layer_path, + self.rotation, + output_height=self.map_size, + output_width=self.map_size, + ) + else: + self.logger.warning("Layer path %s not found.", layer_path) else: self.logger.debug( "Skipping rotation of layer %s because it has no tags.", layer.name diff --git a/webui/generator.py b/webui/generator.py index 482162b..3860d91 100644 --- a/webui/generator.py +++ b/webui/generator.py @@ -45,7 +45,7 @@ class GeneratorUI: def __init__(self): self.download_path = None - self.logger = mfs.Logger(level="DEBUG", to_file=False) + self.logger = mfs.Logger(level="INFO", to_file=False) self.community = config.is_on_community_server() self.logger.debug("The application launched on the community server: %s", self.community)