ScriptNode::ScriptNode( const std::string &name ) : Node( name ), m_selection( new StandardSet ), m_selectionOrphanRemover( m_selection ), m_undoIterator( m_undoList.end() ), m_currentActionStage( Action::Invalid ), m_context( new Context ) { storeIndexOfNextChild( g_firstPlugIndex ); addChild( new StringPlug( "fileName", Plug::In, "", Plug::Default & ~Plug::Serialisable ) ); addChild( new BoolPlug( "unsavedChanges", Plug::In, false, Plug::Default & ~Plug::Serialisable ) ); ValuePlugPtr frameRangePlug = new ValuePlug( "frameRange", Plug::In ); IntPlugPtr frameStartPlug = new IntPlug( "start", Plug::In, 1 ); IntPlugPtr frameEndPlug = new IntPlug( "end", Plug::In, 100 ); frameRangePlug->addChild( frameStartPlug ); frameRangePlug->addChild( frameEndPlug ); addChild( frameRangePlug ); addChild( new FloatPlug( "framesPerSecond", Plug::In, 24.0f, 0.0f ) ); addChild( new CompoundDataPlug( "variables" ) ); m_context->set( "script:name", std::string( "" ) ); m_selection->memberAcceptanceSignal().connect( boost::bind( &ScriptNode::selectionSetAcceptor, this, ::_1, ::_2 ) ); plugSetSignal().connect( boost::bind( &ScriptNode::plugSet, this, ::_1 ) ); }
Gnomon( SceneView *view ) : m_view( view ), m_gadget( new GnomonGadget() ) { ValuePlugPtr plug = new ValuePlug( "gnomon" ); view->addChild( plug ); plug->addChild( new BoolPlug( "visible", Plug::In, true ) ); GadgetPtr xyPlane = new GnomonPlane(); GadgetPtr yzPlane = new GnomonPlane(); GadgetPtr xzPlane = new GnomonPlane(); yzPlane->setTransform( M44f().rotate( V3f( 0, -M_PI / 2.0f, 0 ) ) ); xzPlane->setTransform( M44f().rotate( V3f( M_PI / 2.0f, 0, 0 ) ) ); m_gadget->setChild( "xy", xyPlane ); m_gadget->setChild( "yz", yzPlane ); m_gadget->setChild( "xz", xzPlane ); xyPlane->buttonPressSignal().connect( boost::bind( &Gnomon::buttonPress, this, ::_1, ::_2 ) ); yzPlane->buttonPressSignal().connect( boost::bind( &Gnomon::buttonPress, this, ::_1, ::_2 ) ); xzPlane->buttonPressSignal().connect( boost::bind( &Gnomon::buttonPress, this, ::_1, ::_2 ) ); view->viewportGadget()->setChild( "__gnomon", m_gadget ); view->plugDirtiedSignal().connect( boost::bind( &Gnomon::plugDirtied, this, ::_1 ) ); update(); }
Grid( SceneView *view ) : m_view( view ), m_node( new GafferScene::Grid ), m_gadget( new SceneGadget ) { m_node->transformPlug()->rotatePlug()->setValue( V3f( 90, 0, 0 ) ); ValuePlugPtr plug = new ValuePlug( "grid" ); view->addChild( plug ); plug->addChild( new BoolPlug( "visible", Plug::In, true ) ); PlugPtr dimensionsPlug( m_node->dimensionsPlug()->createCounterpart( m_node->dimensionsPlug()->getName(), Plug::In ) ); plug->addChild( dimensionsPlug ); m_node->dimensionsPlug()->setInput( dimensionsPlug ); m_gadget->setMinimumExpansionDepth( 1 ); m_gadget->setScene( m_node->outPlug() ); view->viewportGadget()->setChild( "__grid", m_gadget ); view->plugDirtiedSignal().connect( boost::bind( &Grid::plugDirtied, this, ::_1 ) ); update(); }
LookThrough( SceneView *view ) : m_view( view ), m_framed( false ), m_standardOptions( new StandardOptions ), m_originalCamera( m_view->viewportGadget()->getCamera() ), m_lookThroughCameraDirty( true ), m_lookThroughCamera( NULL ), m_viewportCameraDirty( true ), m_overlay( new CameraOverlay ) { // Set up our plugs ValuePlugPtr lookThrough = new ValuePlug( "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 ) ); view->addChild( lookThrough ); // Set up our nodes. We use a standard options node to disable camera motion blur // and overscan because we don't want them applied to the cameras we retrieve with SceneAlgo. // We also must disable transform blur and deformation blur, because if either of those is // on, the shutter range becomes non-zero and the SceneAlgo transform() method will evaluate the // camera at the shutter start rather than the current time, even though its only evaluating a // single time sample. m_standardOptions->inPlug()->setInput( view->inPlug<ScenePlug>() ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "cameraBlur" )->enabledPlug()->setValue( true ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "cameraBlur" )->valuePlug<BoolPlug>()->setValue( false ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "transformBlur" )->enabledPlug()->setValue( true ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "transformBlur" )->valuePlug<BoolPlug>()->setValue( false ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "deformationBlur" )->enabledPlug()->setValue( true ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "deformationBlur" )->valuePlug<BoolPlug>()->setValue( false ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "overscan" )->enabledPlug()->setValue( true ); m_standardOptions->optionsPlug()->getChild<CompoundDataPlug::MemberPlug>( "overscan" )->valuePlug<BoolPlug>()->setValue( false ); // Set up our gadgets view->viewportGadget()->setChild( "__cameraOverlay", m_overlay ); m_overlay->setVisible( false ); // Connect to the signals we need m_standardOptions->plugDirtiedSignal().connect( boost::bind( &LookThrough::plugDirtied, this, ::_1 ) ); view->plugDirtiedSignal().connect( boost::bind( &LookThrough::plugDirtied, this, ::_1 ) ); view->viewportGadget()->preRenderSignal().connect( boost::bind( &LookThrough::preRender, this ) ); view->viewportGadget()->viewportChangedSignal().connect( boost::bind( &LookThrough::viewportChanged, this ) ); connectToViewContext(); view->contextChangedSignal().connect( boost::bind( &LookThrough::connectToViewContext, this ) ); }
ImageReader::ImageReader( const std::string &name ) : ImageNode( name ) { storeIndexOfNextChild( g_firstChildIndex ); addChild( new StringPlug( "fileName", Plug::In, "", /* flags */ Plug::Default, /* substitutions */ Context::AllSubstitutions & ~Context::FrameSubstitutions ) ); addChild( new IntPlug( "refreshCount" ) ); addChild( new IntPlug( "missingFrameMode", Plug::In, Error, /* min */ Error, /* max */ Hold ) ); ValuePlugPtr startPlug = new ValuePlug( "start", Plug::In ); startPlug->addChild( new IntPlug( "mode", Plug::In, None, /* min */ None, /* max */ ClampToFrame ) ); startPlug->addChild( new IntPlug( "frame", Plug::In, 0 ) ); addChild( startPlug ); ValuePlugPtr endPlug = new ValuePlug( "end", Plug::In ); endPlug->addChild( new IntPlug( "mode", Plug::In, None, /* min */ None, /* max */ ClampToFrame ) ); endPlug->addChild( new IntPlug( "frame", Plug::In, 0 ) ); addChild( endPlug ); addChild( new CompoundObjectPlug( "__intermediateMetadata", Plug::In, new CompoundObject, Plug::Default & ~Plug::Serialisable ) ); addChild( new StringPlug( "__intermediateColorSpace", Plug::Out, "", Plug::Default & ~Plug::Serialisable ) ); addChild( new ImagePlug( "__intermediateImage", Plug::In, Plug::Default & ~Plug::Serialisable ) ); // We don't really do much work ourselves - we just // defer to internal nodes to do the hard work. OpenImageIOReaderPtr oiioReader = new OpenImageIOReader( "__oiioReader" ); addChild( oiioReader ); oiioReader->fileNamePlug()->setInput( fileNamePlug() ); oiioReader->refreshCountPlug()->setInput( refreshCountPlug() ); oiioReader->missingFrameModePlug()->setInput( missingFrameModePlug() ); intermediateMetadataPlug()->setInput( oiioReader->outPlug()->metadataPlug() ); ColorSpacePtr colorSpace = new ColorSpace( "__colorSpace" ); addChild( colorSpace ); colorSpace->inPlug()->setInput( oiioReader->outPlug() ); colorSpace->inputSpacePlug()->setInput( intermediateColorSpacePlug() ); colorSpace->outputSpacePlug()->setValue( OpenColorIO::ROLE_SCENE_LINEAR ); intermediateImagePlug()->setInput( colorSpace->outPlug() ); }