@echo off chcp 65001 >nul setlocal rem ========================================================================== rem convert.bat - launcher for convert_models.py (ASCII-only on purpose) rem rem Usage: rem double-click -> use default INPUT / OUTPUT below rem drag a folder onto this bat -> folder becomes INPUT rem convert.bat IN OUT -> explicit input / output dir rem convert.bat IN OUT --draco --recursive -> extra flags are forwarded rem ========================================================================== set "HERE=%~dp0" set "SCRIPT=%HERE%convert_models.py" rem ---------------------------- defaults ------------------------------------ set "DEF_IN=E:\Godot\agame\assets\FBX" set "DEF_OUT=E:\Godot\agame\assets\GLB" rem ---------------------------- input dir ----------------------------------- set "INPUT=%~1" if "%INPUT%"=="" set "INPUT=%DEF_IN%" if not exist "%INPUT%" set "INPUT=%DEF_IN%" rem if a file (not a folder) was dropped, use its parent folder set "ATTR=%~a1" if not "%ATTR%"=="" if not "%ATTR:~0,1%"=="d" for %%I in ("%~1") do set "INPUT=%%~dpI" rem strip trailing backslash if "%INPUT:~-1%"=="\" set "INPUT=%INPUT:~0,-1%" rem ---------------------------- output dir ---------------------------------- set "OUTPUT=%~2" if "%OUTPUT%"=="" set "OUTPUT=%DEF_OUT%" if "%OUTPUT:~-1%"=="\" set "OUTPUT=%OUTPUT:~0,-1%" rem ---------------------------- extra flags --------------------------------- set "EXTRA=" if not "%~3"=="" set "EXTRA=%~3" if not "%~4"=="" set "EXTRA=%EXTRA% %~4" if not "%~5"=="" set "EXTRA=%EXTRA% %~5" if not "%~6"=="" set "EXTRA=%EXTRA% %~6" if not "%~7"=="" set "EXTRA=%EXTRA% %~7" if not "%~8"=="" set "EXTRA=%EXTRA% %~8" if not "%~9"=="" set "EXTRA=%EXTRA% %~9" rem ---------------------------- find python --------------------------------- set "PY=" where py.exe >nul 2>nul if %errorlevel% equ 0 set "PY=py -3" if not defined PY ( where python.exe >nul 2>nul if not errorlevel 1 set "PY=python" ) if not defined PY if exist "D:\dev\python\python3.13.7\python.exe" set "PY=D:\dev\python\python3.13.7\python.exe" if not defined PY if exist "C:\Users\%USERNAME%\.workbuddy\binaries\python\versions\3.13.12\python.exe" set "PY=C:\Users\%USERNAME%\.workbuddy\binaries\python\versions\3.13.12\python.exe" if not defined PY ( echo [ERROR] Python not found. Install Python 3, or edit PY in this file. echo You can also run Blender directly: echo blender.exe -b --factory-startup --python "%SCRIPT%" -- --input "%INPUT%" --output "%OUTPUT%" echo. pause exit /b 2 ) if not exist "%SCRIPT%" ( echo [ERROR] convert_models.py not found next to this bat: echo %SCRIPT% echo. pause exit /b 2 ) echo ========================================================== echo Input : %INPUT% echo Output : %OUTPUT% echo Python : %PY% echo ========================================================== echo. %PY% "%SCRIPT%" --input "%INPUT%" --output "%OUTPUT%" %EXTRA% set "RC=%errorlevel%" echo. echo ---------------------------------------------------------- if "%RC%"=="0" echo DONE. if not "%RC%"=="0" echo FINISHED WITH ERRORS (exit code %RC%). See _convert_report.txt echo ---------------------------------------------------------- pause endlocal & exit /b %RC%