Advertisement
Guest User

retex.bat

a guest
Jan 5th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.83 KB | None | 0 0
  1.  
  2. @echo off
  3. setlocal enabledelayedexpansion
  4.  
  5. set source=xp_texnum.vmf
  6. set result=xp_texnum_mod.vmf
  7.  
  8. set /a idx=0
  9. cd /d "..\Half-Life 2\hl2\materials"
  10. for /d %%d in (Brick Building_Template Concrete Metal Nature Plaster Stone Tile Wood) do (
  11.     cd %%d
  12.     for %%v in (*_normal.vtf) do call :getname %%d/%%v
  13.     cd ..
  14. )
  15.  
  16. set /a idx=0
  17. set tex=dummy
  18. cd /d "%~dp0"
  19. for /f "tokens=1-2*" %%a in (%source%) do (
  20.     if %%a=="material" (
  21.         if not %%b=="TOOLS/TOOLSSKYBOX" (
  22.             if not %%b=="TOOLS/TOOLSCLIP" (
  23.                 call :select
  24.                 echo %%a !tex! %%c>>%result%
  25.             ) else echo %%a %%b %%c>>%result%
  26.         ) else echo %%a %%b %%c>>%result%
  27.     ) else echo %%a %%b %%c>>%result%
  28. )
  29.  
  30. endlocal
  31. pause
  32. goto :eof
  33.  
  34. :getname
  35. set /a idx=%idx%+1
  36. set vtf=%1
  37. set tex%idx%="%vtf:~0,-11%"
  38. goto :eof
  39.  
  40. :select
  41. set /a idx=%idx%+1
  42. set tex=!tex%idx%!
  43. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement