feat(cutout): implement boundary padding for cutout textures

- Introduced a new `Boundary Padding` preference in the Cutout Tool with a default of 2 px and a configurable range of 1-4 px.
- Updated the Cutout client to establish inward mapping from the final Mask, sampling in a fixed direction and processing independent material RGBA and Depth.
- Enhanced the handling of RGBA and Depth during cutout operations, ensuring proper mapping and preservation of source data.
- Added tests to validate the new boundary padding functionality and its integration with existing cutout processes.

feat(geometry): remove overall mesh smoothing from geometry nodes

- Removed the `Smooth` input from several geometry node groups to eliminate unnecessary overall mesh smoothing.
- Retained `Smooth Weight` for depth nodes while removing it from Cutout and Relief Plane nodes.
- Ensured that boundary, normal, and fill smoothing behaviors remain intact and consistent.
- Updated tests and documentation to reflect the changes in node interfaces and behaviors.

feat(normals): scale tangent normals with depth

- Reused the existing `o_normal_reduction` attribute to adjust Tangent Normal strength based on the geometry's `Depth Scale`.
- Ensured that Tangent Normal strength is consistent with the geometry depth, preserving full strength for materials that do not provide the attribute.
- Updated tests to verify the correct behavior of normal strength adjustments in both Tangent and Object Space.
This commit is contained in:
2026-09-15 00:40:24 +08:00
parent ab282e4fdf
commit 591e62085a
93 changed files with 1915 additions and 2851 deletions

View File

@@ -2,57 +2,11 @@ import importlib
import tempfile
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import Mock, patch
from unittest.mock import patch
from tests.support.blender import BlenderTestCase
class AiSetupTest(BlenderTestCase):
def test_setup_dialog_uses_install_title_and_button(self):
show_dialog = Mock(return_value={"RUNNING_MODAL"})
context = SimpleNamespace(
window_manager=SimpleNamespace(invoke_props_dialog=show_dialog)
)
operator = self.ai_setup.SetupAIEnvironment()
self.assertEqual(operator.invoke(context, None), {"RUNNING_MODAL"})
show_dialog.assert_called_once_with(
operator, width=440, title="Set Up AI", confirm_text="Install"
)
def test_setup_dialog_shows_install_summary_and_mirror_option(self):
labels = []
properties = []
operator = self.ai_setup.SetupAIEnvironment()
operator.layout = SimpleNamespace(
label=lambda **kwargs: labels.append(kwargs["text"]),
separator=lambda **_kwargs: None,
prop=lambda _owner, name: properties.append(name),
)
with patch.object(
self.ai_setup, "ai_status", return_value={"environment_ready": False}
):
operator.draw(None)
self.assertEqual(labels, [
"Set up AI features for depth, background removal and upscaling.",
"Downloads the runtime and required models (259 MB for models).",
])
self.assertEqual(properties, ["use_mirror"])
def test_runtime_exposes_declared_environment_and_post_install(self):
runtime = self.anyimage.runtime
self.assertEqual(runtime.environment["python"], "3.12")
self.assertIn("numpy==2.4.2", runtime.environment["packages"])
self.assertIn("scipy==1.15.3", runtime.environment["packages"])
self.assertFalse(
any(
"blendjob" in package.lower()
for package in runtime.environment["packages"]
)
)
self.assertTrue(callable(runtime.post_install))
def test_anyimage_post_install_is_ordinary_code_using_runtime_request(self):
calls = []
fake_runtime = SimpleNamespace(
@@ -206,10 +160,6 @@ class AiSetupTest(BlenderTestCase):
self.ai_setup.OpenAIEnvironmentSettings,
self.anyimage.CLASSES,
)
self.assertEqual(self.ai_setup.SetupAIEnvironment.bl_label, "Set Up AI Server")
self.assertEqual(
self.ai_setup.OpenAIEnvironmentSettings.bl_label, "Settings"
)
def test_ui_reads_required_model_files_without_starting_server(self):