Files
AnyImage/pack.py
nan a503786c62 Refactor and enhance SnapForm functionality
- Introduced MODEL_NUMBERS for better model indexing.
- Improved enum_items function to cache results and handle download status.
- Updated ActiveJob class to manage temporary input paths and added displacement_via property.
- Changed IMAGE_DEPTH_PROCESS_RES_METHOD from "lower_bound_resize" to "upper_bound_resize".
- Enhanced RunJob operator to include new properties and improved error messages.
- Modified panel layout for better user experience and added runtime installation checks.
- Updated SnapFormSettings to reflect new model properties and defaults.
- Added temporary input path management in runtime.
- Refined worker functions to improve error handling and messaging.
- Expanded tests to cover new functionality and ensure backward compatibility.
- Fixed packaging script to align with versioning conventions.
2026-08-03 13:47:15 +08:00

35 lines
1.0 KiB
Python

import tomllib
from pathlib import Path
from zipfile import ZIP_DEFLATED, ZipFile
PROJECT_ROOT = Path(__file__).resolve().parent
SOURCE_DIR = PROJECT_ROOT / "src" / "snapform"
DIST_DIR = PROJECT_ROOT / "dist"
def build_extension():
manifest = tomllib.loads(
(SOURCE_DIR / "blender_manifest.toml").read_text(encoding="utf-8")
)
output_path = DIST_DIR / (
f"{manifest['name']}.v{manifest['version']}.zip"
)
DIST_DIR.mkdir(exist_ok=True)
with ZipFile(output_path, "w", ZIP_DEFLATED) as archive:
for source_path in sorted(SOURCE_DIR.rglob("*")):
if not source_path.is_file():
continue
if "__pycache__" in source_path.parts:
continue
archive.write(source_path, source_path.relative_to(SOURCE_DIR))
return output_path
if __name__ == "__main__":
extension_path = build_extension()
size_mib = extension_path.stat().st_size / (1024 * 1024)
print(f"Built {extension_path} ({size_mib:.2f} MiB)")