InteractiveRender::InteractiveRender( const IECore::InternedString &rendererType, const std::string &name ) : Node( name ), m_state( Stopped ) { storeIndexOfNextChild( g_firstPlugIndex ); addChild( new ScenePlug( "in" ) ); addChild( new StringPlug( rendererType.string().empty() ? "renderer" : "__renderer", Plug::In, rendererType.string() ) ); addChild( new IntPlug( "state", Plug::In, Stopped, Stopped, Paused, Plug::Default & ~Plug::Serialisable ) ); addChild( new ScenePlug( "out", Plug::Out, Plug::Default & ~Plug::Serialisable ) ); addChild( new ScenePlug( "__adaptedIn", Plug::In, Plug::Default & ~Plug::Serialisable ) ); SceneProcessorPtr adaptors = RendererAlgo::createAdaptors(); setChild( "__adaptors", adaptors ); adaptors->inPlug()->setInput( inPlug() ); adaptedInPlug()->setInput( adaptors->outPlug() ); outPlug()->setInput( inPlug() ); plugDirtiedSignal().connect( boost::bind( &InteractiveRender::plugDirtied, this, ::_1 ) ); }
void plugSet( const Plug *plug ) { if( plug != shadingModePlug() ) { return; } const std::string name = shadingModePlug()->getValue(); SceneProcessorPtr shadingMode = NULL; ShadingModes::const_iterator it = m_shadingModes.find( name ); if( it != m_shadingModes.end() ) { shadingMode = it->second; } else { ShadingModeCreatorMap &m = shadingModeCreators(); ShadingModeCreatorMap::const_iterator it = m.find( name ); if( it != m.end() ) { shadingMode = it->second(); } if( shadingMode ) { m_shadingModes[name] = shadingMode; m_preprocessor->addChild( shadingMode ); } } if( shadingMode ) { shadingMode->inPlug()->setInput( m_preprocessor->inPlug() ); m_preprocessor->outPlug()->setInput( shadingMode->outPlug() ); } else { m_preprocessor->outPlug()->setInput( m_preprocessor->inPlug() ); } }