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:
@@ -51,12 +51,39 @@ def test_entry_submits_current_alpha_preferences_and_cleans_cancelled_input(sour
|
||||
assert submitted["model"] == "MOGE2_VITB_NORMAL" and submitted["resolution_level"] == 2
|
||||
assert submitted["max_input_size"] == 1024 and submitted["mesh_detail"] == 4
|
||||
assert submitted["color_path"] == submitted["input_path"]
|
||||
operator.report.assert_not_called()
|
||||
from pathlib import Path
|
||||
assert not Path(submitted["input_path"]).exists()
|
||||
assert bpy.data.objects.get(source.name) == source
|
||||
|
||||
|
||||
@pytest.mark.parametrize("image_source,size", [("MOVIE", (32, 16)), ("SEQUENCE", (32, 16)), ("FILE", (32, 32))])
|
||||
def test_entry_crops_arbitrary_aspect_before_submitting_and_warns(source, monkeypatch):
|
||||
source.data.scale(31, 20)
|
||||
source.data.pixels.foreach_set(np.ones((20, 31, 4), np.float32).ravel())
|
||||
submitted = {}
|
||||
|
||||
def submit(**parameters):
|
||||
submitted.update(parameters)
|
||||
with Image.open(parameters["input_path"]) as image:
|
||||
assert image.size == (30, 15)
|
||||
with Image.open(parameters["color_path"]) as image:
|
||||
assert image.size == (30, 15)
|
||||
return {"CANCELLED"}
|
||||
|
||||
monkeypatch.setattr(operators, "invoke_ai_setup_if_needed", lambda _operator: None)
|
||||
monkeypatch.setattr(operators, "addon_preferences", lambda _: SimpleNamespace(geometry_resolution_level=5))
|
||||
monkeypatch.setattr(operators, "configured_geometry_model", lambda _: "MOGE2_VITB_NORMAL")
|
||||
monkeypatch.setattr(operators, "configured_max_ai_input_size", lambda _: 1024)
|
||||
monkeypatch.setattr(operators, "bpy", SimpleNamespace(
|
||||
ops=SimpleNamespace(anyimage=SimpleNamespace(generate_panorama=submit))))
|
||||
operator = SimpleNamespace(mesh_detail=4, report=Mock())
|
||||
|
||||
assert operators.ConvertToPanorama.execute(operator, bpy.context) == {"CANCELLED"}
|
||||
operator.report.assert_called_once_with(
|
||||
{"WARNING"}, "Panorama input cropped from 31 x 20 to 30 x 15")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("image_source,size", [("MOVIE", (32, 16)), ("SEQUENCE", (32, 16)), ("FILE", (1, 32))])
|
||||
def test_invalid_input_is_rejected_before_setup(image_source, size, monkeypatch):
|
||||
setup = Mock()
|
||||
monkeypatch.setattr(operators, "invoke_ai_setup_if_needed", setup)
|
||||
@@ -96,6 +123,7 @@ def test_result_replaces_source_with_zero_rotation_and_shadeless_material(source
|
||||
np.testing.assert_allclose(obj.scale, matrix.to_scale(), atol=1e-6)
|
||||
np.testing.assert_array_equal(obj.rotation_euler, (0, 0, 0))
|
||||
material = obj.data.materials[0]
|
||||
assert not any(n.bl_idname == "ShaderNodeUVMap" for n in material.node_tree.nodes)
|
||||
assert any(n.type == "GROUP" and n.node_tree.name == "O Shadeless" for n in material.node_tree.nodes)
|
||||
assert [n.node_tree.name for n in material.node_tree.nodes if n.type == "GROUP"] == ["O Shadeless"]
|
||||
texture = next(n for n in material.node_tree.nodes if n.type == "TEX_IMAGE")
|
||||
|
||||
Reference in New Issue
Block a user