Tasks/StartDevice.py

Tasks/StartDevice.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 # Find a Device (from its name) in the scene and start it
8 #
9 # Topic:FBDevice, FBScene, FBPlayerControl
10 #
11 
12 from pyfbsdk import *
13 
14 #Change the name of the following value to match your device name
15 DeviceName = "MyDevice"
16 
17 def FindDevice( pName ):
18  lResult = None
19  lDeviceList = FBSystem().Scene.Devices
20 
21  if lDeviceList:
22  #print "get camera device"
23  for lDevice in lDeviceList:
24  #print "Device Name = %s" % lDevice.Name
25  if lDevice.Name == pName:
26  lResult = lDevice
27  break
28  else:
29  print 'No device found'
30 
31  return lResult
32 
33 
34 #Actual script
35 lDevice = FindDevice( DeviceName )
36 if lDevice:
37  lDevice.Live = True
38  lDevice.RecordMode = True
39  lDevice.Online = True
40 
41  lPlayer = FBPlayerControl()
42  #First argument for Record is to override the take, second one is to copy the data
43  #Uncomment the following lines to automatically record
44  #lPlayer.Record(False, True)
45  #lPlayer.Play(False)
46 else:
47  print 'No device found'
48