本文整理汇总了C++中NameList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ NameList::begin方法的具体用法?C++ NameList::begin怎么用?C++ NameList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameList
的用法示例。
在下文中一共展示了NameList::begin方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attributeNames
void LiveScene::attributeNames( NameList &attrs ) const
{
if( !m_isRoot && m_dagPath.length() == 0 )
{
throw Exception( "IECoreMaya::LiveScene::attributeNames: Dag path no longer exists!" );
}
tbb::mutex::scoped_lock l( s_mutex );
attrs.clear();
attrs.push_back( SceneInterface::visibilityName );
// translate attributes with names starting with "ieAttr_":
MFnDependencyNode fnNode( m_dagPath.node() );
unsigned int n = fnNode.attributeCount();
for( unsigned int i=0; i<n; i++ )
{
MObject attr = fnNode.attribute( i );
MFnAttribute fnAttr( attr );
MString attrName = fnAttr.name();
if( attrName.length() > 7 && ( strstr( attrName.asChar(),"ieAttr_" ) == attrName.asChar() ) )
{
attrs.push_back( ( "user:" + attrName.substring( 7, attrName.length()-1 ) ).asChar() );
}
}
// add attributes from custom readers:
for ( std::vector< CustomAttributeReader >::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); it++ )
{
it->m_names( m_dagPath, attrs );
}
// remove duplicates:
std::sort( attrs.begin(), attrs.end() );
attrs.erase( std::unique( attrs.begin(), attrs.end() ), attrs.end() );
}
示例2: readTags
void MayaScene::readTags( NameList &tags, int filter ) const
{
tags.clear();
if ( m_isRoot )
{
return;
}
if( m_dagPath.length() == 0 )
{
throw Exception( "MayaScene::attributeNames: Dag path no longer exists!" );
}
std::set<Name> uniqueTags;
std::vector<CustomTagReader> &tagReaders = customTagReaders();
for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it )
{
NameList values;
it->m_read( m_dagPath, values, filter );
uniqueTags.insert( values.begin(), values.end() );
}
tags.insert( tags.end(), uniqueTags.begin(), uniqueTags.end() );
}
示例3: context
Imath::Box3d HoudiniScene::readBound( double time ) const
{
OP_Node *node = retrieveNode( true );
Imath::Box3d bounds;
UT_BoundingBox box;
OP_Context context( time );
/// \todo: this doesn't account for SOPs containing multiple shapes
/// if we fix it, we need to fix the condition below as well
if ( node->getBoundingBox( box, context ) )
{
bounds = IECore::convert<Imath::Box3d>( box );
}
// paths embedded within a sop already have bounds accounted for
if ( m_contentIndex )
{
return bounds;
}
NameList children;
childNames( children );
for ( NameList::iterator it=children.begin(); it != children.end(); ++it )
{
ConstSceneInterfacePtr childScene = child( *it );
Imath::Box3d childBound = childScene->readBound( time );
if ( !childBound.isEmpty() )
{
bounds.extendBy( Imath::transform( childBound, childScene->readTransformAsMatrix( time ) ) );
}
}
return bounds;
}
示例4: hasAttribute
bool LiveScene::hasAttribute( const Name &name ) const
{
if ( !m_isRoot && m_dagPath.length() == 0 )
{
throw Exception( "IECoreMaya::LiveScene::hasAttribute: Dag path no longer exists!" );
}
if( name == SceneInterface::visibilityName )
{
return true;
}
std::vector< CustomAttributeReader > &attributeReaders = customAttributeReaders();
for ( std::vector< CustomAttributeReader >::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
{
NameList names;
{
// call it->m_names under a mutex, as it could be reading plug values,
// which isn't thread safe:
tbb::mutex::scoped_lock l( s_mutex );
it->m_names( m_dagPath, names );
}
if ( std::find(names.begin(), names.end(), name) != names.end() )
{
return true;
}
}
return false;
}
示例5: readTags
void LinkedScene::readTags( NameList &tags, int filter ) const
{
if ( filter!=SceneInterface::LocalTag && !m_readOnly )
{
throw Exception( "readTags with filter != LocalTag is only supported when reading the scene file!" );
}
if ( m_linkedScene )
{
m_linkedScene->readTags( tags, filter );
/// Only queries ancestor tags and local tags (if at the link location) from the main scene.
int mainFilter = filter & ( SceneInterface::AncestorTag | ( m_atLink ? SceneInterface::LocalTag : 0 ) );
if ( !m_atLink && (filter & SceneInterface::AncestorTag) )
{
/// child locations inside the link consider all the local tags at the link location as ancestor tags as well.
mainFilter |= SceneInterface::LocalTag;
}
if ( mainFilter )
{
NameList mainTags;
m_mainScene->readTags( mainTags, mainFilter );
tags.insert( tags.end(), mainTags.begin(), mainTags.end() );
}
}
else
{
m_mainScene->readTags( tags, filter );
}
}
示例6: loadConfiguredPlugins
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int PluginRegistry::loadConfiguredPlugins(const Config::Config *config) {
try { _pluginNames = config->getStrings("core.plugins"); }
catch ( ... ) {}
try {
NameList appPlugins = config->getStrings("plugins");
_pluginNames.insert(_pluginNames.end(), appPlugins.begin(), appPlugins.end());
}
catch ( ... ) {}
return loadPlugins();
}
示例7: attributeNames
void LiveScene::attributeNames( NameList &attrs ) const
{
attrs.clear();
OP_Node *node = retrieveNode();
const std::vector<CustomAttributeReader> &attributeReaders = customAttributeReaders();
for ( std::vector<CustomAttributeReader>::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
{
NameList names;
it->m_names( node, names );
/// \todo: investigate using a set here if performance becomes an issue
for ( NameList::const_iterator nIt = names.begin(); nIt != names.end(); ++nIt )
{
if ( std::find( attrs.begin(), attrs.end(), *nIt ) == attrs.end() )
{
attrs.push_back( *nIt );
}
}
}
}
示例8: hasAttribute
bool LiveScene::hasAttribute( const Name &name ) const
{
OP_Node *node = retrieveNode();
const std::vector<CustomAttributeReader> &attributeReaders = customAttributeReaders();
for ( std::vector<CustomAttributeReader>::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
{
NameList names;
it->m_names( node, names );
if ( std::find( names.begin(), names.end(), name ) != names.end() )
{
return true;
}
}
return false;
}
示例9: readTags
void LiveScene::readTags( NameList &tags, int filter ) const
{
tags.clear();
if ( m_isRoot )
{
return;
}
if( m_dagPath.length() == 0 )
{
throw Exception( "IECoreMaya::LiveScene::attributeNames: Dag path no longer exists!" );
}
std::set<Name> uniqueTags;
// read tags from ieTags attribute:
MStatus st;
MFnDependencyNode fnNode( m_dagPath.node() );
MPlug tagsPlug = fnNode.findPlug( "ieTags", false, &st );
if( st )
{
std::string tagsStr( tagsPlug.asString().asChar() );
boost::tokenizer<boost::char_separator<char> > t( tagsStr, boost::char_separator<char>( " " ) );
for (
boost::tokenizer<boost::char_separator<char> >::iterator it = t.begin();
it != t.end();
++it
)
{
uniqueTags.insert( Name( *it ) );
}
}
// read tags from custom readers:
std::vector<CustomTagReader> &tagReaders = customTagReaders();
for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it )
{
NameList values;
it->m_read( m_dagPath, values, filter );
uniqueTags.insert( values.begin(), values.end() );
}
tags.insert( tags.end(), uniqueTags.begin(), uniqueTags.end() );
}
示例10: attributeNames
void LinkedScene::attributeNames( NameList &attrs ) const
{
if ( m_linkedScene && !m_atLink )
{
m_linkedScene->attributeNames(attrs);
}
else
{
m_mainScene->attributeNames(attrs);
for ( NameList::iterator it = attrs.begin(); it != attrs.end(); it++ )
{
// \todo: remove "*it == linkAttribute" when it's no longer relevant
if ( *it == linkAttribute || *it == fileNameLinkAttribute || *it == rootLinkAttribute || *it == timeLinkAttribute )
{
attrs.erase( it );
--it;
}
}
}
}
示例11: hasAttribute
bool MayaScene::hasAttribute( const Name &name ) const
{
if ( m_isRoot )
{
return false;
}
if( m_dagPath.length() == 0 )
{
throw Exception( "MayaScene::hasAttribute: Dag path no longer exists!" );
}
std::vector< CustomAttributeReader > &attributeReaders = customAttributeReaders();
for ( std::vector< CustomAttributeReader >::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
{
NameList names;
it->m_names( m_dagPath, names );
if ( std::find(names.begin(), names.end(), name) != names.end() )
{
return true;
}
}
return false;
}
示例12: childNames
void HoudiniScene::childNames( NameList &childNames ) const
{
OP_Node *node = retrieveNode();
OBJ_Node *objNode = node->castToOBJNode();
OBJ_Node *contentNode = retrieveNode( true )->castToOBJNode();
// add subnet children
if ( node->isManager() || ( objNode && objNode->getObjectType() == OBJ_SUBNET ) )
{
for ( int i=0; i < node->getNchildren(); ++i )
{
OP_Node *child = node->getChild( i );
// ignore children that have incoming connections, as those are actually grandchildren
// also ignore the contentNode, which is actually an extension of ourself
if ( child != contentNode && !hasInput( child ) )
{
childNames.push_back( Name( child->getName() ) );
}
}
}
if ( !contentNode )
{
return;
}
// add connected outputs
for ( unsigned i=0; i < contentNode->nOutputs(); ++i )
{
childNames.push_back( Name( contentNode->getOutput( i )->getName() ) );
}
// add child shapes within the geometry
if ( contentNode->getObjectType() == OBJ_GEOMETRY )
{
OP_Context context( getDefaultTime() );
const GU_Detail *geo = contentNode->getRenderGeometry( context, false );
GA_ROAttributeRef nameAttrRef = geo->findStringTuple( GA_ATTRIB_PRIMITIVE, "name" );
if ( !nameAttrRef.isValid() )
{
return;
}
const GA_Attribute *nameAttr = nameAttrRef.getAttribute();
const GA_AIFSharedStringTuple *tuple = nameAttr->getAIFSharedStringTuple();
GA_Size numShapes = tuple->getTableEntries( nameAttr );
for ( GA_Size i=0; i < numShapes; ++i )
{
const char *currentName = tuple->getTableString( nameAttr, tuple->validateTableHandle( nameAttr, i ) );
const char *match = matchPath( currentName );
if ( match && *match != *emptyString )
{
std::pair<const char *, size_t> childMarker = nextWord( match );
std::string child( childMarker.first, childMarker.second );
if ( std::find( childNames.begin(), childNames.end(), child ) == childNames.end() )
{
childNames.push_back( child );
}
}
}
}
}
示例13: readTags
void HoudiniScene::readTags( NameList &tags, bool includeChildren ) const
{
tags.clear();
const OP_Node *node = retrieveNode();
if ( !node )
{
return;
}
// add user supplied tags if we're not inside a SOP
if ( !m_contentIndex && node->hasParm( pTags.getToken() ) )
{
UT_String parmTagStr;
node->evalString( parmTagStr, pTags.getToken(), 0, 0 );
if ( !parmTagStr.equal( UT_String::getEmptyString() ) )
{
UT_WorkArgs tokens;
parmTagStr.tokenize( tokens, " " );
for ( int i = 0; i < tokens.getArgc(); ++i )
{
tags.push_back( tokens[i] );
}
}
}
// add tags from the registered tag readers
std::vector<CustomTagReader> &tagReaders = customTagReaders();
for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it )
{
NameList values;
it->m_read( node, values, includeChildren );
tags.insert( tags.end(), values.begin(), values.end() );
}
// add tags based on primitive groups
OBJ_Node *contentNode = retrieveNode( true )->castToOBJNode();
if ( contentNode && contentNode->getObjectType() == OBJ_GEOMETRY && m_splitter )
{
GU_DetailHandle newHandle = m_splitter->split( contentPathValue() );
if ( !newHandle.isNull() )
{
GU_DetailHandleAutoReadLock readHandle( newHandle );
if ( const GU_Detail *geo = readHandle.getGdp() )
{
GA_Range prims = geo->getPrimitiveRange();
for ( GA_GroupTable::iterator<GA_ElementGroup> it=geo->primitiveGroups().beginTraverse(); !it.atEnd(); ++it )
{
GA_PrimitiveGroup *group = static_cast<GA_PrimitiveGroup*>( it.group() );
if ( group->getInternal() || group->isEmpty() )
{
continue;
}
const UT_String &groupName = group->getName();
if ( groupName.startsWith( tagGroupPrefix ) && group->containsAny( prims ) )
{
UT_String tag;
groupName.substr( tag, tagGroupPrefix.length() );
tag.substitute( "_", ":" );
tags.push_back( tag.buffer() );
}
}
}
}
}
}