本文整理汇总了C++中PlugPtr::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ PlugPtr::addChild方法的具体用法?C++ PlugPtr::addChild怎么用?C++ PlugPtr::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlugPtr
的用法示例。
在下文中一共展示了PlugPtr::addChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCounterpart
PlugPtr ValuePlug::createCounterpart( const std::string &name, Direction direction ) const
{
PlugPtr result = new ValuePlug( name, direction, getFlags() );
for( PlugIterator it( this ); !it.done(); ++it )
{
result->addChild( (*it)->createCounterpart( (*it)->getName(), direction ) );
}
return result;
}
示例2: MemberPlug
PlugPtr CompoundDataPlug::MemberPlug::createCounterpart( const std::string &name, Direction direction ) const
{
PlugPtr result = new MemberPlug( name, direction, getFlags() );
for( PlugIterator it( this ); it != it.end(); it++ )
{
result->addChild( (*it)->createCounterpart( (*it)->getName(), direction ) );
}
return result;
}
示例3: Plug
ColorInspector( ImageView *view )
: m_view( view ),
m_sampler( new ImageSampler )
{
PlugPtr plug = new Plug( "colorInspector" );
view->addChild( plug );
plug->addChild( new V2iPlug( "pixel" ) );
plug->addChild( new Color4fPlug( "color" ) );
// We want to sample the image before the display transforms
// are applied. We can't simply get this image from inPlug()
// because derived classes may have called insertConverter(),
// so we take it from the input to the display transform chain.
ImagePlug *image = view->getPreprocessor<Node>()->getChild<Clamp>( "__clamp" )->inPlug();
m_sampler->imagePlug()->setInput( image );
plug->getChild<Color4fPlug>( "color" )->setInput( m_sampler->colorPlug() );
m_view->viewportGadget()->mouseMoveSignal().connect( boost::bind( &ColorInspector::mouseMove, this, ::_2 ) );
m_view->viewportGadget()->getPrimaryChild()->buttonPressSignal().connect( boost::bind( &ColorInspector::buttonPress, this, ::_2 ) );
m_view->viewportGadget()->getPrimaryChild()->dragBeginSignal().connect( boost::bind( &ColorInspector::dragBegin, this, ::_2 ) );
m_view->viewportGadget()->getPrimaryChild()->dragEndSignal().connect( boost::bind( &ColorInspector::dragEnd, this, ::_2 ) );
}
示例4: loadShader
void OSLShader::loadShader( const std::string &shaderName, bool keepExistingValues )
{
Plug *existingOut = outPlug();
if( shaderName.empty() )
{
parametersPlug()->clearChildren();
namePlug()->setValue( "" );
typePlug()->setValue( "" );
if( existingOut )
{
existingOut->clearChildren();
}
return;
}
const char *searchPath = getenv( "OSL_SHADER_PATHS" );
OSLQuery query;
if( !query.open( shaderName, searchPath ? searchPath : "" ) )
{
throw Exception( query.geterror() );
}
const bool outPlugHadChildren = existingOut ? existingOut->children().size() : false;
if( !keepExistingValues )
{
// If we're not preserving existing values then remove all existing
// parameter plugs - the various plug creators above know that if a
// plug exists then they should preserve its values.
parametersPlug()->clearChildren();
if( existingOut )
{
existingOut->clearChildren();
}
}
m_metadata = NULL;
namePlug()->setValue( shaderName );
typePlug()->setValue( std::string( "osl:" ) + query.shadertype().c_str() );
const IECore::CompoundData *metadata = OSLShader::metadata();
const IECore::CompoundData *parameterMetadata = NULL;
if( metadata )
{
parameterMetadata = metadata->member<IECore::CompoundData>( "parameter" );
}
loadShaderParameters( query, parametersPlug(), parameterMetadata );
if( !existingOut || existingOut->typeId() != Plug::staticTypeId() )
{
PlugPtr outPlug = new Plug( "out", Plug::Out, Plug::Default | Plug::Dynamic );
if( existingOut )
{
// We had an out plug but it was the wrong type (we used
// to use a CompoundPlug before that was deprecated). Move
// over any existing child plugs onto our replacement.
for( PlugIterator it( existingOut ); !it.done(); ++it )
{
outPlug->addChild( *it );
}
}
setChild( "out", outPlug );
}
if( query.shadertype() == "shader" )
{
loadShaderParameters( query, outPlug(), parameterMetadata );
}
else
{
outPlug()->clearChildren();
}
if( static_cast<bool>( outPlug()->children().size() ) != outPlugHadChildren )
{
// OSLShaderUI registers a dynamic metadata entry which depends on whether or
// not the plug has children, so we must notify the world that the value will
// have changed.
Metadata::plugValueChangedSignal()( staticTypeId(), "out", "nodule:type", outPlug() );
}
}