Retarget human motion from video to an Adobe Mixamo-rigged 3D character.
Python
Build per-platform add-on zips; ship macos-arm64 for v0.1.6
MaxLiu8ab29ba33461
diff --git a/.github/RELEASE_NOTES_v0.1.6.md b/.github/RELEASE_NOTES_v0.1.6.mdindex db0611b..95b0711 100644--- a/.github/RELEASE_NOTES_v0.1.6.md+++ b/.github/RELEASE_NOTES_v0.1.6.md@@ -15,7 +15,7 @@ This release makes the Blender add-on usable without a terminal.### Install the Blender add-on-1. Download `motion2mixamorig-0.1.6.zip` from the assets below (do not unzip it).+1. Download `motion2mixamorig-0.1.6-macos-arm64.zip` from the assets below (do not unzip it). This release has a macOS (Apple Silicon) build only; Windows and Linux builds will follow once they are tested.2. In Blender 4.2+: **Edit → Preferences → Get Extensions → ∨ → Install from Disk…**3. Follow the [User Guide](https://github.com/MaxLiu22/Motion2MixamoRig/blob/v0.1.6/docs/user-guide.md).diff --git a/AGENTS.md b/AGENTS.mdindex b454809..5a261fa 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -65,9 +65,11 @@ When helping a user:it, click **Install Runtime (one click)**, then **Choose SMPL-X Model…**.Own-venv path: the same venv + SMPL-X + Mixamo FBX as the CLI (see Setupabove).-2. Build `dist/motion2mixamorig-0.1.6.zip` with- `python scripts/package_blender_extension.py` (the zip bundles- `motion2mixamorig/` under `backend/` for the one-click runtime).+2. Build `dist/motion2mixamorig-0.1.6-<platform>.zip` with+ `python scripts/package_blender_extension.py --platform macos-arm64` (one+ zip per platform; the platform is declared in the zip's manifest, the+ version is shared; the zip bundles `motion2mixamorig/` under `backend/`+ for the one-click runtime). Without `--platform`: a neutral test build.3. In Blender 4.2+: **Edit → Preferences → Get Extensions**, then the **∨**next to Repositories → **Install from Disk…** (no large button). Enable it.4. The panel is **3D Viewport → N sidebar → Motion2MixamoRig**, not Get@@ -109,4 +111,4 @@ Each run writes `outputs/<YYYYMMDD_HHMMSS>_<source>/`:- `blender_extension/README.md` — build the add-on, one-click runtime internals, own-venv setup- `docs/user-guide.md` — add-on guide for non-programmers- `docs/blender-extension.md` — maintainer smoke-test checklist-- `scripts/package_blender_extension.py` — build `dist/motion2mixamorig-0.1.6.zip`+- `scripts/package_blender_extension.py` — build `dist/motion2mixamorig-0.1.6-<platform>.zip`diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b030a89..367da72 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.- Blender add-on: UI in 18 languages, matching the README.- Blender add-on: a ⚙ toggle next to the panel title shows or hides Setup.- The add-on zip bundles the Motion2MixamoRig code that the one-click runtime installs.+- Per-platform add-on zips: `scripts/package_blender_extension.py --platform <name>` writes `motion2mixamorig-<version>-<platform>.zip` and declares the platform in its manifest, so Blender refuses it on another OS. This release ships `macos-arm64` only.- User guide for using the add-on without coding (`docs/user-guide.md`), linked from the top of the README.### Fixeddiff --git a/README.md b/README.mdindex 67c62c2..82231d7 100644--- a/README.md+++ b/README.md@@ -22,7 +22,7 @@ For game developers: give it a **single-person** action video (or a still) and a### 🎨 In Blender — no coding-1. Download `motion2mixamorig-<version>.zip` from the [latest release](https://github.com/MaxLiu22/Motion2MixamoRig/releases/latest).+1. Download the zip for your platform, e.g. `motion2mixamorig-<version>-macos-arm64.zip`, from the [latest release](https://github.com/MaxLiu22/Motion2MixamoRig/releases/latest).2. In Blender: **Edit → Preferences → Get Extensions → ∨ → Install from Disk…**, pick the zip.3. 3D Viewport → press **N** → **Motion2MixamoRig** tab → **Install Runtime (one click)**.4. **Choose SMPL-X Model…** (a free download) and pick a Mixamo character FBX.diff --git a/blender_extension/README.md b/blender_extension/README.mdindex 93dd6fc..7839179 100644--- a/blender_extension/README.md+++ b/blender_extension/README.md@@ -86,13 +86,25 @@ across `.blend` files.From the repository root:```bash-python scripts/package_blender_extension.py+python scripts/package_blender_extension.py --platform macos-arm64```-That writes `dist/motion2mixamorig-0.1.6.zip`, named after `version` in-`blender_manifest.toml`. The zip root is `blender_manifest.toml` +-`__init__.py` (no wrapping folder), plus `backend/` with the Motion2MixamoRig-code that the one-click runtime installs.+That writes `dist/motion2mixamorig-0.1.6-macos-arm64.zip`. The version comes+from `version` in `blender_manifest.toml` and is the same on every platform;+the platform goes into the file name and into `platforms` in the zip’s copy of+the manifest, so Blender refuses to install it on another OS. The source+manifest has no `platforms` line.++- Platforms: `macos-arm64`, `macos-x64`, `windows-x64`, `windows-arm64`,+ `linux-x64`. Repeat `--platform` to build several zips at once.+- Without `--platform` you get a platform-neutral+ `dist/motion2mixamorig-0.1.6.zip` that installs anywhere. Use it for local+ testing only; releases ship per-platform zips.++The zip root is `blender_manifest.toml` + `__init__.py` (no wrapping folder),+plus `backend/` with the Motion2MixamoRig code that the one-click runtime+installs. Today the add-on code is identical across platforms; per-platform+zips leave room for platform-specific parts later.In Blender 4.2+:@@ -104,7 +116,7 @@ In Blender 4.2+:Command line:```bash-blender --command extension install-file --repo user_default --enable dist/motion2mixamorig-0.1.6.zip+blender --command extension install-file --repo user_default --enable dist/motion2mixamorig-0.1.6-macos-arm64.zip```After you change the add-on code, rebuild the zip and install it again. Thediff --git a/docs/blender-extension.md b/docs/blender-extension.mdindex f64651b..f965bd2 100644--- a/docs/blender-extension.md+++ b/docs/blender-extension.md@@ -13,7 +13,7 @@ This page is the smoke-test checklist and the out-of-scope list.Run this on a clean user state: move `~/Motion2MixamoRig` aside first(`mv ~/Motion2MixamoRig ~/Motion2MixamoRig.bak`) and restore it afterwards.-1. `python scripts/package_blender_extension.py`+1. `python scripts/package_blender_extension.py --platform macos-arm64`2. Install the zip in Blender 4.2+ and enable the add-on; the version in**Get Extensions** matches the zip name.3. Confirm the **Motion2MixamoRig** tab in the 3D Viewport N-panel.@@ -51,6 +51,10 @@ Run this on a clean user state: move `~/Motion2MixamoRig` aside first### Windows 10/11 (not tested yet)+Build with `--platform windows-x64`. Known blocker for the one-click runtime:+`cython-bbox` (pulled in by `gvhmr[preproc]`, unused at runtime) has no+Windows wheel and needs a C compiler.+1. One-click runtime: **Install Runtime** works, including paths with spaces(`C:\Users\Jane Doe\...`).2. Own venv: External Python is `.venv\Scripts\python.exe`.diff --git a/docs/release-checklist.md b/docs/release-checklist.mdindex 1dd1a5e..a611fae 100644--- a/docs/release-checklist.md+++ b/docs/release-checklist.md@@ -28,9 +28,12 @@- [ ] Release preparation commit is pushed- [ ] Annotated tag is created- [ ] Tag is pushed-- [ ] Add-on zip is built: `python scripts/package_blender_extension.py`- → `dist/motion2mixamorig-<version>.zip`-- [ ] GitHub Release is created from the tag, with the release notes and the- add-on zip attached+- [ ] One add-on zip per tested platform:+ `python scripts/package_blender_extension.py --platform macos-arm64`+ → `dist/motion2mixamorig-<version>-macos-arm64.zip` (repeat+ `--platform` for others). Ship only platforms that passed the smoke test;+ never upload the platform-neutral test build.+- [ ] GitHub Release is created from the tag, with the release notes and every+ platform zip attached; the notes list which platforms are included- [ ] Release URL opens successfully, and`https://github.com/MaxLiu22/Motion2MixamoRig/releases/latest` points to itdiff --git a/docs/user-guide.md b/docs/user-guide.mdindex 0f469da..3daf791 100644--- a/docs/user-guide.md+++ b/docs/user-guide.md@@ -18,9 +18,16 @@ No coding or terminal needed.## 1. Download the add-onGo to the [latest release](https://github.com/MaxLiu22/Motion2MixamoRig/releases/latest)-and download `motion2mixamorig-<version>.zip` (for example-`motion2mixamorig-0.1.6.zip`). The version in the file name is the add-on-version.+and download the zip for your computer:++| Your computer | File |+| --- | --- |+| Mac with Apple Silicon (M1/M2/M3/M4) | `motion2mixamorig-<version>-macos-arm64.zip` |+| Windows, Linux, Intel Mac | Not available yet |++For example `motion2mixamorig-0.1.6-macos-arm64.zip`: `0.1.6` is the add-on+version, `macos-arm64` the platform. If you pick the wrong one, Blender refuses+to install it and names the platform it expected.Do **not** unzip it. Blender installs the zip itself.diff --git a/scripts/package_blender_extension.py b/scripts/package_blender_extension.pyindex 15ec59e..b727262 100644--- a/scripts/package_blender_extension.py+++ b/scripts/package_blender_extension.py@@ -1,5 +1,16 @@#!/usr/bin/env python3-"""Build dist/motion2mixamorig-0.1.6.zip for Blender 4.2+.+"""Build the Motion2MixamoRig add-on zip for Blender 4.2+.++Release builds are per platform:++ python scripts/package_blender_extension.py --platform macos-arm64+ -> dist/motion2mixamorig-<version>-macos-arm64.zip++The platform goes into the zip name and into `platforms` in the zip's+blender_manifest.toml, so Blender refuses to install it on another OS. The+version stays the same on every platform. Pass --platform more than once to+build several zips. Without --platform you get a platform-neutral+dist/motion2mixamorig-<version>.zip for local testing only.The zip root contains blender_manifest.toml and __init__.py directly — noextra wrapping folder.@@ -31,6 +42,8 @@ SKIP_NAMES = {".DS_Store", ".gitkeep"}# Motion2MixamoRig itself rides inside the zip under backend/, so the one-click# runtime setup installs exactly the code that matches this add-on version.BACKEND_ITEMS = ("motion2mixamorig", "pyproject.toml", "LICENSE", "NOTICE.md")+# Platform names Blender accepts in the manifest `platforms` field.+PLATFORMS = ("macos-arm64", "macos-x64", "windows-x64", "windows-arm64", "linux-x64")def read_manifest(path: Path) -> dict[str, str]:@@ -61,29 +74,50 @@ def iter_source_files(src: Path) -> list[Path]:return sorted(p for p in src.rglob("*") if p.is_file() and should_include(p))-def build_zip(src: Path = SRC, dest: Path | None = None) -> Path:+def manifest_for_platform(text: str, platform: str) -> str:+ """Set top-level `platforms` (before the first [table], as TOML requires)."""+ lines = [line for line in text.splitlines() if not line.strip().startswith("platforms")]+ entry = f'platforms = ["{platform}"]'+ for i, line in enumerate(lines):+ if line.strip().startswith("["):+ lines[i:i] = [entry, ""]+ break+ else:+ lines.append(entry)+ return "\n".join(lines) + "\n"+++def build_zip(src: Path = SRC, dest: Path | None = None, platform: str | None = None) -> Path:if not (src / "blender_manifest.toml").is_file() or not (src / "__init__.py").is_file():raise FileNotFoundError(f"extension sources are incomplete: {src}")+ if platform is not None and platform not in PLATFORMS:+ raise ValueError(f"unknown platform {platform!r}; expected one of {', '.join(PLATFORMS)}")version = extension_version(src)- dest = dest or (DIST / f"motion2mixamorig-{version}.zip")+ suffix = f"-{platform}" if platform else ""+ dest = dest or (DIST / f"motion2mixamorig-{version}{suffix}.zip")dest.parent.mkdir(parents=True, exist_ok=True)if dest.exists():dest.unlink()with zipfile.ZipFile(dest, "w", compression=zipfile.ZIP_DEFLATED) as archive:for path in iter_source_files(src):- archive.write(path, path.relative_to(src).as_posix())+ arcname = path.relative_to(src).as_posix()+ if platform and arcname == "blender_manifest.toml":+ text = path.read_text(encoding="utf-8")+ archive.writestr(arcname, manifest_for_platform(text, platform))+ continue+ archive.write(path, arcname)for name in BACKEND_ITEMS:item = ROOT / namefiles = iter_source_files(item) if item.is_dir() else [item]for path in files:archive.write(path, ("backend" / path.relative_to(ROOT)).as_posix())- errors = validate_zip(dest)+ errors = validate_zip(dest, platform)if errors:raise RuntimeError("invalid extension zip:\n" + "\n".join(errors))return dest-def validate_zip(zip_path: Path) -> list[str]:+def validate_zip(zip_path: Path, platform: str | None = None) -> list[str]:errors: list[str] = []if not zip_path.is_file():return [f"zip does not exist: {zip_path}"]@@ -112,6 +146,8 @@ def validate_zip(zip_path: Path) -> list[str]:errors.append(f"manifest is missing {field}")if 'id = "motion2mixamorig"' not in manifest_text:errors.append("manifest id must be motion2mixamorig")+ if platform and f'platforms = ["{platform}"]' not in manifest_text:+ errors.append(f"manifest does not declare platforms = [\"{platform}\"]")return errors@@ -141,20 +177,33 @@ def maybe_blender_validate(zip_path: Path) -> str | None:def main(argv: list[str] | None = None) -> int:- parser = argparse.ArgumentParser(description=__doc__)- parser.add_argument("--output", type=Path, default=None, help="zip path")+ parser = argparse.ArgumentParser(+ description="Build the Motion2MixamoRig add-on zip (one per --platform for releases).",+ )+ parser.add_argument("--output", type=Path, default=None, help="zip path (only with zero or one --platform)")+ parser.add_argument(+ "--platform",+ action="append",+ choices=PLATFORMS,+ default=None,+ help="target platform; repeat for several zips. Omit for a platform-neutral test build.",+ )args = parser.parse_args(argv)- dest = build_zip(dest=args.output)- print(f"wrote {dest}")- try:- message = maybe_blender_validate(dest)- except RuntimeError as exc:- print(exc, file=sys.stderr)- return 1- if message:- print(message)- else:- print("Blender CLI not found; zip structure and manifest were checked locally.")+ platforms = args.platform or [None]+ if args.output is not None and len(platforms) > 1:+ parser.error("--output works with at most one --platform")+ for platform in platforms:+ dest = build_zip(dest=args.output, platform=platform)+ print(f"wrote {dest}")+ try:+ message = maybe_blender_validate(dest)+ except RuntimeError as exc:+ print(exc, file=sys.stderr)+ return 1+ if message:+ print(message)+ else:+ print("Blender CLI not found; zip structure and manifest were checked locally.")return 0