本文整理汇总了C++中sceneinterface::NameList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ NameList::clear方法的具体用法?C++ NameList::clear怎么用?C++ NameList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sceneinterface::NameList
的用法示例。
在下文中一共展示了NameList::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeChildNames
IECore::ConstInternedStringVectorDataPtr SceneReader::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstSceneInterfacePtr s = scene( path );
if( !s )
{
return parent->childNamesPlug()->defaultValue();
}
// get the child names
InternedStringVectorDataPtr resultData = new InternedStringVectorData;
vector<InternedString> &result = resultData->writable();
s->childNames( result );
// filter out any which don't have the right tags
std::string tagsString = tagsPlug()->getValue();
if( !tagsString.empty() )
{
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
Tokenizer tagsTokenizer( tagsString, boost::char_separator<char>( " " ) );
vector<InternedString> tags;
std::copy( tagsTokenizer.begin(), tagsTokenizer.end(), back_inserter( tags ) );
vector<InternedString>::iterator newResultEnd = result.begin();
SceneInterface::NameList childTags;
for( vector<InternedString>::const_iterator cIt = result.begin(), cEIt = result.end(); cIt != cEIt; ++cIt )
{
ConstSceneInterfacePtr child = s->child( *cIt );
childTags.clear();
child->readTags( childTags, IECore::SceneInterface::EveryTag );
bool childMatches = false;
for( SceneInterface::NameList::const_iterator tIt = childTags.begin(), tEIt = childTags.end(); tIt != tEIt; ++tIt )
{
if( find( tags.begin(), tags.end(), *tIt ) != tags.end() )
{
childMatches = true;
break;
}
}
if( childMatches )
{
*newResultEnd++ = *cIt;
}
}
result.erase( newResultEnd, result.end() );
}
return resultData;
}
示例2: computeAttributes
IECore::ConstCompoundObjectPtr SceneReader::computeAttributes( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
std::string fileName = fileNamePlug()->getValue();
if( !fileName.size() )
{
return parent->attributesPlug()->defaultValue();
}
ConstSceneInterfacePtr s = SharedSceneInterfaces::get( fileName );
s = s->scene( path );
// read attributes
SceneInterface::NameList nameList;
s->attributeNames( nameList );
CompoundObjectPtr result = new CompoundObject;
for( SceneInterface::NameList::iterator it = nameList.begin(); it != nameList.end(); ++it )
{
// these internal attributes should be ignored:
if( *it == SceneCache::animatedObjectTopologyAttribute )
{
continue;
}
if( *it == SceneCache::animatedObjectPrimVarsAttribute )
{
continue;
}
// the const cast is ok, because we're only using it to put the object into a CompoundObject that will
// be treated as forever const after being returned from this function.
result->members()[ std::string( *it ) ] = constPointerCast<Object>( s->readAttribute( *it, context->getFrame() / g_frameRate ) );
}
// read tags and turn them into attributes of the form "user:tag:tagName"
nameList.clear();
s->readTags( nameList, IECore::SceneInterface::LocalTag );
for( SceneInterface::NameList::const_iterator it = nameList.begin(); it != nameList.end(); ++it )
{
if( it->string().compare( 0, 11, "ObjectType:" ) == 0 )
{
continue;
}
result->members()["user:tag:"+it->string()] = g_trueBoolData;
}
return result;
}