@ECHO OFF
CLS



REM Show arguments
C:\horde3d-assets\binaries\ColladaConv.exe
ECHO.
REM pause

IF NOT "%1" == "" GOTO dragndrop

SET cmdLine=
SET /P cmdLine=Enter arguments: 
ECHO.

C:\horde3d-assets\binaries\ColladaConv.exe %cmdLine%

ECHO.
REM pause
GOTO exit


:dragndrop
REM https://stackoverflow.com/questions/47426129/difference-between-1-and-1-in-batch
REM https://stackoverflow.com/questions/5034076/what-does-dp0-mean-and-how-does-it-work
echo file: %~s1 
echo dir:  %~p1

REM  SET outputDir=%~dp0..\..\Content
REM  SET baseDir=%~dp0..\..\Content
REM pause


echo file ext: %~x1
IF  "%~x1" NEQ ".dae" (
echo File must be .dae type.
echo Exiting.
echo.
REM pause
GOTO exit
)
REM pause

SET outputDir=%~dp1..\Content
SET baseDir=%~dp1..\Content

echo check dir: %outputDir%
REM pause


IF NOT EXIST %outputDir% (
echo .dea file must be a folder in the same directory 
echo as the Content folder ie that animations, materials etc.
echo Exiting.
echo.
REM pause
GOTO exit
)

echo.
echo out %outputDir%
echo base %baseDir%
echo.
echo drag and drop .dea files
echo.
REM pause

IF NOT EXIST %outputDir%\animations\%~n1 mkdir %outputDir%\animations\%~n1
copy %1 %outputDir%\animations\%~n1

%~d0 
cd %~dp0
pwd
echo C:\horde3d-assets\binaries\ColladaConv.exe animations\%~n1\%~nx1 -base %baseDir% -dest %outputDir%
C:\horde3d-assets\binaries\ColladaConv.exe animations\%~n1\%~nx1 -type anim -base %baseDir% -dest %outputDir%

del %outputDir%\animations\%~n1\%~nx1

:exit
