Tasks/GoToPreviousTake.py

Tasks/GoToPreviousTake.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: FBTake, FBSystem.CurrentTake,
7 #
8 from pyfbsdk import FBSystem
9 
10 # Get the name of the current take, to look it up in the list
11 # of system takes. Names are unique.
12 lSystem = FBSystem()
13 lCurrentTakeName = lSystem.CurrentTake.Name
14 
15 # Look in the list until we find the index of the current take.
16 for lTakeIdx in range( len( lSystem.Scene.Takes )):
17  if lSystem.Scene.Takes[lTakeIdx].Name == lCurrentTakeName:
18  break;
19 
20 # Decrement the index to point to the next take.
21 # Here we take advantage of Python's subscripting access
22 # where -1 points to the last object in the list, which is
23 # where we want to be if the current take is the first in
24 # the list.
25 lTakeIdx = lTakeIdx - 1
26 
27 # Set the current take using our new index.
28 lSystem.CurrentTake = lSystem.Scene.Takes[lTakeIdx]
29 
30 # Cleanup of local variables.
31 del( lSystem, lCurrentTakeName, lTakeIdx )
32 
33 # Cleanup of imported modules.
34 del( FBSystem )
35