Tasks/GoToNextTake.py

Tasks/GoToNextTake.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 
9 from pyfbsdk import FBSystem
10 
11 # Get the name of the current take, to look it up in the list
12 # of system takes. Names are unique.
13 lSystem = FBSystem()
14 lCurrentTakeName = lSystem.CurrentTake.Name
15 
16 # Look in the list until we find the index of the current take.
17 for lTakeIdx in range( len( lSystem.Scene.Takes )):
18  if lSystem.Scene.Takes[lTakeIdx].Name == lCurrentTakeName:
19  break;
20 
21 # Increment the index to point to the next take.
22 lTakeIdx = lTakeIdx + 1
23 
24 # Wrap around the end if the current take is the last.
25 if lTakeIdx == len( lSystem.Scene.Takes ): lTakeIdx = 0
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