@echo off
@setlocal

rem *+
rem * ==========================================================================
rem * The information  in  this  file is  provided for the  exclusive use of the
rem * licensees of Alias Systems Corp. Such users have the right to use, modify,
rem * and  incorporate this code  into  other  products  for purposes authorized
rem * by the  Alias Systems Corp. license agreement, without fee.
rem *
rem * Alias Systems Corp. disclaims all warranties with regard to this software,
rem * including all implied warranties  of  merchantability and  fitness.  In no
rem * event  shall  Alias Systems Corp. be liable for any  special,  indirect or
rem * consequential  damages  or  any  damages whatsoever resulting from loss of
rem * use, data  or profits, whether in  an  action of  contract,  negligence or
rem * other tortious  action,  arising out of or  in connection  with the use or
rem * performance of this software.
rem * ==========================================================================
rem *-

rem * ==========================================================================
rem *
rem *  This file allows mental ray for Maya, to render .ma/.mb files.
rem *
rem * ==========================================================================

rem **
rem ** If the user has supplied no arguments, display the help message.
rem **

if "%1" == "" (
		echo.
		echo * Not enough arguments
		echo.
		goto HELP
)

rem **
rem ** If the user has specified the -help flag, display the help message.
rem **

if "%1" == "-help" (
	goto HELP 
)
if "%1" == "-h" (
	goto HELP 
)

rem **
rem ** Find the Maya installation.  If the MAYA_INSTALL_PATH variable is set, then
rem ** use that location, otherwise use the default value (set by the installer
rem ** when mental ray for Maya is installed).
rem **

if "%MAYA_INSTALL_PATH%" == "" (

		set MAYA_INSTALL_PATH=<MAYAINSTALLDIR>
)

rem **
rem ** make sure Maya installation can be found
rem **

if NOT EXIST "%MAYA_INSTALL_PATH%\bin\mayabatch.exe" (
		echo.
		echo Error: Could not find Maya installation in 
		echo        "%MAYA_INSTALL_PATH%".  Please verify that you
		echo        have correctly installed the software there, or
		echo        set the MAYA_INSTALL_PATH variable to point to the
		echo        actual installation location.
		echo.
		echo        For example:
		echo.
		echo        SET MAYA_INSTALL_PATH=C:\Program Files\Alias\Maya6.0
		echo.
		goto END
)

:RENDER

rem **
rem ** build the render command
rem **

set RENDERCOMMAND="%MAYA_INSTALL_PATH%\bin\mayabatch" %* -command mrBatchRender(2,1)

echo.
echo Starting render...
echo Command: %RENDERCOMMAND%
echo.

rem **
rem ** invoke the render command
rem **

%RENDERCOMMAND%

echo.
echo Rendering complete.  
echo.

goto END

:HELP

echo.
echo Usage: mayarender_with_mr -file sceneFile [ -proj projectName ]
echo.
echo        Batch renders a Maya scene [.mb/.ma] file using mental ray for Maya.
echo.
echo        If no project is specified, the current project is used.
echo.
goto END

:END

@endlocal

