I just ran into some very unexpected problem around interaction and wanted to ask if the following is known behavior or even work in progress for somebody:
- a DataNode is already in DataStorage with an interactor assigned
- you want to assign another parent to the DataNode, so to call Remove(node), then Add(node, new_parent)
- the interactor is in a unhealthy/dead state now, having lost its DataNode pointer (DataInteractor::DeletedNode got called)
For experimentation, I attached a patch against current master. Apply the patch, activate the Point Set Interaction view, then add a new PointSet, move the mouse over render windows, and have a look at the console. You should see lots of messages like "WARNING: EventStateMachine: Empty DataNode received along with this Event 000000000A780070"
I guess this is another variation of http://bugs.mitk.org/show_bug.cgi?id=19329 where DataInteractor::DeletedNode was introduced.
While not a solution, a workaround is to perform the desired operation as follows:
auto interactor = node->GetDataInteractor(); node->SetDataInteractor(nullptr); data_storage->Remove(node); // ! this will kill the attached interactor data_storage->Add(node, .. something else or nothing ..); interactor->SetDataNode(node);
- I would expect the interactor not to receive events while its node is removed from DataStorage
- I would expect the interactor to work as before when re-adding its node to (the same) DataStorage