UGX-Mods

Call of Duty: Black Ops 3 => Applications & Tools => Custom Maps, Mods & Tools => 3rd-Party Applications & Tools => Topic started by: WantedThing on October 10, 2016, 05:46:40 pm

Title: export2bin script for easy use
Post by: WantedThing on October 10, 2016, 05:46:40 pm
I share with you a little script i have made, it let you convert your xmodel and xanim by just double clicking on them. After that, it's also easy to edit CodMayaTools.py so it will automatically run (then convert) your files after export.

How to install :

1. Make a new file called export2bin.cmd and put it in the same folder as export2bin.exe
2. Copy and paste the content of the script i provide you in the end of this post and save the file.
3. Configure your xmodel and xanim files to automatically open with export2bin.cmd

Now you can convert your files easely by just opening them.

If you want to edit your CodMayaTools.py so it will automatically open your files after export, do the following :

1. Open CodMayaTools.py with a good text editor like notepad++ or sublimeText
2. Search for the following (using ctrl+F) :
Code Snippet
Plaintext
	f.close()
ProgressBarStep()
cmds.refresh()
and add "os.startfile(filePath)" after it, so it looks like this :
Code Snippet
Plaintext
	f.close()
ProgressBarStep()
cmds.refresh()

#Start file for export2bin
os.startfile(filePath)
3. Repeat one more time the step 2, so it will work both for xmodels and xanims

Now your files will be converted to bin automatically

If you want my script to automatically delete xmodels and xanims files after conversion, look for the following line in export2bin.cmd :
Code Snippet
Plaintext
rem del %fileNameFull%
and replace it with :
Code Snippet
Plaintext
del %fileNameFull%

Hope you like it :)


-----------------------------------------------------------------------------------------------
Code for export2bin.cmd :
Code Snippet
Plaintext
@echo off
rem Put this script in the same folder as export2bin
rem Configure xmodel_export and xanim_export files to open with this script
rem for CodMayaTools.py add os.startfile(filePath) on lines 921 and 1308
rem -----------------------------------------------------------------------

set export2bin=%~dp0export2bin.exe

FOR %%i IN ("%~f1") DO (
set fileExtension=%%~xi
set fileNameFull=%%~nxi
set fileDrive=%%~di
set filePath=%%~pi )

set msgBox="%WinDir%\system32\msg.exe"
set msgLine=--------------------

if not "%fileExtension%" == ".xmodel_export" (
if not "%fileExtension%" == ".xanim_export" goto :BadfileName )

cd /d "%fileDrive%%filePath%"

for /f %%i in ('"%export2bin%" %fileNameFull%') do set RESULT=%%i
if %ERRORLEVEL% NEQ 0 goto :CommandError
if "%RESULT%" == "ERROR:" goto :Error

:Finished
rem del %fileNameFull%
(((echo %msgLine%[export2bin script]%msgLine%) & echo.) & echo Conversion done !)|%msgBox% * /TIME:2
exit

:Error
FOR /F "tokens=* USEBACKQ" %%F IN (`"%export2bin%" %fileNameFull%`) DO SET errorMessage=%%F
(((echo %msgLine%[export2bin.exe]%msgLine%) & echo.) & echo %errorMessage%)|%msgBox% *
exit

:BadfileName
((((echo %msgLine%[export2bin script]%msgLine%) & echo.) & echo Please provide a valid .xmodel_export or .xanim_export file.) & echo Your file extension : %fileExtension%)|%msgBox% *
exit

:CommandError
((((echo %msgLine%[export2bin script]%msgLine%) & echo.) & echo Unable to execute export2bin.exe.) & echo export2bin path : %export2bin%)|%msgBox% *
exit

Double Post Merge: October 10, 2016, 06:38:44 pm
Oups, I should have posted it under the BO3 section, sorry for that.