本文整理汇总了C++中ConstCompoundDataPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConstCompoundDataPtr类的具体用法?C++ ConstCompoundDataPtr怎么用?C++ ConstCompoundDataPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstCompoundDataPtr类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyFromPlug
IECore::ConstCompoundDataPtr CopyImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundData *inputMetadata ) const
{
ConstCompoundDataPtr copyFrom = copyFromPlug()->metadataPlug()->getValue();
if( copyFrom->readable().empty() )
{
return inputMetadata;
}
const std::string names = namesPlug()->getValue();
const bool invert = invertNamesPlug()->getValue();
if ( !invert && !names.size() )
{
return inputMetadata;
}
IECore::CompoundDataPtr result = inputMetadata->copy();
for( IECore::CompoundData::ValueType::const_iterator it = copyFrom->readable().begin(), eIt = copyFrom->readable().end(); it != eIt; ++it )
{
if( StringAlgo::matchMultiple( it->first.c_str(), names.c_str() ) != invert )
{
result->writable()[it->first] = it->second;
}
}
return result;
}
示例2: inPlug
GafferScene::ConstPathMatcherDataPtr BranchCreator::computeSet( const IECore::InternedString &setName, const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstPathMatcherDataPtr inputSetData = inPlug()->set( setName );
ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() );
if( !mapping->readable().size() )
{
return inputSetData;
}
ScenePlug::ScenePath parentPath = mapping->member<InternedStringVectorData>( g_parentKey )->readable();
ConstPathMatcherDataPtr branchSetData = computeBranchSet( parentPath, setName, context );
if( !branchSetData )
{
return inputSetData;
}
const PathMatcher &branchSet = branchSetData->readable();
if( branchSet.isEmpty() )
{
return inputSetData;
}
const CompoundData *forwardMapping = mapping->member<CompoundData>( g_forwardMappingKey );
PathMatcherDataPtr outputSetData = inputSetData->copy();
PathMatcher &outputSet = outputSetData->writable();
vector<InternedString> outputPrefix( parentPath );
for( PathMatcher::RawIterator pIt = branchSet.begin(), peIt = branchSet.end(); pIt != peIt; ++pIt )
{
const ScenePlug::ScenePath &branchPath = *pIt;
if( !branchPath.size() )
{
continue; // Skip root
}
assert( branchPath.size() == 1 );
const InternedStringData *outputName = forwardMapping->member<InternedStringData>( branchPath[0], /* throwExceptions = */ true );
outputPrefix.resize( parentPath.size() + 1 );
outputPrefix.back() = outputName->readable();
outputSet.addPaths( branchSet.subTree( *pIt ), outputPrefix );
pIt.prune(); // We only want to visit the first level
}
return outputSetData;
}
示例3: mappingPlug
void BranchCreator::hashObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const
{
ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() );
ScenePath parentPath, branchPath;
Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath );
if( parentMatch == Filter::AncestorMatch )
{
hashBranchObject( parentPath, branchPath, context, h );
}
else
{
h = inPlug()->objectPlug()->hash();
}
}
示例4: GafferDisplayDriver
GafferDisplayDriver( const Imath::Box2i &displayWindow, const Imath::Box2i &dataWindow,
const vector<string> &channelNames, ConstCompoundDataPtr parameters )
: ImageDisplayDriver( displayWindow, dataWindow, channelNames, parameters )
{
m_parameters = parameters ? parameters->copy() : CompoundDataPtr( new CompoundData );
instanceCreatedSignal()( this );
}
示例5: ImagePrimitive
ImageDisplayDriver::ImageDisplayDriver( const Box2i &displayWindow, const Box2i &dataWindow, const vector<string> &channelNames, ConstCompoundDataPtr parameters ) :
DisplayDriver( displayWindow, dataWindow, channelNames, parameters ),
m_image( new ImagePrimitive( dataWindow, displayWindow ) )
{
for ( vector<string>::const_iterator it = channelNames.begin(); it != channelNames.end(); it++ )
{
m_image->createChannel<float>( *it );
}
if( parameters )
{
CompoundDataMap &xData = m_image->blindData()->writable();
const CompoundDataMap &yData = parameters->readable();
CompoundDataMap::const_iterator iterY = yData.begin();
for ( ; iterY != yData.end(); iterY++ )
{
xData[iterY->first] = iterY->second->copy();
}
ConstStringDataPtr handle = parameters->member<StringData>( "handle" );
if( handle )
{
tbb::mutex::scoped_lock lock( g_poolMutex );
g_pool[handle->readable()] = m_image;
}
}
}
示例6: outSetsPlug
void SetVisualiser::hashProcessedAttributes( const ScenePath &path, const Gaffer::Context *context, MurmurHash &h ) const
{
ConstCompoundDataPtr outSetsData = outSetsPlug()->getValue();
outSetsData->hash( h );
includeInheritedPlug()->hash( h );
// We also need to consider each of our candidate sets membership
// definition (which we didn't need to when computing outSets).
// outSetsData is map of names -> colors.
ConstInternedStringVectorDataPtr setNames = outSetsData->member<InternedStringVectorData>( "names" );
for( auto &setName : setNames->readable() )
{
h.append( inPlug()->setHash( setName ) );
}
h.append( path.data(), path.size() );
stripeWidthPlug()->hash( h );
}
示例7: mappingPlug
void BranchCreator::hashSetNames( const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const
{
ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() );
if( !mapping->readable().size() )
{
h = inPlug()->setNamesPlug()->hash();
return;
}
MurmurHash branchSetNamesHash;
hashBranchSetNames( mapping->member<InternedStringVectorData>( g_parentKey )->readable(), context, branchSetNamesHash );
if( branchSetNamesHash == MurmurHash() )
{
h = inPlug()->setNamesPlug()->hash();
return;
}
SceneProcessor::hashSetNames( context, parent, h );
inPlug()->setNamesPlug()->hash( h );
h.append( branchSetNamesHash );
}
示例8: formatPlug
IECoreImage::ImagePrimitivePtr ImagePlug::image() const
{
Format format = formatPlug()->getValue();
Box2i dataWindow = dataWindowPlug()->getValue();
Box2i newDataWindow( Imath::V2i( 0 ) );
if( !BufferAlgo::empty( dataWindow ) )
{
newDataWindow = format.toEXRSpace( dataWindow );
}
else
{
dataWindow = newDataWindow;
}
Box2i newDisplayWindow = format.toEXRSpace( format.getDisplayWindow() );
IECoreImage::ImagePrimitivePtr result = new IECoreImage::ImagePrimitive( newDataWindow, newDisplayWindow );
ConstCompoundDataPtr metadata = metadataPlug()->getValue();
result->blindData()->Object::copyFrom( metadata.get() );
ConstStringVectorDataPtr channelNamesData = channelNamesPlug()->getValue();
const vector<string> &channelNames = channelNamesData->readable();
vector<float *> imageChannelData;
for( vector<string>::const_iterator it = channelNames.begin(), eIt = channelNames.end(); it!=eIt; it++ )
{
FloatVectorDataPtr cd = new FloatVectorData;
vector<float> &c = cd->writable();
c.resize( result->channelSize(), 0.0f );
result->channels[*it] = cd;
imageChannelData.push_back( &(c[0]) );
}
CopyTile copyTile( imageChannelData, channelNames, dataWindow );
ImageAlgo::parallelProcessTiles( this, channelNames, copyTile, dataWindow );
return result;
}
示例9: inPlug
IECore::ConstStringVectorDataPtr OSLImage::computeChannelNames( const Gaffer::Context *context, const GafferImage::ImagePlug *parent ) const
{
ConstStringVectorDataPtr channelNamesData = inPlug()->channelNamesPlug()->getValue();
set<string> result( channelNamesData->readable().begin(), channelNamesData->readable().end() );
const Box2i dataWindow = inPlug()->dataWindowPlug()->getValue();
if( !dataWindow.isEmpty() )
{
ContextPtr c = new Context( *context, Context::Borrowed );
c->set( ImagePlug::tileOriginContextName, ImagePlug::tileOrigin( dataWindow.min ) );
Context::Scope s( c.get() );
ConstCompoundDataPtr shading = runTimeCast<const CompoundData>( shadingPlug()->getValue() );
for( CompoundDataMap::const_iterator it = shading->readable().begin(), eIt = shading->readable().end(); it != eIt; ++it )
{
result.insert( it->first );
}
}
return new StringVectorData( vector<string>( result.begin(), result.end() ) );
}
示例10: NukeDisplayDriver
NukeDisplayDriver( const Imath::Box2i &displayWindow, const Imath::Box2i &dataWindow, const std::vector<std::string> &channelNames, ConstCompoundDataPtr parameters )
: ImageDisplayDriver( displayWindow, dataWindow, channelNames, parameters )
{
if( parameters )
{
m_parameters = parameters->copy();
}
else
{
m_parameters = new CompoundData;
}
instanceCreatedSignal( this );
}
示例11: GafferDisplayDriver
GafferDisplayDriver( const Imath::Box2i &displayWindow, const Imath::Box2i &dataWindow,
const vector<string> &channelNames, ConstCompoundDataPtr parameters )
: DisplayDriver( displayWindow, dataWindow, channelNames, parameters ),
m_gafferFormat( displayWindow, 1 ),
m_gafferDataWindow( m_gafferFormat.yDownToFormatSpace( dataWindow ) )
{
const V2i dataWindowMinTileIndex = ImagePlug::tileOrigin( m_gafferDataWindow.min ) / ImagePlug::tileSize();
const V2i dataWindowMaxTileIndex = ImagePlug::tileOrigin( m_gafferDataWindow.max ) / ImagePlug::tileSize();
m_tiles.resize(
TileArray::extent_gen()
[TileArray::extent_range( dataWindowMinTileIndex.x, dataWindowMaxTileIndex.x + 1 )]
[TileArray::extent_range( dataWindowMinTileIndex.y, dataWindowMaxTileIndex.y + 1 )]
[channelNames.size()]
);
m_parameters = parameters ? parameters->copy() : CompoundDataPtr( new CompoundData );
instanceCreatedSignal()( this );
}
示例12: inPlug
IECore::ConstCompoundObjectPtr BranchCreator::computeGlobals( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstCompoundObjectPtr inputGlobals = inPlug()->globalsPlug()->getValue();
ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() );
if( !mapping->readable().size() )
{
return inputGlobals;
}
const CompoundData *branchSets = NULL;
ConstCompoundObjectPtr branchGlobals = computeBranchGlobals( mapping->member<InternedStringVectorData>( g_parentKey )->readable(), context );
if( branchGlobals )
{
branchSets = branchGlobals->member<CompoundData>( "gaffer:sets", /* throwExceptions = */ false );
}
if( !branchSets )
{
return inputGlobals;
}
IECore::CompoundObjectPtr outputGlobals = new CompoundObject;
// Shallow copy of the input, because most of it will remain unchanged.
outputGlobals->members() = inputGlobals->members();
// Deep copy of the input sets, because we'll be modifying them.
const CompoundData *inputSets = inputGlobals->member<CompoundData>( "gaffer:sets", /* throwExeptions = */ false );
CompoundDataPtr outputSets = inputSets ? inputSets->copy() : new CompoundData;
outputGlobals->members()["gaffer:sets"] = outputSets;
const CompoundData *forwardMapping = mapping->member<CompoundData>( g_forwardMappingKey );
string parentString;
ScenePlug::pathToString( mapping->member<InternedStringVectorData>( g_parentKey )->readable(), parentString );
if( !boost::ends_with( parentString, "/" ) )
{
parentString += "/";
}
for( CompoundDataMap::const_iterator it = branchSets->readable().begin(), eIt = branchSets->readable().end(); it != eIt; ++it )
{
const PathMatcher &branchSet = static_cast<const PathMatcherData *>( it->second.get() )->readable();
PathMatcher &outputSet = outputSets->member<PathMatcherData>( it->first, /* throwExceptions = */ false, /* createIfMissing = */ true )->writable();
/// \todo If PathMatcher allowed us to rename nodes and merge in other PathMatchers, this could
/// be much more efficient.
vector<string> branchPaths;
branchSet.paths( branchPaths );
for( vector<string>::const_iterator pIt = branchPaths.begin(), peIt = branchPaths.end(); pIt != peIt; ++pIt )
{
const string &branchPath = *pIt;
const size_t secondSlashPos = branchPath.find( '/', 1 );
const std::string branchName( branchPath, 1, secondSlashPos - 1 );
const InternedStringData *outputName = forwardMapping->member<InternedStringData>( branchName );
if( !outputName )
{
// See comments in Group::computeGlobals().
continue;
}
std::string outputPath = parentString + outputName->readable().string();
if( secondSlashPos != string::npos )
{
outputPath += branchPath.substr( secondSlashPos );
}
outputSet.addPath( outputPath );
}
}
return outputGlobals;
}