inviwo/modules

TopologicalSimplification will not allways process with new data

r-englund opened this issue · 1 comments

If the processor gets new data (or properties are modified) while the background thread is processing no new calculation will be started since both the if statement and the else if statements are false.
To work around this one has to invalidate the output of the processor to start the calculation on the new data.
A fix for this would be to change the else if to a plain else

void TopologicalSimplification::process() {
if (util::is_future_ready(newTriangulation_)) {
try {
auto triangulation = newTriangulation_.get();
outport_.setData(triangulation);
hasNewData_ = false;
getActivityIndicator().setActive(false);
} catch (Exception &) {
// Need to reset the future, VS bug:
// http://stackoverflow.com/questions/33899615/stdfuture-still-valid-after-calling-get-which-throws-an-exception
newTriangulation_ = {};
outport_.setData(nullptr);
hasNewData_ = false;
throw;
}
} else if (!newTriangulation_.valid()) { // We are not waiting for a calculation
if (inport_.isChanged() || persistenceInport_.isChanged() || threshold_.isModified() ||
invert_.isModified() || simplificationDirty_) {
getActivityIndicator().setActive(true);
updateOutport();
}
}
}

but that would also potentially spawn lots and lots of background jobs when interacting...