#NEWLINE# def find_keyframes_distances( event , src_keytimes , dst_keytimes , timecodes , max_kf_distance ) : #NEWLINE# #INDENT# def find_keyframe_distance( src_time , dst_time ) : #NEWLINE# #INDENT# src = get_distance_to_closest_kf ( src_time , src_keytimes ) #NEWLINE# dst = get_distance_to_closest_kf ( dst_time , dst_keytimes ) #NEWLINE# snapping_limit = ( timecodes . get_frame_size ( src_time ) * max_kf_distance ) #NEWLINE# if ( ( abs ( src ) < snapping_limit ) and ( abs ( dst ) < snapping_limit ) and ( abs ( ( src - dst ) ) < snapping_limit ) ) : #NEWLINE# #INDENT# return ( dst - src ) #NEWLINE# #UNINDENT# return 0 #NEWLINE# #UNINDENT# ds = find_keyframe_distance ( event . start , event . shifted_start ) #NEWLINE# de = find_keyframe_distance ( event . end , event . shifted_end ) #NEWLINE# return ( event , de )