Refactor image processing and cutout functionalities

- Updated the naming convention for upscaled images to include underscores and file extensions.
- Renamed properties related to cutout pixel size to point spacing for clarity.
- Adjusted alpha region calculations to use a half-alpha threshold for better accuracy.
- Enhanced the handling of foreground mesh masks to consider half-alpha values.
- Introduced new functions for unbounded selections and cutout images, ensuring proper handling of source and selection images.
- Improved test coverage for cutout functionalities, including bounds mapping and alpha preservation.
- Updated tests to reflect changes in naming conventions and functionality adjustments.
This commit is contained in:
2026-08-27 12:01:47 +08:00
parent 2b79a342b0
commit 6c8358f92f
27 changed files with 1058 additions and 223 deletions

View File

@@ -383,7 +383,7 @@ class ImageDepthTest(unittest.TestCase):
self.assertEqual(
self.image_depth.color_data_name(source_object),
"clip.color",
"clip_color.png",
)
def test_force_sequence_source_keeps_loaded_sequence(self):
@@ -684,12 +684,12 @@ class ImageDepthTest(unittest.TestCase):
self.assertEqual(
self.image_depth.depth_data_name(source_object),
"img.depth",
"img_depth.exr",
)
source_object.data.name = "img.png.001"
self.assertEqual(
self.image_depth.depth_data_name(source_object),
"img.001.depth",
"img.001_depth.exr",
)
def test_moge_normal_name_uses_source_image_name(self):
@@ -700,7 +700,7 @@ class ImageDepthTest(unittest.TestCase):
self.assertEqual(
self.image_depth.normal_data_name(source_object),
"img.normal",
"img_normal.png",
)
def test_copy_depth_image_renames_still_source(self):
@@ -715,7 +715,7 @@ class ImageDepthTest(unittest.TestCase):
depth_image = self.image_depth.copy_depth_image(source_object)
self.assertEqual(depth_image.name, "img.depth")
self.assertEqual(depth_image.name, "img_depth.exr")
def test_color_and_material_names_use_source_image_base_name(self):
source_object = SimpleNamespace(
@@ -724,7 +724,7 @@ class ImageDepthTest(unittest.TestCase):
self.assertEqual(
self.image_depth.color_data_name(source_object),
"img.color",
"img_color.png",
)
self.assertEqual(
self.image_depth.material_data_name(source_object),
@@ -733,7 +733,7 @@ class ImageDepthTest(unittest.TestCase):
source_object.data.name = "img.png.001"
self.assertEqual(
self.image_depth.color_data_name(source_object),
"img.001.color",
"img.001_color.png",
)
self.assertEqual(
self.image_depth.material_data_name(source_object),