Tasks/SetAllCamerasBackgroundColorFromCurrentCamera.py

Tasks/SetAllCamerasBackgroundColorFromCurrentCamera.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 #
6 # Topic: FBCamera, FBColor
7 #
8 
9 from pyfbsdk import FBSystem, FBColor
10 
11 # First we get the current camera from the system renderer.
12 lSystem = FBSystem()
13 lCurrentCamera = lSystem.Renderer.CurrentCamera
14 
15 # Then we iterate thru the list of all the cameras in the system to set the
16 # background color to be identical to the settings of the current camera.
17 for lCamera in lSystem.Scene.Cameras:
18  # WARNING: Due to a problem with the implementation of the class
19  # FBPropertyAnimatableColor, we have to create a tuple from the
20  # string representation of the BackGroundColor. This tuple is then
21  # used as a parameter in the constructor of FBColor.
22  lCamera.BackGroundColor = FBColor( eval( str( lCurrentCamera.BackGroundColor )))
23 
24 # Cleanup everything.
25 del( lSystem, lCurrentCamera, lCamera )
26 del( FBSystem, FBColor )