# 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:FBViewerInfos, FBProperty.Data
#

from pyfbsdk import *

# This script sets up camera information to be displayed in the viewer.
# The info will show up in renders.
# To enable this, edit the <APP>\bin\config\<MACHINE>.Application.txt file
# In the 'Display' section, set the value of the token 'ViewerInfoDisplay'
# to 'Enable'.

lViewerInfos = FBSystem().Renderer.ViewerInfos

if lViewerInfos:

    # Known Camera Name properties, as 
    #   Camera Name Visibility
    #   Camera Name Justification
    #   Camera Name Horizontal Dock
    #   Camera Name Vertical Dock
    #   Camera Name Position X
    #   Camera Name Position Y
    #   Camera Name Size
    #   Camera Name Color
    #   Camera Name Background Color    
    lViewerInfos.PropertyList.Find( 'Camera Name Visibility' ).Data       = True
    lViewerInfos.PropertyList.Find( 'Camera Name Justification' ).Data    = 1   # Left=0, Center=1, Right=2
    lViewerInfos.PropertyList.Find( 'Camera Name Horizontal Dock' ).Data  = 1   # Left=0, Center=1, Right=2
    lViewerInfos.PropertyList.Find( 'Camera Name Vertical Dock' ).Data    = 2   # Bottom=0, Center=1, Top=2
    lViewerInfos.PropertyList.Find( 'Camera Name Position X' ).Data       = 30
    lViewerInfos.PropertyList.Find( 'Camera Name Position Y' ).Data       = -50
    lViewerInfos.PropertyList.Find( 'Camera Name Size' ).Data             = 1.5
    lViewerInfos.PropertyList.Find( 'Camera Name Color' ).Data            = FBColorAndAlpha( 0.2, 0.4, 0.6 )
    lViewerInfos.PropertyList.Find( 'Camera Name Background Color' ).Data = FBColorAndAlpha( 1.0, 0.0, 0.0 )

    lViewerInfos.Visibility = True
else:
    print 'Viewer information not available. Edit the config file to enable it.'