<s> import IECore <EOL> import Gaffer <EOL> class AddNode ( Gaffer . ComputeNode ) : <EOL> def __init__ ( self , name = "<STR_LIT>" ) : <EOL> Gaffer . ComputeNode . __init__ ( self , name ) <EOL> p1 = Gaffer . IntPlug ( "<STR_LIT>" , Gaffer . Plug . Direction . In ) <EOL> p2 = Gaffer . IntPlug ( "<STR_LIT>" , Gaffer . Plug . Direction . In ) <EOL> self . addChild ( Gaffer . BoolPlug ( "<STR_LIT>" , defaultValue = True ) ) <EOL> self . addChild ( p1 ) <EOL> self . addChild ( p2 ) <EOL> p3 = Gaffer . IntPlug ( "<STR_LIT>" , Gaffer . Plug . Direction . Out ) <EOL> self . addChild ( p3 ) <EOL> self . numHashCalls = <NUM_LIT:0> <EOL> self . numComputeCalls = <NUM_LIT:0> <EOL> def enabledPlug ( self ) : <EOL> return self [ "<STR_LIT>" ] <EOL> def correspondingInput ( self , output ) : <EOL> if output . isSame ( self [ "<STR_LIT>" ] ) : <EOL> return self [ "<STR_LIT>" ] <EOL> return Gaffer . ComputeNode . correspondingInput ( self , output ) <EOL> def affects ( self , input ) : <EOL> outputs = Gaffer . ComputeNode . affects ( self , input ) <EOL> if input . getName ( ) in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> outputs . append ( self . getChild ( "<STR_LIT>" ) ) <EOL> return outputs <EOL> def hash ( self , output , context , h ) : <EOL> assert ( output . isSame ( self . getChild ( "<STR_LIT>" ) ) or plug . getFlags ( ) & plug . Flags . Dynamic ) <EOL> self . getChild ( "<STR_LIT>" ) . hash ( h ) <EOL> self . getChild ( "<STR_LIT>" ) . hash ( h ) <EOL> self . getChild ( "<STR_LIT>" ) . hash ( h ) <EOL> self . numHashCalls += <NUM_LIT:1> <EOL> def compute ( self , plug , context ) : <EOL> assert ( plug . isSame ( self . getChild ( "<STR_LIT>" ) ) or plug . getFlags ( ) & plug . Flags . Dynamic ) <EOL> assert ( isinstance ( context , Gaffer . Context ) ) <EOL> assert ( plug . settable ( ) ) <EOL> assert ( not self [ "<STR_LIT>" ] . settable ( ) ) <EOL> assert ( not self [ "<STR_LIT>" ] . settable ( ) ) <EOL> if self [ "<STR_LIT>" ] . getValue ( ) : <EOL> plug . setValue ( self . getChild ( "<STR_LIT>" ) . getValue ( ) + self . getChild ( "<STR_LIT>" ) . getValue ( ) ) <EOL> else : <EOL> plug . setValue ( self . getChild ( "<STR_LIT>" ) . getValue ( ) ) <EOL> self . numComputeCalls += <NUM_LIT:1> <EOL> IECore . registerRunTimeTyped ( AddNode , typeName = "<STR_LIT>" ) </s>
