<s> import os <EOL> import glob <EOL> import IECore <EOL> class convertAnimCache ( IECore . Op ) : <EOL> def __init__ ( self ) : <EOL> IECore . Op . __init__ ( self , "<STR_LIT>" , IECore . FileSequenceParameter ( "<STR_LIT:result>" , "<STR_LIT>" ) ) <EOL> self . parameters ( ) . addParameters ( <EOL> [ <EOL> IECore . FileSequenceParameter ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> defaultValue = "<STR_LIT>" , <EOL> allowEmptyString = False , <EOL> check = IECore . FileSequenceParameter . CheckType . MustExist , <EOL> extensions = "<STR_LIT>" , <EOL> ) , <EOL> IECore . FileSequenceParameter ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> defaultValue = "<STR_LIT>" , <EOL> allowEmptyString = False , <EOL> extensions = "<STR_LIT>" , <EOL> ) , <EOL> ] , <EOL> ) <EOL> def doOperation ( self , args ) : <EOL> src = self . parameters ( ) [ "<STR_LIT>" ] . getFileSequenceValue ( ) <EOL> dst = self . parameters ( ) [ "<STR_LIT>" ] . getFileSequenceValue ( ) <EOL> if isinstance ( dst . frameList , IECore . EmptyFrameList ) : <EOL> dst . frameList = src . frameList <EOL> for ( sf , df ) in zip ( src . fileNames ( ) , dst . fileNames ( ) ) : <EOL> sc = IECore . AttributeCache ( sf , IECore . IndexedIOOpenMode . Read ) <EOL> dc = IECore . AttributeCache ( df , IECore . IndexedIOOpenMode . Write ) <EOL> combinedBound = IECore . Box3f ( ) <EOL> for objectName in sc . objects ( ) : <EOL> p = b = None <EOL> with IECore . IgnoredExceptions ( Exception ) : <EOL> p = sc . read ( objectName , "<STR_LIT>" ) <EOL> b = sc . read ( objectName , "<STR_LIT>" ) <EOL> if p is not None and b is not None : <EOL> combinedBound . extendBy ( b . value ) <EOL> dc . write ( "<STR_LIT:->" + objectName , "<STR_LIT>" , p ) <EOL> dc . write ( "<STR_LIT:->" + objectName , "<STR_LIT>" , b ) <EOL> dc . write ( "<STR_LIT:->" , "<STR_LIT>" , IECore . Box3fData ( combinedBound ) ) <EOL> return args [ "<STR_LIT>" ] . value <EOL> IECore . registerRunTimeTyped ( convertAnimCache ) </s>
