Samples/Referencing/FileMonitoring.py

# Copyright 2011 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Demonstrates event handlers setup to receive notification when referenced file or animation clip is modified externally.
#
# Topic: FBFileMonitoring
#
from pyfbsdk import *

def EventFileChangeAnimationClip(control,event):
    lStr = "Animation clip is modified externally.\nFile type: %s\nFile Path: %s" % (str(event.Type), event.Path)
    FBMessageBox( "File modified", lStr, "OK", None, None )

def EventFileChangeFileReference(control,event):
    lStr = "Referenced file is modified externally.\nFile type: %s\nFile Path: %s" % (str(event.Type), event.Path)
    FBMessageBox( "File modified", lStr, "OK", None, None )

lFileMonitoring = FBFileMonitoringManager()    
lFileMonitoring.OnFileChangeFileReference.Add(EventFileChangeFileReference)
lFileMonitoring.OnFileChangeAnimationClip.Add(EventFileChangeAnimationClip)