upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/batch_glb.py
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:08:55 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:08:55 -0500
commit2feedae6969fc25d1e3e10e4465cfbc3358ee004 (patch)
treeec0b5382ada5d7f5889adb6dfc7b29288e89dcbd /tools/batch_glb.py
parente549ac4c07f37685d56232924deffb94e7237842 (diff)
parent4799d88d756be9625db0503b153873e9737fc895 (diff)
Merge pull request #3852 from bbareth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/batch_glb.py')
-rw-r--r--tools/batch_glb.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/batch_glb.py b/tools/batch_glb.py
index 8564961e1..075d961d9 100644
--- a/tools/batch_glb.py
+++ b/tools/batch_glb.py
@@ -192,6 +192,20 @@ def batch_convert(
192 } 192 }
193 193
194 194
195def _positive_jobs(value: str) -> int:
196 jobs = int(value)
197 if jobs <= 0:
198 raise argparse.ArgumentTypeError(f"must be a positive integer (got {value!r})")
199 return jobs
200
201
202def _non_negative_int(value: str) -> int:
203 num = int(value)
204 if num < 0:
205 raise argparse.ArgumentTypeError(f"must be >= 0 (got {value!r})")
206 return num
207
208
195def main(argv: list[str] | None = None) -> int: 209def main(argv: list[str] | None = None) -> int:
196 parser = argparse.ArgumentParser( 210 parser = argparse.ArgumentParser(
197 description="Batch convert Wavefront OBJ models to binary glTF 2.0 (.glb)." 211 description="Batch convert Wavefront OBJ models to binary glTF 2.0 (.glb)."
@@ -200,7 +214,7 @@ def main(argv: list[str] | None = None) -> int:
200 parser.add_argument("out_dir", help="Output directory for .glb files") 214 parser.add_argument("out_dir", help="Output directory for .glb files")
201 parser.add_argument( 215 parser.add_argument(
202 "--jobs", 216 "--jobs",
203 type=int, 217 type=_positive_jobs,
204 default=None, 218 default=None,
205 help="Number of parallel worker threads (default: CPU count)", 219 help="Number of parallel worker threads (default: CPU count)",
206 ) 220 )
@@ -218,7 +232,7 @@ def main(argv: list[str] | None = None) -> int:
218 ) 232 )
219 parser.add_argument( 233 parser.add_argument(
220 "--max-tex-size", 234 "--max-tex-size",
221 type=int, 235 type=_non_negative_int,
222 default=0, 236 default=0,
223 help="Max texture dimension in pixels when decoding DDS (0 = unconstrained)", 237 help="Max texture dimension in pixels when decoding DDS (0 = unconstrained)",
224 ) 238 )