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:
@@ -7,6 +7,7 @@ import subprocess
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
|
||||
@@ -194,12 +195,19 @@ def prepare_model(model):
|
||||
build_model(model)
|
||||
return
|
||||
if model.key == "PISA_SR":
|
||||
subprocess.run(
|
||||
["uv", "run", "--script", str(Path(__file__).with_name("pisa_sr_export.py"))],
|
||||
cwd=PROJECT_ROOT, check=True,
|
||||
)
|
||||
if not verify_file(model.destination, model.size, model.sha256):
|
||||
raise RuntimeError("PiSA-SR export differs from the published catalog")
|
||||
model.destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
with TemporaryDirectory(prefix=".pisa-sr-", dir=MODELS_DIR) as directory:
|
||||
subprocess.run(
|
||||
["uv", "run", "--script", str(Path(__file__).with_name("pisa_sr_export.py")),
|
||||
"--destination", directory],
|
||||
cwd=PROJECT_ROOT, check=True,
|
||||
)
|
||||
models = [item for item in MODEL_FILES if item.key == model.key]
|
||||
for item in models:
|
||||
if not verify_file(Path(directory) / item.filename, item.size, item.sha256):
|
||||
raise RuntimeError("PiSA-SR export differs from the published catalog")
|
||||
for path in Path(directory).iterdir():
|
||||
path.replace(model.destination.parent / path.name)
|
||||
return
|
||||
if not model.source_url:
|
||||
raise RuntimeError(f"No upstream source or builder for {model.key}")
|
||||
@@ -231,20 +239,23 @@ def upload_models(models=MODEL_FILES):
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--prepare-only",
|
||||
action="store_true",
|
||||
help="Prepare and verify models without uploading them",
|
||||
)
|
||||
return parser.parse_args()
|
||||
parser = argparse.ArgumentParser(description="Prepare models locally or sync them to R2.")
|
||||
commands = parser.add_subparsers(dest="command")
|
||||
commands.add_parser("prepare", help="Download or export models and verify them locally")
|
||||
commands.add_parser("sync", help="Prepare and verify all models, then upload them to R2")
|
||||
args = parser.parse_args()
|
||||
if args.command is None:
|
||||
parser.print_help()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if args.command is None:
|
||||
return
|
||||
for model in MODEL_FILES:
|
||||
prepare_model(model)
|
||||
if not args.prepare_only:
|
||||
if args.command == "sync":
|
||||
upload_models()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user