# 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.
#
# Script description:
# Create multiple keys on a cube.
#
# Topic: FBTake, FBPlayerControl
#
from pyfbsdk import *

#Define unselesct all function
def UnselectAll():
    for each in Scene.Components:
       if each.HasObjectFlags(FBObjectFlag.kFBFlagSelectable):
            each.Selected = False

#Init
Player = FBPlayerControl()
Scene = FBSystem().Scene
System = FBSystem()

##Test the layer system by creating/removing/renaming layer
System.CurrentTake.CreateNewLayer()
LayerCount = System.CurrentTake.GetLayerCount()
System.CurrentTake.SetCurrentLayer(LayerCount-1)
NewLayer = System.CurrentTake.GetLayer(LayerCount-1)
NewLayer.Name = "New Layer Created"

##Create a cube
cube = FBModelCube("Cube")

##Property Init
cube.Show = True
cube.Visibility = True
cube.Selected = True
Player.Goto(FBTime(0,0,0,0))
cube.Translation = FBVector3d(10,10,10)
cube.Rotation = FBVector3d(10,20,30)

##Add a key at time 0
Player.Key()

##Set TRS Animation at time 10
Player.Goto(FBTime(0,0,0,10))
cube.Translation = FBVector3d(30,30,30)
cube.Rotation = FBVector3d(30,0,20)
Player.Key()