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:
@@ -2,9 +2,12 @@ from pathlib import Path
|
||||
|
||||
import bpy
|
||||
|
||||
from .server.model_catalog import DEFAULT_UPSCALE_MODEL_KEY, UPSCALE_MODELS
|
||||
|
||||
from .server.model_catalog import (
|
||||
DEFAULT_UPSCALE_MODEL_KEY,
|
||||
UPSCALE_MODELS,
|
||||
)
|
||||
|
||||
DEFAULT_MOGE2_MODEL_KEY = "MOGE2_VITS_NORMAL"
|
||||
|
||||
ADDON_PACKAGE = __package__
|
||||
DEFAULT_STORAGE_ROOT = Path.home() / ".anyimage"
|
||||
@@ -18,9 +21,7 @@ UPSCALE_MODEL_ITEMS = tuple(
|
||||
|
||||
def addon_preferences(context=None):
|
||||
preference_context = (
|
||||
context
|
||||
if getattr(context, "preferences", None) is not None
|
||||
else bpy.context
|
||||
context if getattr(context, "preferences", None) is not None else bpy.context
|
||||
)
|
||||
addon = preference_context.preferences.addons.get(ADDON_PACKAGE)
|
||||
return getattr(addon, "preferences", None)
|
||||
@@ -39,6 +40,12 @@ def device_items(owner, context):
|
||||
return device_enum_items(owner, context)
|
||||
|
||||
|
||||
def mesh_depth_model_items(owner, context):
|
||||
from .properties import surface_model_enum_items
|
||||
|
||||
return surface_model_enum_items(owner, context)
|
||||
|
||||
|
||||
class AnyImagePreferences(bpy.types.AddonPreferences):
|
||||
bl_idname = ADDON_PACKAGE
|
||||
|
||||
@@ -78,6 +85,29 @@ class AnyImagePreferences(bpy.types.AddonPreferences):
|
||||
step=256,
|
||||
subtype="PIXEL",
|
||||
)
|
||||
mesh_depth_model: bpy.props.EnumProperty(
|
||||
name="Mesh Depth Model",
|
||||
description="Depth model used by Depth Plane, Depth Balloon and Depth Surface",
|
||||
items=mesh_depth_model_items,
|
||||
default=0,
|
||||
)
|
||||
mesh_process_res_factor: bpy.props.FloatProperty(
|
||||
name="DA3 Resolution Scale",
|
||||
description="Source image scale used for Depth Anything 3 mesh conversion",
|
||||
default=100.0,
|
||||
min=1.0,
|
||||
max=100.0,
|
||||
step=100,
|
||||
precision=0,
|
||||
subtype="PERCENTAGE",
|
||||
)
|
||||
mesh_resolution_level: bpy.props.IntProperty(
|
||||
name="MoGe Resolution Level",
|
||||
description="MoGe-2 inference resolution used for mesh conversion",
|
||||
default=5,
|
||||
min=0,
|
||||
max=9,
|
||||
)
|
||||
|
||||
def draw(self, _context):
|
||||
from .properties import ai_setup_label, ai_status, model_catalog
|
||||
@@ -88,6 +118,14 @@ class AnyImagePreferences(bpy.types.AddonPreferences):
|
||||
layout.prop(self, "device")
|
||||
layout.prop(self, "upscale_model")
|
||||
layout.prop(self, "upscale_max_output_size")
|
||||
layout.separator(type="LINE")
|
||||
layout.label(text="Mesh Conversion")
|
||||
layout.prop(self, "mesh_depth_model")
|
||||
mesh_depth_model = getattr(self, "mesh_depth_model", DEFAULT_MOGE2_MODEL_KEY)
|
||||
if mesh_depth_model.startswith("MOGE2_"):
|
||||
layout.prop(self, "mesh_resolution_level")
|
||||
else:
|
||||
layout.prop(self, "mesh_process_res_factor")
|
||||
layout.separator()
|
||||
status = ai_status()
|
||||
layout.label(text=f"Environment: {runtime.environment_directory()}")
|
||||
|
||||
Reference in New Issue
Block a user