Skip to content

Commit 664e48e

Browse files
[Sofa.Simulation] Change event propagation pruning (#5749)
Currently the pruning event is done at node level. Despite this is not fundamentally wrong, this behavior sounds a bit weird to me as It imply there is no event pruning between controllers's which kind of introduce kind of implicit coupling of event management at node level. The PR remove this coupling Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
1 parent bd18bf6 commit 664e48e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Sofa/framework/Simulation/Core/src/sofa/simulation/PropagateEventVisitor.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ PropagateEventVisitor::~PropagateEventVisitor()
3737

3838
Visitor::Result PropagateEventVisitor::processNodeTopDown(simulation::Node* node)
3939
{
40-
for_each(this, node, node->object, &PropagateEventVisitor::processObject);
41-
42-
if( m_event->isHandled() )
40+
for(auto obj : node->object){
41+
processObject(node, obj.get());
42+
if(m_event->isHandled())
43+
return Visitor::RESULT_PRUNE;
44+
};
45+
if(m_event->isHandled())
4346
return Visitor::RESULT_PRUNE;
44-
else
45-
return Visitor::RESULT_CONTINUE;
47+
return Visitor::RESULT_CONTINUE;
4648
}
4749

4850
void PropagateEventVisitor::processObject(simulation::Node*, core::objectmodel::BaseObject* obj)

0 commit comments

Comments
 (0)