Fix #131. Prevent UI freeze by having a timeout when finding which constraints can be removed to fix jacobian.
This commit is contained in:
parent
e74185b639
commit
615708440f
@ -189,6 +189,7 @@ public:
|
||||
struct {
|
||||
SolveResult how;
|
||||
int dof;
|
||||
bool timeout;
|
||||
List<hConstraint> remove;
|
||||
} solved;
|
||||
|
||||
|
@ -355,10 +355,17 @@ void System::WriteEquationsExceptFor(hConstraint hc, Group *g) {
|
||||
}
|
||||
|
||||
void System::FindWhichToRemoveToFixJacobian(Group *g, List<hConstraint> *bad, bool forceDofCheck) {
|
||||
auto time = GetMilliseconds();
|
||||
g->solved.timeout = false;
|
||||
int a;
|
||||
|
||||
for(a = 0; a < 2; a++) {
|
||||
for(auto &con : SK.constraint) {
|
||||
if((GetMilliseconds() - time) > 1500) { // todo: make timeout configurable
|
||||
g->solved.timeout = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ConstraintBase *c = &con;
|
||||
if(c->group != g->h) continue;
|
||||
if((c->type == Constraint::Type::POINTS_COINCIDENT && a == 0) ||
|
||||
|
@ -578,6 +578,11 @@ void TextWindow::ShowGroupSolveInfo() {
|
||||
c->DescriptionString().c_str());
|
||||
}
|
||||
|
||||
if(g->solved.timeout) {
|
||||
Printf(true, "%FxSome items in list have been ommitted%Fd");
|
||||
Printf(false, "%Fxbecause the operation timed out.%Fd");
|
||||
}
|
||||
|
||||
Printf(true, "It may be possible to fix the problem ");
|
||||
Printf(false, "by selecting Edit -> Undo.");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user