本文整理汇总了C++中ContextPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ContextPtr::get方法的具体用法?C++ ContextPtr::get怎么用?C++ ContextPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextPtr
的用法示例。
在下文中一共展示了ContextPtr::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setNamesHash
IECore::MurmurHash ScenePlug::setNamesHash() const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
removeNonGlobalContextVariables( tmpContext.get() );
Context::Scope scopedContext( tmpContext.get() );
return setNamesPlug()->hash();
}
示例2: setNames
IECore::ConstInternedStringVectorDataPtr ScenePlug::setNames() const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
removeNonGlobalContextVariables( tmpContext.get() );
Context::Scope scopedContext( tmpContext.get() );
return setNamesPlug()->getValue();
}
示例3: globals
IECore::ConstCompoundObjectPtr ScenePlug::globals() const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
removeNonGlobalContextVariables( tmpContext.get() );
Context::Scope scopedContext( tmpContext.get() );
return globalsPlug()->getValue();
}
示例4: setHash
IECore::MurmurHash ScenePlug::setHash( const IECore::InternedString &setName ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( setNameContextName, setName );
removeNonGlobalContextVariables( tmpContext.get() );
Context::Scope scopedContext( tmpContext.get() );
return setPlug()->hash();
}
示例5: set
ConstPathMatcherDataPtr ScenePlug::set( const IECore::InternedString &setName ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( setNameContextName, setName );
removeNonGlobalContextVariables( tmpContext.get() );
Context::Scope scopedContext( tmpContext.get() );
return setPlug()->getValue();
}
示例6: transform
IECore::TransformPtr GafferScene::transform( const ScenePlug *scene, const ScenePlug::ScenePath &path, const Imath::V2f &shutter, bool motionBlur )
{
int numSamples = 1;
if( motionBlur )
{
ConstCompoundObjectPtr attributes = scene->fullAttributes( path );
const IntData *transformBlurSegmentsData = attributes->member<IntData>( "gaffer:transformBlurSegments" );
numSamples = transformBlurSegmentsData ? transformBlurSegmentsData->readable() + 1 : 2;
const BoolData *transformBlurData = attributes->member<BoolData>( "gaffer:transformBlur" );
if( transformBlurData && !transformBlurData->readable() )
{
numSamples = 1;
}
}
MatrixMotionTransformPtr result = new MatrixMotionTransform();
ContextPtr transformContext = new Context( *Context::current(), Context::Borrowed );
Context::Scope scopedContext( transformContext.get() );
for( int i = 0; i < numSamples; i++ )
{
float frame = lerp( shutter[0], shutter[1], (float)i / std::max( 1, numSamples - 1 ) );
transformContext->setFrame( frame );
result->snapshots()[frame] = scene->fullTransform( path );
}
return result;
}
示例7: object
IECore::ConstObjectPtr ScenePlug::object( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( scenePathContextName, scenePath );
Context::Scope scopedContext( tmpContext.get() );
return objectPlug()->getValue();
}
示例8: fullAttributes
IECore::CompoundObjectPtr ScenePlug::fullAttributes( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
IECore::CompoundObject::ObjectMap &resultMembers = result->members();
ScenePath path( scenePath );
while( path.size() )
{
tmpContext->set( scenePathContextName, path );
IECore::ConstCompoundObjectPtr a = attributesPlug()->getValue();
const IECore::CompoundObject::ObjectMap &aMembers = a->members();
for( IECore::CompoundObject::ObjectMap::const_iterator it = aMembers.begin(), eIt = aMembers.end(); it != eIt; it++ )
{
if( resultMembers.find( it->first ) == resultMembers.end() )
{
resultMembers.insert( *it );
}
}
path.pop_back();
}
return result;
}
示例9: scopedContext
Imath::M44f ScenePlug::transform( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( scenePathContextName, scenePath );
Context::Scope scopedContext( tmpContext.get() );
return transformPlug()->getValue();
}
示例10: 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;
}
示例11: 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;
}
示例12: childNamesHash
IECore::MurmurHash ScenePlug::childNamesHash( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( scenePathContextName, scenePath );
Context::Scope scopedContext( tmpContext.get() );
return childNamesPlug()->hash();
}
示例13: childNames
IECore::ConstInternedStringVectorDataPtr ScenePlug::childNames( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( scenePathContextName, scenePath );
Context::Scope scopedContext( tmpContext.get() );
return childNamesPlug()->getValue();
}
示例14: hashEngine
void UVWarp::hashEngine( const std::string &channelName, const Imath::V2i &tileOrigin, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
Warp::hashEngine( channelName, tileOrigin, context, h );
h.append( tileOrigin );
uvPlug()->dataWindowPlug()->hash( h );
ConstStringVectorDataPtr channelNames = uvPlug()->channelNamesPlug()->getValue();
ContextPtr tmpContext = new Context( *context, Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
if( channelExists( channelNames->readable(), "R" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "R" );
uvPlug()->channelDataPlug()->hash( h );
}
if( channelExists( channelNames->readable(), "G" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "G" );
uvPlug()->channelDataPlug()->hash( h );
}
if( channelExists( channelNames->readable(), "A" ) )
{
tmpContext->set<std::string>( ImagePlug::channelNameContextName, "A" );
uvPlug()->channelDataPlug()->hash( h );
}
inPlug()->formatPlug()->hash( h );
}
示例15: operator
void operator()( const blocked_range2d<size_t>& r ) const
{
ContextPtr context = new Context( *m_parentContext );
const Box2i operationWindow( V2i( r.rows().begin()+m_dataWindow.min.x, r.cols().begin()+m_dataWindow.min.y ), V2i( r.rows().end()+m_dataWindow.min.x-1, r.cols().end()+m_dataWindow.min.y-1 ) );
V2i minTileOrigin = ImagePlug::tileOrigin( operationWindow.min );
V2i maxTileOrigin = ImagePlug::tileOrigin( operationWindow.max );
size_t imageStride = m_dataWindow.size().x + 1;
for( int tileOriginY = minTileOrigin.y; tileOriginY <= maxTileOrigin.y; tileOriginY += m_tileSize )
{
for( int tileOriginX = minTileOrigin.x; tileOriginX <= maxTileOrigin.x; tileOriginX += m_tileSize )
{
for( vector<string>::const_iterator it = m_channelNames.begin(), eIt = m_channelNames.end(); it != eIt; it++ )
{
context->set( ImagePlug::channelNameContextName, *it );
context->set( ImagePlug::tileOriginContextName, V2i( tileOriginX, tileOriginY ) );
Context::Scope scope( context.get() );
Box2i tileBound( V2i( tileOriginX, tileOriginY ), V2i( tileOriginX + m_tileSize - 1, tileOriginY + m_tileSize - 1 ) );
Box2i b = boxIntersection( tileBound, operationWindow );
ConstFloatVectorDataPtr tileData = m_channelDataPlug->getValue();
for( int y = b.min.y; y<=b.max.y; y++ )
{
const float *tilePtr = &(tileData->readable()[0]) + (y - tileOriginY) * m_tileSize + (b.min.x - tileOriginX);
float *channelPtr = m_imageChannelData[it-m_channelNames.begin()] + ( m_dataWindow.size().y - ( y - m_dataWindow.min.y ) ) * imageStride + (b.min.x - m_dataWindow.min.x);
for( int x = b.min.x; x <= b.max.x; x++ )
{
*channelPtr++ = *tilePtr++;
}
}
}
}
}
}