Tasks/MultiLayerKeying.py

Tasks/MultiLayerKeying.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 # Script description:
7 # Create multiple keys on a cube.
8 #
9 # Topic: FBTake, FBPlayerControl
10 #
11 from pyfbsdk import *
12 
13 #Define unselesct all function
14 def UnselectAll():
15  for each in Scene.Components:
16  if each.HasObjectFlags(FBObjectFlag.kFBFlagSelectable):
17  each.Selected = False
18 
19 #Init
20 Player = FBPlayerControl()
21 Scene = FBSystem().Scene
22 System = FBSystem()
23 
24 ##Test the layer system by creating/removing/renaming layer
25 System.CurrentTake.CreateNewLayer()
26 LayerCount = System.CurrentTake.GetLayerCount()
27 System.CurrentTake.SetCurrentLayer(LayerCount-1)
28 NewLayer = System.CurrentTake.GetLayer(LayerCount-1)
29 NewLayer.Name = "New Layer Created"
30 
31 ##Create a cube
32 cube = FBModelCube("Cube")
33 
34 ##Property Init
35 cube.Show = True
36 cube.Visibility = True
37 cube.Selected = True
38 Player.Goto(FBTime(0,0,0,0))
39 cube.Translation = FBVector3d(10,10,10)
40 cube.Rotation = FBVector3d(10,20,30)
41 
42 ##Add a key at time 0
43 Player.Key()
44 
45 ##Set TRS Animation at time 10
46 Player.Goto(FBTime(0,0,0,10))
47 cube.Translation = FBVector3d(30,30,30)
48 cube.Rotation = FBVector3d(30,0,20)
49 Player.Key()