feat: Implement depth surface strip cleanup and organize tool CLI
- Added a proposal for depth surface strip cleanup, detailing the rationale and changes to the depth plane and cutout nodes. - Created specifications for the new cleanup requirements, including scenarios for strip removal and boundary edge detection. - Developed tasks for implementing shared strip detection logic and integrating new interfaces for depth nodes. - Established a new CLI structure for organizing node groups and model commands, replacing old entry points with a more intuitive command structure. - Introduced a prototype for panorama surface generation, including requirements for distance reconstruction and geometry node surfaces. - Added comprehensive tests for depth strip cleanup functionality, ensuring correct behavior for various mesh topologies and edge cases.
This commit is contained in:
@@ -77,7 +77,7 @@ def test_launcher_runs_asset_build_and_validations_before_tests(monkeypatch, tmp
|
||||
calls = []
|
||||
monkeypatch.setattr(launcher, "blender_path", lambda _: executable)
|
||||
monkeypatch.setattr(launcher, "run", calls.append)
|
||||
monkeypatch.setattr("sys.argv", ["build_nodes"])
|
||||
monkeypatch.setattr("sys.argv", ["node-group", "build"])
|
||||
|
||||
launcher.main()
|
||||
|
||||
@@ -86,3 +86,53 @@ def test_launcher_runs_asset_build_and_validations_before_tests(monkeypatch, tmp
|
||||
assert "runpy.run_module('tools.nodes.check', run_name='__main__')" in calls[1][-1]
|
||||
assert all(command[1:6] == ("--factory-startup", "--background", "--python-exit-code", "1", "--python-expr") for command in calls[:-1])
|
||||
assert calls[-1][1:] == ("-m", "pytest")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("skip_tests", [False, True])
|
||||
def test_check_validates_without_building(monkeypatch, skip_tests):
|
||||
launcher = load_launcher()
|
||||
calls = []
|
||||
monkeypatch.setattr(launcher, "blender_path", lambda _: "blender")
|
||||
monkeypatch.setattr(launcher, "run", calls.append)
|
||||
monkeypatch.setattr("sys.argv", ["node-group", "check", *(["--skip-tests"] if skip_tests else [])])
|
||||
launcher.main()
|
||||
assert len(calls) == (1 if skip_tests else 2)
|
||||
assert "tools.nodes.check" in calls[0][-1]
|
||||
assert "tools.nodes.build" not in calls[0][-1]
|
||||
|
||||
|
||||
def test_build_stops_after_blender_failure(monkeypatch):
|
||||
launcher = load_launcher()
|
||||
monkeypatch.setattr(launcher, "blender_path", lambda _: "blender")
|
||||
monkeypatch.setattr("sys.argv", ["node-group", "build"])
|
||||
with patch.object(launcher, "run", side_effect=RuntimeError("failed")) as run:
|
||||
with pytest.raises(RuntimeError, match="failed"):
|
||||
launcher.main()
|
||||
assert run.call_count == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arguments,opens", [([], True), (["--no-open"], False), (["--fragment"], False)])
|
||||
def test_preview_passes_isolated_arguments_and_opens_result(monkeypatch, tmp_path, arguments, opens):
|
||||
launcher = load_launcher()
|
||||
output = tmp_path / "node groups.html"
|
||||
calls = []
|
||||
monkeypatch.setattr(launcher, "blender_path", lambda _: "blender")
|
||||
monkeypatch.setattr(launcher, "run", calls.append)
|
||||
monkeypatch.setattr("sys.argv", ["node-group", "preview", "--output", str(output), *arguments])
|
||||
with patch.object(launcher.webbrowser, "open") as open_browser:
|
||||
launcher.main()
|
||||
assert len(calls) == 1
|
||||
expression = calls[0][-1]
|
||||
import ast
|
||||
assignment = next(
|
||||
node for node in ast.parse(expression).body
|
||||
if isinstance(node, ast.Assign) and ast.unparse(node.targets[0]) == "sys.argv"
|
||||
)
|
||||
assert ast.literal_eval(assignment.value) == [
|
||||
"tools.nodes.preview.export", "--output", str(output),
|
||||
*(["--fragment"] if "--fragment" in arguments else []),
|
||||
]
|
||||
if opens:
|
||||
open_browser.assert_called_once_with(output.as_uri())
|
||||
else:
|
||||
open_browser.assert_not_called()
|
||||
|
||||
Reference in New Issue
Block a user