Samples/Referencing/FileMonitoring.py

Samples/Referencing/FileMonitoring.py
1 # Copyright 2011 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 # Demonstrates event handlers setup to receive notification when referenced file or animation clip is modified externally.
8 #
9 # Topic: FBFileMonitoring
10 #
11 from pyfbsdk import *
12 
13 def EventFileChangeAnimationClip(control,event):
14  lStr = "Animation clip is modified externally.\nFile type: %s\nFile Path: %s" % (str(event.Type), event.Path)
15  FBMessageBox( "File modified", lStr, "OK", None, None )
16 
17 def EventFileChangeFileReference(control,event):
18  lStr = "Referenced file is modified externally.\nFile type: %s\nFile Path: %s" % (str(event.Type), event.Path)
19  FBMessageBox( "File modified", lStr, "OK", None, None )
20 
21 lFileMonitoring = FBFileMonitoringManager()
22 lFileMonitoring.OnFileChangeFileReference.Add(EventFileChangeFileReference)
23 lFileMonitoring.OnFileChangeAnimationClip.Add(EventFileChangeAnimationClip)