# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Topic: FBVideoGrabber, FBVideoGrabber.GetOptions, FBApplication.FileRender
#

from pyfbsdk import *

# Create an application object.
lApp = FBApplication()

# We need the full path of the output file.
if lApp.FBXFileName!=None:
    lDstFileName = lApp.FBXFileName.replace( '.fbx', '.jpg' )
else:
    lDstFileName = r'C:\Default.jpg'# WARNING: If the current scene has yet to be named (i.e. after a File->New), this script will set the render path to C:\Default.jpg

# Get the default rendering options, which are saved in the FBX file.
lOptions = FBVideoGrabber().GetOptions()

# Set the name of the rendered file.
# The rendering will be done in the same folder as the original FBX file.
lOptions.OutputFileName = lDstFileName

# Setup the compression level.
# The value should be between '1' and '100', and indicates the size of
# the compressed rendered file vs the size of an uncompressed rendered
# file. In other words, '100' means 'no compression'.
# As the value tends towards 1, the quality of the rendered frame will
# decrease.
lOptions.StillImageCompression = 40

# Enable audio rendering. The file name will be the same as the FBX file,
# but will have a .wav extention.
lOptions.RenderAudio = True

# Do the render. This will always be done in uncompressed mode.
lApp.FileRender( lOptions )