SceneView::SceneView() : View3D( defaultName<SceneView>(), new GafferScene::ScenePlug() ), m_renderableGadget( new RenderableGadget ) { viewportGadget()->setChild( m_renderableGadget ); m_selectionChangedConnection = m_renderableGadget->selectionChangedSignal().connect( boost::bind( &SceneView::selectionChanged, this, ::_1 ) ); viewportGadget()->keyPressSignal().connect( boost::bind( &SceneView::keyPress, this, ::_1, ::_2 ) ); // add a preprocessor which removes motion blur, because the opengl // renderer doesn't support it. StandardOptionsPtr standardOptions = new StandardOptions(); standardOptions->optionsPlug()->getChild<CompoundPlug>( "transformBlur" )->getChild<BoolPlug>( "enabled" )->setValue( true ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "transformBlur" )->getChild<BoolPlug>( "value" )->setValue( false ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "deformationBlur" )->getChild<BoolPlug>( "enabled" )->setValue( true ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "deformationBlur" )->getChild<BoolPlug>( "value" )->setValue( false ); setPreprocessor( standardOptions ); }
SceneView::SceneView( const std::string &name ) : View3D( name, new GafferScene::ScenePlug() ), m_renderableGadget( new RenderableGadget ) { // add plugs and signal handling for them storeIndexOfNextChild( g_firstPlugIndex ); addChild( new IntPlug( "minimumExpansionDepth", Plug::In, 0, 0, Imath::limits<int>::max(), Plug::Default & ~Plug::AcceptsInputs ) ); CompoundPlugPtr lookThrough = new CompoundPlug( "lookThrough", Plug::In, Plug::Default & ~Plug::AcceptsInputs ); lookThrough->addChild( new BoolPlug( "enabled", Plug::In, false, Plug::Default & ~Plug::AcceptsInputs ) ); lookThrough->addChild( new StringPlug( "camera", Plug::In, "", Plug::Default & ~Plug::AcceptsInputs ) ); addChild( lookThrough ); plugSetSignal().connect( boost::bind( &SceneView::plugSet, this, ::_1 ) ); // set up our gadgets viewportGadget()->setPrimaryChild( m_renderableGadget ); m_selectionChangedConnection = m_renderableGadget->selectionChangedSignal().connect( boost::bind( &SceneView::selectionChanged, this, ::_1 ) ); viewportGadget()->keyPressSignal().connect( boost::bind( &SceneView::keyPress, this, ::_1, ::_2 ) ); m_renderableGadget->baseState()->add( const_cast<IECoreGL::State *>( baseState() ) ); baseStateChangedSignal().connect( boost::bind( &SceneView::baseStateChanged, this ) ); m_grid = boost::shared_ptr<Grid>( new Grid( this ) ); ////////////////////////////////////////////////////////////////////////// // add a preprocessor which monkeys with the scene before it is displayed. ////////////////////////////////////////////////////////////////////////// NodePtr preprocessor = new Node(); ScenePlugPtr preprocessorInput = new ScenePlug( "in" ); preprocessor->addChild( preprocessorInput ); // remove motion blur, because the opengl renderer doesn't support it. StandardOptionsPtr standardOptions = new StandardOptions( "disableBlur" ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "transformBlur" )->getChild<BoolPlug>( "enabled" )->setValue( true ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "transformBlur" )->getChild<BoolPlug>( "value" )->setValue( false ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "deformationBlur" )->getChild<BoolPlug>( "enabled" )->setValue( true ); standardOptions->optionsPlug()->getChild<CompoundPlug>( "deformationBlur" )->getChild<BoolPlug>( "value" )->setValue( false ); preprocessor->addChild( standardOptions ); standardOptions->inPlug()->setInput( preprocessorInput ); // add a node for hiding things StandardAttributesPtr hide = new StandardAttributes( "hide" ); hide->attributesPlug()->getChild<CompoundPlug>( "visibility" )->getChild<BoolPlug>( "enabled" )->setValue( true ); hide->attributesPlug()->getChild<CompoundPlug>( "visibility" )->getChild<BoolPlug>( "value" )->setValue( false ); preprocessor->addChild( hide ); hide->inPlug()->setInput( standardOptions->outPlug() ); PathFilterPtr hideFilter = new PathFilter( "hideFilter" ); preprocessor->addChild( hideFilter ); hide->filterPlug()->setInput( hideFilter->matchPlug() ); // make the output for the preprocessor ScenePlugPtr preprocessorOutput = new ScenePlug( "out", Plug::Out ); preprocessor->addChild( preprocessorOutput ); preprocessorOutput->setInput( hide->outPlug() ); setPreprocessor( preprocessor ); }