#NEWLINE# @ publisher #NEWLINE# def check_if_previous_version_references( ) : #NEWLINE# #INDENT# 'check if a previous version of the same task is referenced to the scene\n    ' #NEWLINE# from anima.env.mayaEnv import Maya #NEWLINE# m = Maya ( ) #NEWLINE# ver = m . get_current_version ( ) #NEWLINE# if ( ver is None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# same_version_references = [ ] #NEWLINE# for ref in pm . listReferences ( ) : #NEWLINE# #INDENT# ref_version = m . get_version_from_full_path ( ref . path ) #NEWLINE# if ref_version : #NEWLINE# #INDENT# if ( ( ref_version . task == ver . task ) and ( ref_version . take_name == ver . take_name ) ) : #NEWLINE# #INDENT# same_version_references . append ( ref ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if len ( same_version_references ) : #NEWLINE# #INDENT# print ( 'The following nodes are references to an older version of this scene' ) #NEWLINE# print ( '\n' . join ( map ( ( lambda x : x . refNode . name ( ) ) , same_version_references ) ) ) #NEWLINE# raise PublishError ( 'The current scene contains a <b>reference</b> to a<br><b>previous version</b> of itself.<br><br>Please remove it!!!' )