本文整理汇总了C++中Plug::dirty方法的典型用法代码示例。如果您正苦于以下问题:C++ Plug::dirty方法的具体用法?C++ Plug::dirty怎么用?C++ Plug::dirty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plug
的用法示例。
在下文中一共展示了Plug::dirty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emit
void emit()
{
// Because we hold a reference to the plugs via m_graph,
// we may be the last owner. This means that when we clear
// the graph below, those plugs may be destroyed, which can
// trigger another dirty propagation as their child plugs are
// removed etc.
//
// Additionally, emitting plugDirtiedSignal() can cause
// ill-behaved code to trigger another dirty propagation
// phase while we're emitting this one. This is explicitly
// disallowed in the documentation for the Node class, but
// unfortunately we can't control what the python interpreter
// does - entering python via plugDirtiedSignal() can
// trigger a garbage collection which might delete plugs
// and trigger dirty propagation again as their children
// and inputs are removed.
//
// We use the m_emitting flag to disable these unwanted
// secondary propagations during emit(), since they're not
// needed, and can cause crashes.
ScopedAssignment<bool> scopedAssignment( m_emitting, true );
std::vector<VertexDescriptor> sorted;
try
{
topological_sort( m_graph, std::back_inserter( sorted ) );
}
catch( const std::exception &e )
{
IECore::msg( IECore::Msg::Error, "Plug dirty propagation", e.what() );
}
for( std::vector<VertexDescriptor>::const_iterator it = sorted.begin(), eIt = sorted.end(); it != eIt; ++it )
{
Plug *plug = m_graph[*it].get();
plug->dirty();
if( Node *node = plug->node() )
{
node->plugDirtiedSignal()( plug );
}
}
m_graph.clear();
m_plugs.clear();
}