<s> import os <EOL> import IECore <EOL> import IECoreAppleseed <EOL> import Gaffer <EOL> import GafferScene <EOL> class AppleseedRender ( GafferScene . ExecutableRender ) : <EOL> def __init__ ( self , name = "<STR_LIT>" ) : <EOL> GafferScene . ExecutableRender . __init__ ( self , name ) <EOL> self . addChild ( <EOL> Gaffer . StringPlug ( <EOL> "<STR_LIT>" , <EOL> Gaffer . Plug . Direction . In , <EOL> "<STR_LIT>" , <EOL> ) <EOL> ) <EOL> self . addChild ( <EOL> Gaffer . StringPlug ( <EOL> "<STR_LIT>" , <EOL> ) <EOL> ) <EOL> self . addChild ( <EOL> Gaffer . StringPlug ( <EOL> "<STR_LIT>" , <EOL> Gaffer . Plug . Direction . In , <EOL> "<STR_LIT>" , <EOL> ) <EOL> ) <EOL> def _makeDir ( self , directory ) : <EOL> try : <EOL> os . makedirs ( directory ) <EOL> except OSError : <EOL> if not os . path . isdir ( directory ) : <EOL> raise <EOL> def _createRenderer ( self ) : <EOL> fileName = self [ "<STR_LIT>" ] . getValue ( ) <EOL> directory = os . path . dirname ( fileName ) <EOL> if directory : <EOL> self . _makeDir ( directory ) <EOL> renderer = IECoreAppleseed . Renderer ( fileName ) <EOL> return renderer <EOL> def _outputWorldProcedural ( self , scenePlug , renderer ) : <EOL> GafferScene . SceneProcedural ( scenePlug , Gaffer . Context ( ) . current ( ) , "<STR_LIT:/>" ) . render ( renderer ) <EOL> def _command ( self ) : <EOL> if self [ "<STR_LIT>" ] . getValue ( ) == "<STR_LIT>" : <EOL> return "<STR_LIT>" % ( self [ "<STR_LIT>" ] . getValue ( ) , self [ "<STR_LIT>" ] . getValue ( ) ) <EOL> return "<STR_LIT>" <EOL> IECore . registerRunTimeTyped ( AppleseedRender , typeName = "<STR_LIT>" ) </s>
