#NEWLINE# def paste( menu ) : #NEWLINE# #INDENT# s = scope ( menu ) #NEWLINE# originalSelection = Gaffer . StandardSet ( iter ( s . script . selection ( ) ) ) #NEWLINE# with Gaffer . UndoContext ( s . script ) : #NEWLINE# #INDENT# s . script . paste ( s . parent ) #NEWLINE# if ( s . nodeGraph is None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# s . nodeGraph . graphGadget ( ) . getLayout ( ) . connectNodes ( s . nodeGraph . graphGadget ( ) , s . script . selection ( ) , originalSelection ) #NEWLINE# bound = s . nodeGraph . bound ( ) #NEWLINE# mousePosition = GafferUI . Widget . mousePosition ( ) #NEWLINE# if bound . intersects ( mousePosition ) : #NEWLINE# #INDENT# fallbackPosition = ( mousePosition - bound . min ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fallbackPosition = ( bound . center ( ) - bound . min ) #NEWLINE# #UNINDENT# fallbackPosition = s . nodeGraph . graphGadgetWidget ( ) . getViewportGadget ( ) . rasterToGadgetSpace ( IECore . V2f ( fallbackPosition . x , fallbackPosition . y ) , gadget = s . nodeGraph . graphGadget ( ) ) . p0 #NEWLINE# fallbackPosition = IECore . V2f ( fallbackPosition . x , fallbackPosition . y ) #NEWLINE# s . nodeGraph . graphGadget ( ) . getLayout ( ) . positionNodes ( s . nodeGraph . graphGadget ( ) , s . script . selection ( ) , fallbackPosition ) #NEWLINE# s . nodeGraph . frame ( s . script . selection ( ) , extend = True )