Add comprehensive tests for cutout and mesh functionalities

- Introduced `test_cutout.py` to validate cutout pie menu behavior, image lasso options, and mesh detail calculations.
- Added `test_mesh.py` to ensure correct tangent normal rasterization, plane source topology, and depth surface evaluations.
- Created `test_mesh_blender.py` to verify material node groups, tangent baking, and local cutout building from Blender images.
- Implemented tests for handling alpha regions and ensuring geometry nodes maintain expected behavior.
This commit is contained in:
2026-08-26 10:42:29 +08:00
parent 0cf04a13c6
commit 2b79a342b0
46 changed files with 5554 additions and 645 deletions

View File

@@ -2,10 +2,9 @@ import bpy
from . import clipboard_image
from .clipboard_image import CLASSES as CLIPBOARD_CLASSES
from .runtime import runtime
from .menu import AnyImageImageMenu, draw_image_context_menu
from .operators import CLASSES as OPERATOR_CLASSES
from .operators.balloon import BalloonTool
from .operators.cutout import CutoutTool
from .operators.image_edit import (
ImageBoxTool,
ImageLassoTool,
@@ -13,9 +12,6 @@ from .operators.image_edit import (
ImagePerspectiveTool,
ImagePolylineTool,
)
from .preferences import AnyImagePreferences
from .properties import AnyImageSettings
from .menu import AnyImageImageMenu, draw_image_context_menu
from .panel import (
Ben2RemovalDebugPanel,
Da3OutputDebugPanel,
@@ -24,6 +20,9 @@ from .panel import (
ServerPanel,
UpscaleDebugPanel,
)
from .preferences import AnyImagePreferences
from .properties import AnyImageSettings
from .runtime import runtime
CLASSES = (
@@ -44,11 +43,7 @@ CLASSES = (
def register():
for class_type in CLASSES:
bpy.utils.register_class(class_type)
bpy.utils.register_tool(
ImageBoxTool,
separator=True,
group=True,
)
bpy.utils.register_tool(ImageBoxTool, separator=True, group=True)
bpy.utils.register_tool(
ImageLassoTool,
after={ImageBoxTool.bl_idname},
@@ -64,16 +59,15 @@ def register():
after={ImageLineTool.bl_idname},
separator=False,
)
bpy.utils.register_tool(ImagePerspectiveTool, separator=False)
bpy.utils.register_tool(
ImagePerspectiveTool,
separator=False,
)
bpy.utils.register_tool(BalloonTool, separator=False)
bpy.types.Scene.anyimage_settings = bpy.props.PointerProperty(
type=AnyImageSettings,
CutoutTool,
after={ImagePerspectiveTool.bl_idname},
separator=True,
)
bpy.types.Scene.anyimage_settings = bpy.props.PointerProperty(type=AnyImageSettings)
bpy.types.Image.anyimage_upscale_source = bpy.props.PointerProperty(
type=bpy.types.Image,
type=bpy.types.Image
)
bpy.types.VIEW3D_MT_object_context_menu.prepend(draw_image_context_menu)
bpy.types.OUTLINER_MT_object.prepend(draw_image_context_menu)
@@ -84,7 +78,7 @@ def register():
def unregister():
runtime.unregister()
clipboard_image.unregister_keymaps()
bpy.utils.unregister_tool(BalloonTool)
bpy.utils.unregister_tool(CutoutTool)
bpy.utils.unregister_tool(ImagePerspectiveTool)
bpy.utils.unregister_tool(ImagePolylineTool)
bpy.utils.unregister_tool(ImageLineTool)