本文整理汇总了C++中Plug::getInput方法的典型用法代码示例。如果您正苦于以下问题:C++ Plug::getInput方法的具体用法?C++ Plug::getInput怎么用?C++ Plug::getInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plug
的用法示例。
在下文中一共展示了Plug::getInput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insert
void BoxIO::insert( Box *box )
{
// Must take a copy of children because adding a child
// would invalidate our PlugIterator.
GraphComponent::ChildContainer children = box->children();
for( PlugIterator it( children ); !it.done(); ++it )
{
Plug *plug = it->get();
if( plug->direction() == Plug::In )
{
std::vector<Plug *> outputsNeedingBoxIn;
const Plug::OutputContainer &outputs = plug->outputs();
for( Plug::OutputContainer::const_iterator oIt = outputs.begin(), oeIt = outputs.end(); oIt != oeIt; ++oIt )
{
if( hasNodule( *oIt ) && !runTimeCast<BoxIO>( (*oIt)->node() ) )
{
outputsNeedingBoxIn.push_back( *oIt );
}
}
if( outputsNeedingBoxIn.empty() )
{
continue;
}
BoxInPtr boxIn = new BoxIn;
boxIn->namePlug()->setValue( plug->getName() );
boxIn->setup( plug );
box->addChild( boxIn );
boxIn->inPlugInternal()->setInput( plug );
for( std::vector<Plug *>::const_iterator oIt = outputsNeedingBoxIn.begin(), oeIt = outputsNeedingBoxIn.end(); oIt != oeIt; ++oIt )
{
(*oIt)->setInput( boxIn->plug() );
}
}
else
{
// Output plug
Plug *input = plug->getInput();
if( !input || !hasNodule( input ) || runTimeCast<BoxIO>( input->node() ) )
{
continue;
}
BoxOutPtr boxOut = new BoxOut;
boxOut->namePlug()->setValue( plug->getName() );
boxOut->setup( plug );
box->addChild( boxOut );
boxOut->plug()->setInput( input );
plug->setInput( boxOut->outPlugInternal() );
}
}
}
示例2: deleteNodes
void ScriptNode::deleteNodes( Node *parent, const Set *filter, bool reconnect )
{
parent = parent ? parent : this;
// because children are stored as a vector, it's
// much more efficient to delete those at the end before
// those at the beginning.
int i = (int)(parent->children().size()) - 1;
while( i >= 0 )
{
Node *node = parent->getChild<Node>( i );
if( node && ( !filter || filter->contains( node ) ) )
{
// reconnect the inputs and outputs as though the node was disabled
DependencyNode *dependencyNode = IECore::runTimeCast<DependencyNode>( node );
if( reconnect && dependencyNode )
{
for( RecursiveOutputPlugIterator it( node ); !it.done(); ++it )
{
Plug *inPlug = nullptr;
try
{
inPlug = dependencyNode->correspondingInput( it->get() );
}
catch( const std::exception &e )
{
msg(
IECore::Msg::Warning,
boost::str( boost::format( "correspondingInput error while deleting - cannot reconnect \"%s\"" ) % it->get()->fullName() ),
e.what()
);
}
if ( !inPlug )
{
continue;
}
Plug *srcPlug = inPlug->getInput();
if ( !srcPlug )
{
continue;
}
// record this plug's current outputs, and reconnect them. This is a copy of (*it)->outputs() rather
// than a reference, as reconnection can modify (*it)->outputs()...
Plug::OutputContainer outputs = (*it)->outputs();
for ( Plug::OutputContainer::const_iterator oIt = outputs.begin(); oIt != outputs.end(); ++oIt )
{
Plug *dstPlug = *oIt;
if ( dstPlug && dstPlug->acceptsInput( srcPlug ) && this->isAncestorOf( dstPlug ) )
{
dstPlug->setInput( srcPlug );
}
}
}
}
parent->removeChild( node );
}
i--;
}
}