本文整理汇总了C++中ConstInternedStringVectorDataPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConstInternedStringVectorDataPtr类的具体用法?C++ ConstInternedStringVectorDataPtr怎么用?C++ ConstInternedStringVectorDataPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstInternedStringVectorDataPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inPlug
IECore::ConstInternedStringVectorDataPtr DeleteSets::computeSetNames( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstInternedStringVectorDataPtr inputSetNamesData = inPlug()->setNamesPlug()->getValue();
const std::vector<InternedString> &inputSetNames = inputSetNamesData->readable();
if( inputSetNames.empty() )
{
return inputSetNamesData;
}
InternedStringVectorDataPtr outputSetNamesData = new InternedStringVectorData;
std::vector<InternedString> &outputSetNames = outputSetNamesData->writable();
const std::string names = namesPlug()->getValue();
const bool invert = invertNamesPlug()->getValue();
for( std::vector<InternedString>::const_iterator it = inputSetNames.begin(); it != inputSetNames.end(); ++it )
{
if( StringAlgo::matchMultiple( *it, names ) != (!invert) )
{
outputSetNames.push_back( *it );
}
}
return outputSetNamesData;
}
示例2: sceneScope
void Prune::hashChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const
{
FilterPlug::SceneScope sceneScope( context, inPlug() );
const Filter::Result m = (Filter::Result)filterPlug()->getValue();
if( m & Filter::ExactMatch )
{
h = inPlug()->childNamesPlug()->defaultValue()->Object::hash();
}
else if( m & Filter::DescendantMatch )
{
// we might be computing new childnames for this level.
FilteredSceneProcessor::hashChildNames( path, context, parent, h );
ConstInternedStringVectorDataPtr inputChildNamesData = inPlug()->childNamesPlug()->getValue();
const vector<InternedString> &inputChildNames = inputChildNamesData->readable();
ScenePath childPath = path;
childPath.push_back( InternedString() ); // for the child name
for( vector<InternedString>::const_iterator it = inputChildNames.begin(), eIt = inputChildNames.end(); it != eIt; ++it )
{
childPath[path.size()] = *it;
sceneScope.set( ScenePlug::scenePathContextName, childPath );
filterPlug()->hash( h );
}
}
else
{
// pass through
h = inPlug()->childNamesPlug()->hash();
}
}
示例3: filterContext
IECore::ConstInternedStringVectorDataPtr Isolate::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
ContextPtr tmpContext = filterContext( context );
Context::Scope scopedContext( tmpContext.get() );
if( mayPruneChildren( path, filterPlug()->getValue() ) )
{
// we may need to delete one or more of our children
ConstInternedStringVectorDataPtr inputChildNamesData = inPlug()->childNamesPlug()->getValue();
const vector<InternedString> &inputChildNames = inputChildNamesData->readable();
InternedStringVectorDataPtr outputChildNamesData = new InternedStringVectorData;
vector<InternedString> &outputChildNames = outputChildNamesData->writable();
ScenePath childPath = path;
childPath.push_back( InternedString() ); // for the child name
for( vector<InternedString>::const_iterator it = inputChildNames.begin(), eIt = inputChildNames.end(); it != eIt; it++ )
{
childPath[path.size()] = *it;
tmpContext->set( ScenePlug::scenePathContextName, childPath );
if( filterPlug()->getValue() != Filter::NoMatch )
{
outputChildNames.push_back( *it );
}
}
return outputChildNamesData;
}
else
{
// pass through
return inPlug()->childNamesPlug()->getValue();
}
}
示例4: hashOfTransformedChildBounds
IECore::MurmurHash SceneNode::hashOfTransformedChildBounds( const ScenePath &path, const ScenePlug *out, const IECore::InternedStringVectorData *childNamesData ) const
{
ConstInternedStringVectorDataPtr computedChildNames;
if( !childNamesData )
{
computedChildNames = out->childNames( path );
childNamesData = computedChildNames.get();
}
const vector<InternedString> &childNames = childNamesData->readable();
IECore::MurmurHash result;
if( childNames.size() )
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
ScenePath childPath( path );
childPath.push_back( InternedString() ); // room for the child name
for( vector<InternedString>::const_iterator it = childNames.begin(); it != childNames.end(); it++ )
{
childPath[path.size()] = *it;
tmpContext->set( ScenePlug::scenePathContextName, childPath );
out->boundPlug()->hash( result );
out->transformPlug()->hash( result );
}
}
else
{
result.append( typeId() );
result.append( "emptyBound" );
}
return result;
}
示例5: inPlug
GafferScene::ConstPathMatcherDataPtr Duplicate::computeBranchSet( const ScenePath &parentPath, const IECore::InternedString &setName, const Gaffer::Context *context ) const
{
ConstPathMatcherDataPtr inputSetData = inPlug()->set( setName );
const PathMatcher &inputSet = inputSetData->readable();
if( inputSet.isEmpty() )
{
return outPlug()->setPlug()->defaultValue();
}
PathMatcher subTree = inputSet.subTree( targetPlug()->getValue() );
if( subTree.isEmpty() )
{
return outPlug()->setPlug()->defaultValue();
}
ConstInternedStringVectorDataPtr childNamesData = childNamesPlug()->getValue();
const vector<InternedString> &childNames = childNamesData->readable();
PathMatcherDataPtr resultData = new PathMatcherData;
PathMatcher &result = resultData->writable();
ScenePath prefix( 1 );
for( vector<InternedString>::const_iterator it = childNames.begin(), eIt = childNames.end(); it != eIt; ++it )
{
prefix.back() = *it;
result.addPaths( subTree, prefix );
}
return resultData;
}
示例6: scopedContext
Imath::Box3f SceneNode::unionOfTransformedChildBounds( const ScenePath &path, const ScenePlug *out, const IECore::InternedStringVectorData *childNamesData ) const
{
ConstInternedStringVectorDataPtr computedChildNames;
if( !childNamesData )
{
computedChildNames = out->childNames( path );
childNamesData = computedChildNames.get();
}
const vector<InternedString> &childNames = childNamesData->readable();
Box3f result;
if( childNames.size() )
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
ScenePath childPath( path );
childPath.push_back( InternedString() ); // room for the child name
for( vector<InternedString>::const_iterator it = childNames.begin(); it != childNames.end(); it++ )
{
childPath[path.size()] = *it;
tmpContext->set( ScenePlug::scenePathContextName, childPath );
Box3f childBound = out->boundPlug()->getValue();
childBound = transform( childBound, out->transformPlug()->getValue() );
result.extendBy( childBound );
}
}
return result;
}
示例7: Context
virtual task *execute()
{
ContextPtr context = new Context( *m_context );
context->set( ScenePlug::scenePathContextName, m_scenePath );
Context::Scope scopedContext( context );
m_scenePlug->transformPlug()->getValue();
m_scenePlug->boundPlug()->getValue();
m_scenePlug->attributesPlug()->getValue();
m_scenePlug->objectPlug()->getValue();
ConstInternedStringVectorDataPtr childNamesData = m_scenePlug->childNamesPlug()->getValue();
const vector<InternedString> &childNames = childNamesData->readable();
set_ref_count( 1 + childNames.size() );
ScenePlug::ScenePath childPath = m_scenePath;
childPath.push_back( InternedString() ); // space for the child name
for( vector<InternedString>::const_iterator it = childNames.begin(), eIt = childNames.end(); it != eIt; it++ )
{
childPath[m_scenePath.size()] = *it;
SceneTraversalTask *t = new( allocate_child() ) SceneTraversalTask( m_scenePlug, m_context, childPath );
spawn( *t );
}
wait_for_all();
return 0;
}
示例8: targetPlug
void Duplicate::compute( ValuePlug *output, const Context *context ) const
{
if( output == outParentPlug() )
{
ScenePath target;
ScenePlug::stringToPath( targetPlug()->getValue(), target );
string parent;
for( size_t i = 0; i < target.size(); ++i )
{
parent += "/";
if( i < target.size() - 1 )
{
parent += target[i];
}
}
static_cast<StringPlug *>( output )->setValue( parent );
return;
}
else if( output == childNamesPlug() )
{
// get the path to our target.
ScenePath target;
ScenePlug::stringToPath( targetPlug()->getValue(), target );
// throw if the target path doesn't exist in the input. we need to compute the input child names at the
// parent for this, but it's not necessary to represent that in the hash, because it doesn't actually
// affect our result (if we throw we will have no result).
ScenePath parent( target ); parent.pop_back();
ConstInternedStringVectorDataPtr parentChildNamesData = inPlug()->childNames( parent );
vector<InternedString> parentChildNames = parentChildNamesData->readable();
if( find( parentChildNames.begin(), parentChildNames.end(), target.back() ) == parentChildNames.end() )
{
throw Exception( boost::str( boost::format( "Target \"%s\" does not exist" ) % target.back().string() ) );
}
// go ahead and generate our childnames by incrementing a numeric suffix on
// the target name.
std::string stem;
int suffix = numericSuffix( target.back(), 0, &stem );
InternedStringVectorDataPtr childNames = new InternedStringVectorData;
boost::format formatter( "%s%d" );
int copies = copiesPlug()->getValue();
for( int i = 0; i < copies; ++i )
{
childNames->writable().push_back( boost::str( formatter % stem % ++suffix ) );
}
static_cast<InternedStringVectorDataPlug *>( output )->setValue( childNames );
return;
}
BranchCreator::compute( output, context );
}
示例9: transform
void SceneWriter::writeLocation( const GafferScene::ScenePlug *scene, const ScenePlug::ScenePath &scenePath, Context *context, IECore::SceneInterface *output, double time ) const
{
context->set( ScenePlug::scenePathContextName, scenePath );
ConstCompoundObjectPtr attributes = scene->attributesPlug()->getValue();
for( CompoundObject::ObjectMap::const_iterator it = attributes->members().begin(), eIt = attributes->members().end(); it != eIt; it++ )
{
output->writeAttribute( it->first, it->second.get(), time );
}
if( scenePath.empty() )
{
ConstCompoundObjectPtr globals = scene->globalsPlug()->getValue();
output->writeAttribute( "gaffer:globals", globals.get(), time );
}
ConstObjectPtr object = scene->objectPlug()->getValue();
if( object->typeId() != IECore::NullObjectTypeId && scenePath.size() > 0 )
{
output->writeObject( object.get(), time );
}
Imath::Box3f b = scene->boundPlug()->getValue();
output->writeBound( Imath::Box3d( Imath::V3f( b.min ), Imath::V3f( b.max ) ), time );
if( scenePath.size() )
{
Imath::M44f t = scene->transformPlug()->getValue();
Imath::M44d transform(
t[0][0], t[0][1], t[0][2], t[0][3],
t[1][0], t[1][1], t[1][2], t[1][3],
t[2][0], t[2][1], t[2][2], t[2][3],
t[3][0], t[3][1], t[3][2], t[3][3]
);
output->writeTransform( new IECore::M44dData( transform ), time );
}
ConstInternedStringVectorDataPtr childNames = scene->childNamesPlug()->getValue();
ScenePlug::ScenePath childScenePath = scenePath;
childScenePath.push_back( InternedString() );
for( vector<InternedString>::const_iterator it=childNames->readable().begin(); it!=childNames->readable().end(); it++ )
{
childScenePath[scenePath.size()] = *it;
SceneInterfacePtr outputChild = output->child( *it, SceneInterface::CreateIfMissing );
writeLocation( scene, childScenePath, context, outputChild.get(), time );
}
}
示例10: scopedContext
void ScenePath::doChildren( std::vector<PathPtr> &children ) const
{
Context::Scope scopedContext( m_context.get() );
ConstInternedStringVectorDataPtr childNamesData = m_scene->childNames( names() );
const std::vector<InternedString> &childNames = childNamesData->readable();
ScenePlug::ScenePath childPath( names() );
childPath.push_back( InternedString() ); // for the child name
children.reserve( childNames.size() );
for( std::vector<InternedString>::const_iterator it = childNames.begin(), eIt = childNames.end(); it != eIt; ++it )
{
childPath.back() = *it;
children.push_back( new ScenePath( m_scene, m_context, childPath, root(), const_cast<PathFilter *>( getFilter() ) ) );
}
}
示例11: setsPlug
void SetVisualiser::compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const
{
if( output == outSetsPlug() )
{
const StringAlgo::MatchPattern requestedSetsPattern = setsPlug()->getValue();
std::vector<InternedString> names;
std::vector<Color3f> colors;
if( !requestedSetsPattern.empty() )
{
const std::vector<Override> overrides = unpackOverrides( colorOverridesPlug() );
ConstInternedStringVectorDataPtr allSetNamesData = inPlug()->setNames();
// Sorting now makes everything easier, otherwise you have to
// sort parallel arrays later, which is a pain.
std::vector<InternedString> allNames = allSetNamesData->readable();
std::sort( allNames.begin(), allNames.end(), internedStringCompare );
for( auto &name : allNames )
{
// Gaffer has some internal sets that begin with the '__'
// prefix. These are usually Lights, Cameras, etc... We filter
// these out as they most of their objects don't even draw in
// the viewer in a meaningful way for visualising set Membership
if( boost::starts_with( name.string(), "__" ) )
{
continue;
}
if( StringAlgo::matchMultiple( name, requestedSetsPattern ) )
{
names.push_back( name );
colors.push_back( colorForSetName( name, overrides ) );
}
}
}
CompoundDataPtr data = new CompoundData();
data->writable()["names"] = new InternedStringVectorData( names );
data->writable()["colors"] = new Color3fVectorData( colors );
static_cast<AtomicCompoundDataPlug *>( output )->setValue( data );
}
else
{
SceneElementProcessor::compute( output, context );
}
}
示例12: expandWalk
bool SceneView::expandWalk( const std::string &path, size_t depth, PathMatcher &expanded, RenderableGadget::Selection &selected )
{
bool result = false;
ScenePlug::ScenePath scenePath;
ScenePlug::stringToPath( path, scenePath );
ConstInternedStringVectorDataPtr childNamesData = preprocessedInPlug<ScenePlug>()->childNames( scenePath );
const vector<InternedString> &childNames = childNamesData->readable();
if( childNames.size() )
{
// expand ourselves to show our children, and make sure we're
// not selected - we only want selection at the leaf levels of
// our expansion.
result |= expanded.addPath( path );
result |= selected.erase( path );
for( vector<InternedString>::const_iterator cIt = childNames.begin(), ceIt = childNames.end(); cIt != ceIt; cIt++ )
{
std::string childPath( path );
if( *childPath.rbegin() != '/' )
{
childPath += '/';
}
childPath += cIt->string();
if( depth == 1 )
{
// at the bottom of the expansion - just select the child
result |= selected.insert( childPath ).second;
}
else
{
// continue the expansion
result |= expandWalk( childPath, depth - 1, expanded, selected );
}
}
}
else
{
// we have no children, just make sure we're selected to mark the
// leaf of the expansion.
result |= selected.insert( path ).second;
}
return result;
}
示例13: inPlug
IECore::ConstInternedStringVectorDataPtr Set::computeSetNames( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstInternedStringVectorDataPtr inNamesData = inPlug()->setNamesPlug()->getValue();
const std::string &names = namePlug()->getValue();
if( !names.size() )
{
return inNamesData;
}
if( modePlug()->getValue() == Remove )
{
return inNamesData;
}
vector<InternedString> tokenizedNames;
StringAlgo::tokenize( names, ' ', tokenizedNames );
// specific logic if we have only one item, to avoid the more complex logic of adding two lists together
if( tokenizedNames.size() == 1 ) {
const std::vector<InternedString> &inNames = inNamesData->readable();
if( std::find( inNames.begin(), inNames.end(), tokenizedNames[0] ) != inNames.end() )
{
return inNamesData;
}
InternedStringVectorDataPtr resultData = inNamesData->copy();
resultData->writable().push_back( tokenizedNames[0] );
return resultData;
}
// inserting the new names into the vector
// while making sure we don't have duplicates
InternedStringVectorDataPtr resultData = inNamesData->copy();
std::vector<InternedString> &result = resultData->writable();
result.reserve( result.size() + tokenizedNames.size() );
std::copy( tokenizedNames.begin(), tokenizedNames.end(), std::back_inserter( result ) );
std::sort( result.begin(), result.end() );
std::vector<InternedString>::iterator it;
it = std::unique( result.begin(), result.end() );
result.resize( std::distance( result.begin(), it ) );
return resultData;
}
示例14: sets
IECore::ConstCompoundDataPtr GafferScene::sets( const ScenePlug *scene )
{
ConstInternedStringVectorDataPtr setNamesData = scene->setNamesPlug()->getValue();
std::vector<GafferScene::ConstPathMatcherDataPtr> setsVector;
setsVector.resize( setNamesData->readable().size(), NULL );
Sets setsCompute( scene, setNamesData->readable(), setsVector );
parallel_for( tbb::blocked_range<size_t>( 0, setsVector.size() ), setsCompute );
CompoundDataPtr result = new CompoundData;
for( size_t i = 0, e = setsVector.size(); i < e; ++i )
{
// The const_pointer_cast is ok because we're just using it to put the set into
// a container that will be const on return - we never modify the set itself.
result->writable()[setNamesData->readable()[i]] = boost::const_pointer_cast<GafferScene::PathMatcherData>( setsVector[i] );
}
return result;
}
示例15: inPlug
void InteractiveRender::updateShadersWalk( const ScenePlug::ScenePath &path )
{
/// \todo Keep a track of the hashes of the shaders at each path,
/// and use it to only update the shaders when they've changed.
ConstCompoundObjectPtr attributes = inPlug()->attributes( path );
// terminate recursion for invisible locations
ConstBoolDataPtr visibility = attributes->member<BoolData>( SceneInterface::visibilityName );
if( visibility && ( !visibility->readable() ) )
{
return;
}
ConstObjectVectorPtr shader = attributes->member<ObjectVector>( "shader" );
if( shader )
{
std::string name;
ScenePlug::pathToString( path, name );
CompoundDataMap parameters;
parameters["exactscopename"] = new StringData( name );
{
EditBlock edit( m_renderer.get(), "attribute", parameters );
for( ObjectVector::MemberContainer::const_iterator it = shader->members().begin(), eIt = shader->members().end(); it != eIt; it++ )
{
const StateRenderable *s = runTimeCast<const StateRenderable>( it->get() );
if( s )
{
s->render( m_renderer.get() );
}
}
}
}
ConstInternedStringVectorDataPtr childNames = inPlug()->childNames( path );
ScenePlug::ScenePath childPath = path;
childPath.push_back( InternedString() ); // for the child name
for( vector<InternedString>::const_iterator it=childNames->readable().begin(); it!=childNames->readable().end(); it++ )
{
childPath[path.size()] = *it;
updateShadersWalk( childPath );
}
}