PDA

View Full Version : TPC2TGA


glovemaster
02-21-2007, 01:32 PM
Is there a way to convert lots of TPC files at once? Doesn't have to be using TPC2TGA i'll happily download another program...

Its just that:


tpc2tga *.tpc *.tga


doesn't work in the batch file for some reason, and KotOR Tool only extracts lots of condesending files for models...

Thanks!

Master Zionosis
02-21-2007, 02:40 PM
I've looked for this before, i can't find a way to do it, its a shame really, i get quite annoyed when i have to extract all the textures i want singly.

glovemaster
02-21-2007, 02:48 PM
Ah buger.. lol

tk102
02-21-2007, 03:08 PM
Is there a way to convert lots of TPC files at once? Doesn't have to be using TPC2TGA i'll happily download another program...

Its just that:


tpc2tga *.tpc *.tga


doesn't work in the batch file for some reason, and KotOR Tool only extracts lots of condesending files for models...

Thanks!
Here's a quick and dirty bulk mode application made from a Perl port of eiz's tpc2tga source code.

I tried it on TSL's texture pack .tpc files, and about 1/2 of them were converted correctly. See if it works for you.

Usage:

bulktpc2tga input-path output-path

Don't append the trailing slash to the paths and don't include any wildcards.
Make sure your output path exists.

http://www.starwarsknights.com/forumdl/bulktpc2tga.rar

glovemaster
02-21-2007, 03:14 PM
Im saved! lol

Thank you soooooooo much!

tk102
02-21-2007, 03:21 PM
Ha ha ha, here's another way...

1. Extract all .tpc files that you like to a directory.
2. Put the tpc2tga.exe file in that directory.
3. From the command prompt type:
for %I in (*.tpc) do tpc2tga.exe %I %I.tga

That will probably work better...
note that your output files will be named filename.tpc.tga however..

glovemaster
02-21-2007, 03:39 PM
can i put that in a BAT file?

tk102
02-21-2007, 04:29 PM
Sure. If you did, though, you'd need to double your percent sign.

Here though, is a .bat file that will do the proper naming for you and allow you to put the output into a separate direcotry. Copy and paste this code into a file called tpcbatch.bat. Put tpc2tga.exe in the same directory as tpcbatch.bat.


@echo off
setlocal
::TPCBATCH.bat
:: provides a bulk method of converting tpc files
:: to tga files using Eiz's TPC2TGA.exe program
:::::::::
:: check usage
:::::::::
if {%1} == {} goto :usage
if {%2} == {} goto :usage
set INPATH=%1
set OUTPATH=%2

:::::::::
:: does TPC2TGA.exe exist in this directory?
:::::::::
for /f %%I in ('cd') do set EXEPATH=%%I
if not %EXEPATH:~-1,1%==\ set EXEPATH=%EXEPATH%\
set EXEPATH=%EXEPATH%tpc2tga.exe
if not exist %EXEPATH% goto :noexe

:::::::::
:: make sure paths have backslash
:::::::::
if not %INPATH:~-1,1%==\ set INPATH=%INPATH%\
if not %OUTPATH:~-1,1%==\ set OUTPATH=%OUTPATH%\

:::::::::
:: does the input directory have TPC files to work with?
:::::::::
if not exist "%INPATH%*.tpc" goto :notpc

:::::::::
:: does the output directory exist?
:: if not, attempt to create it
:::::::::
if not exist "%OUTPATH%." md "%OUTPATH%"
if not exist "%OUTPATH%." goto :badoutpath


:::::::::
:: if so, process them!
:::::::::
for /f %%I in ('dir /b "%INPATH%*.tpc"') do call :work %%I



goto :eof

:usage
echo Usage:
echo tpcbatch [path to tpc files] [path to output tga files]

goto :end

:notpc
echo No TPC files found in %INPATH%
goto :end

:noexe
echo Could not find %EXEPATH%
goto :end

:badoutpath
echo Could not create directory %OUTPATH%
goto :end


:work
set TPCFILE=%1
set TGAFILE=%TPCFILE:.tpc=.tga%
echo %EXEPATH% %INPATH%%TPCFILE% %OUTPATH%%TGAFILE%
%EXEPATH% "%INPATH%%TPCFILE%" "%OUTPATH%%TGAFILE%"
goto :eof


:end

glovemaster
02-22-2007, 11:49 AM
EDIT
Dont listen to me.. lol

Its great and i got it to work... Thankyou!!!