Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Merge feat/rodin-direct 35737e2a: Generate 3D with Hyper3D Rodin directly, with your own key (#123, @ElgoogUdiab)

islandmedeba0887b5e46
diff --cc tools/brush-gallery/check_published.py
index 46c2b98e,444389c7..ca08b432
--- a/tools/brush-gallery/check_published.py
+++ b/tools/brush-gallery/check_published.py
@@@ -14,7 -19,8 +19,9 @@@ Standard library only
import hashlib
import json
+import os
+ import shutil
+ import subprocess
import sys
import urllib.request
from pathlib import Path
@@@ -35,16 -41,16 +42,22 @@@ def local_tree()
def public_tree():
+ # SF_GALLERY_PUBLIC=<file>: the public tree from a JSON file of {path: blob sha} (the release test's sandbox,
+ # which mustn't depend on GitHub's API: an unauthenticated call from a shared CI runner hits its rate limit).
+ if os.environ.get("SF_GALLERY_PUBLIC"):
+ return json.loads(Path(os.environ["SF_GALLERY_PUBLIC"]).read_text())
- url = f"https://api.github.com/repos/{PUBLIC}/git/trees/main?recursive=1"
- headers = {"Accept": "application/vnd.github+json"}
- if token := os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN"):
- headers["Authorization"] = f"Bearer {token}"
- with urllib.request.urlopen(urllib.request.Request(url, headers=headers), timeout=30) as r:
- tree = json.load(r)["tree"]
+ path = f"repos/{PUBLIC}/git/trees/main?recursive=1"
+ if shutil.which("gh"):
+ r = subprocess.run(["gh", "api", path], capture_output=True, text=True, timeout=60)
+ if r.returncode != 0:
+ raise RuntimeError(f"gh api {path} failed: {(r.stderr or r.stdout).strip()[:200]}")
+ tree = json.loads(r.stdout)["tree"]
+ else:
- url = f"https://api.github.com/{path}"
- with urllib.request.urlopen(urllib.request.Request(url, headers={"Accept": "application/vnd.github+json"}), timeout=30) as r:
++ headers = {"Accept": "application/vnd.github+json"}
++ if token := os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN"):
++ headers["Authorization"] = f"Bearer {token}"
++ with urllib.request.urlopen(urllib.request.Request(f"https://api.github.com/{path}", headers=headers), timeout=30) as r:
+ tree = json.load(r)["tree"]
return {t["path"]: t["sha"] for t in tree if t["type"] == "blob"}