本文整理汇总了C++中PlugPtr::createCounterpart方法的典型用法代码示例。如果您正苦于以下问题:C++ PlugPtr::createCounterpart方法的具体用法?C++ PlugPtr::createCounterpart怎么用?C++ PlugPtr::createCounterpart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlugPtr
的用法示例。
在下文中一共展示了PlugPtr::createCounterpart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertConverter
void ImageView::insertConverter( Gaffer::NodePtr converter )
{
PlugPtr converterInput = converter->getChild<Plug>( "in" );
if( !converterInput )
{
throw IECore::Exception( "Converter has no Plug named \"in\"" );
}
ImagePlugPtr converterOutput = converter->getChild<ImagePlug>( "out" );
if( !converterOutput )
{
throw IECore::Exception( "Converter has no ImagePlug named \"out\"" );
}
PlugPtr newInput = converterInput->createCounterpart( "in", Plug::In );
setChild( "in", newInput );
NodePtr preprocessor = getPreprocessor<Node>();
Plug::OutputContainer outputsToRestore = preprocessor->getChild<ImagePlug>( "in" )->outputs();
PlugPtr newPreprocessorInput = converterInput->createCounterpart( "in", Plug::In );
preprocessor->setChild( "in", newPreprocessorInput );
newPreprocessorInput->setInput( newInput );
preprocessor->setChild( "__converter", converter );
converterInput->setInput( newPreprocessorInput );
for( Plug::OutputContainer::const_iterator it = outputsToRestore.begin(), eIt = outputsToRestore.end(); it != eIt; ++it )
{
(*it)->setInput( converterOutput );
}
}
示例2: Exception
ArrayPlug::ArrayPlug( const std::string &name, Direction direction, PlugPtr element, size_t minSize, size_t maxSize, unsigned flags )
: Plug( name, direction, flags ), m_minSize( std::max( minSize, size_t( 1 ) ) ), m_maxSize( std::max( maxSize, m_minSize ) )
{
if( direction == Plug::Out )
{
throw IECore::Exception( "Output ArrayPlugs are currently unsupported." );
}
if( element )
{
// If we're dynamic ourselves, then serialisations will include a constructor
// for us, but it will have element==None. In this case we make sure the first
// element is dynamic, so that it too will have a constructor written out. But
// if we're not dynamic, we expect to be passed the element again upon reconstruction,
// so we don't need a constructor to be serialised for the element, and therefore
// we must set it to be non-dynamic.
element->setFlags( Gaffer::Plug::Dynamic, getFlags( Gaffer::Plug::Dynamic ) );
addChild( element );
for( size_t i = 1; i < m_minSize; ++i )
{
PlugPtr p = element->createCounterpart( element->getName(), Plug::In );
addChild( p );
}
}
parentChangedSignal().connect( boost::bind( &ArrayPlug::parentChanged, this ) );
}