Files
AnyImage/src/anyimage/__init__.py
nan 1994d38ccd Add comprehensive tests for image processing and mask functionalities
- Introduced tests for color image handling, ensuring source preservation and premultiplied alpha usage.
- Implemented tests for brush stroke operations, validating segment boundaries and brush anti-aliasing.
- Added tests for frame anti-aliasing, confirming correct rendering behavior with various alpha values and depth settings.
- Created tests for frame projection, ensuring accurate overlap calculations and half-plane clipping.
- Developed tests for image premultiplied retention, verifying behavior during loading and packing processes.
- Added undo functionality tests for mask operations, ensuring single transaction behavior during edits.
2026-09-05 21:33:11 +08:00

76 lines
2.2 KiB
Python

import bpy
from .operators import clipboard_image
from .operators.clipboard_image import CLASSES as CLIPBOARD_CLASSES
from .menu import AnyImageImageMenu, draw_image_context_menu
from .operators import CLASSES as OPERATOR_CLASSES
from .operators.cutout_tool import CutoutTool
from .operators.image_edit_tool import (
FrameTool,
MaskTool,
RectifyTool,
)
from .panel import (
Ben2RemovalDebugPanel,
Da3OutputDebugPanel,
DebugPanel,
Moge2ApiDebugPanel,
ServerPanel,
UpscaleDebugPanel,
)
from .preferences import AnyImagePreferences
from .properties import AnyImageSettings
from .runtime import runtime
CLASSES = (
AnyImagePreferences,
AnyImageSettings,
*CLIPBOARD_CLASSES,
*OPERATOR_CLASSES,
AnyImageImageMenu,
ServerPanel,
DebugPanel,
Moge2ApiDebugPanel,
Da3OutputDebugPanel,
Ben2RemovalDebugPanel,
UpscaleDebugPanel,
)
def register():
for class_type in CLASSES:
bpy.utils.register_class(class_type)
bpy.utils.register_tool(FrameTool, separator=True, group=True)
bpy.utils.register_tool(
MaskTool,
after={FrameTool.bl_idname},
separator=False,
)
bpy.utils.register_tool(
RectifyTool,
after={MaskTool.bl_idname},
separator=False,
)
bpy.utils.register_tool(CutoutTool)
bpy.types.Scene.anyimage_settings = bpy.props.PointerProperty(type=AnyImageSettings)
bpy.types.VIEW3D_MT_object_context_menu.prepend(draw_image_context_menu)
bpy.types.OUTLINER_MT_object.prepend(draw_image_context_menu)
clipboard_image.register_keymaps()
runtime.register()
def unregister():
runtime.unregister()
clipboard_image.unregister_keymaps()
bpy.utils.unregister_tool(CutoutTool)
bpy.utils.unregister_tool(RectifyTool)
bpy.utils.unregister_tool(MaskTool)
bpy.utils.unregister_tool(FrameTool)
bpy.types.VIEW3D_MT_object_context_menu.remove(draw_image_context_menu)
bpy.types.OUTLINER_MT_object.remove(draw_image_context_menu)
if hasattr(bpy.types.Scene, "anyimage_settings"):
del bpy.types.Scene.anyimage_settings
for class_type in reversed(CLASSES):
bpy.utils.unregister_class(class_type)