fix several crashes on constraint creeation
This commit is contained in:
parent
3d3d5c789d
commit
a5809891d6
@ -264,9 +264,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
|
|
||||||
c.valA = 0;
|
c.valA = 0;
|
||||||
c.ModifyToSatisfy();
|
c.ModifyToSatisfy();
|
||||||
|
AddConstraint(&c);
|
||||||
newcons.push_back(c);
|
newcons.push_back(c);
|
||||||
for (auto&& nc:newcons)
|
|
||||||
AddConstraint(&nc);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,8 +300,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
" * a point and a plane face (point on face)\n"));
|
" * a point and a plane face (point on face)\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::EQUAL:
|
case Command::EQUAL:
|
||||||
@ -433,8 +432,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
|
|
||||||
c.valA = 0;
|
c.valA = 0;
|
||||||
c.ModifyToSatisfy();
|
c.ModifyToSatisfy();
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::DIFFERENCE:
|
case Command::DIFFERENCE:
|
||||||
@ -468,8 +467,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
|
|
||||||
c.valA = 0;
|
c.valA = 0;
|
||||||
c.ModifyToSatisfy();
|
c.ModifyToSatisfy();
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::AT_MIDPOINT:
|
case Command::AT_MIDPOINT:
|
||||||
@ -482,16 +481,16 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
// it on-line; so auto-remove that. Handle as one undo group.
|
// it on-line; so auto-remove that. Handle as one undo group.
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
DeleteAllConstraintsFor(Type::PT_ON_LINE, c.entityA, c.ptA);
|
DeleteAllConstraintsFor(Type::PT_ON_LINE, c.entityA, c.ptA);
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c, /*rememberForUndo=*/false);
|
AddConstraint(&c, /*rememberForUndo=*/false);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
} else if(gs.lineSegments == 1 && gs.workplanes == 1 && gs.n == 2) {
|
} else if(gs.lineSegments == 1 && gs.workplanes == 1 && gs.n == 2) {
|
||||||
c.type = Type::AT_MIDPOINT;
|
c.type = Type::AT_MIDPOINT;
|
||||||
int i = SK.GetEntity(gs.entity[0])->IsWorkplane() ? 1 : 0;
|
int i = SK.GetEntity(gs.entity[0])->IsWorkplane() ? 1 : 0;
|
||||||
c.entityA = gs.entity[i];
|
c.entityA = gs.entity[i];
|
||||||
c.entityB = gs.entity[1-i];
|
c.entityB = gs.entity[1-i];
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
} else {
|
} else {
|
||||||
Error(_("Bad selection for at midpoint constraint. This "
|
Error(_("Bad selection for at midpoint constraint. This "
|
||||||
"constraint can apply to:\n\n"
|
"constraint can apply to:\n\n"
|
||||||
@ -594,8 +593,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::VERTICAL:
|
case Command::VERTICAL:
|
||||||
@ -670,8 +669,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
|
|
||||||
nfree->NormalForceTo(Quaternion::From(fu, fv));
|
nfree->NormalForceTo(Quaternion::From(fu, fv));
|
||||||
}
|
}
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c, /*rememberForUndo=*/false);
|
AddConstraint(&c, /*rememberForUndo=*/false);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,8 +746,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.ModifyToSatisfy();
|
c.ModifyToSatisfy();
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,6 +756,7 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
c.type = Type::PARALLEL;
|
c.type = Type::PARALLEL;
|
||||||
c.entityA = gs.face[0];
|
c.entityA = gs.face[0];
|
||||||
c.entityB = gs.face[1];
|
c.entityB = gs.face[1];
|
||||||
|
newcons.push_back(c);
|
||||||
} else if(gs.vectors > 1 && gs.vectors == gs.n) {
|
} else if(gs.vectors > 1 && gs.vectors == gs.n) {
|
||||||
c.type = Type::PARALLEL;
|
c.type = Type::PARALLEL;
|
||||||
c.entityA = gs.vector[0];
|
c.entityA = gs.vector[0];
|
||||||
@ -837,8 +837,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
" * two normals\n"));
|
" * two normals\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::WHERE_DRAGGED:
|
case Command::WHERE_DRAGGED:
|
||||||
@ -851,8 +851,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
" * a point\n"));
|
" * a point\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::COMMENT:
|
case Command::COMMENT:
|
||||||
@ -862,8 +862,8 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
c.group = SS.GW.activeGroup;
|
c.group = SS.GW.activeGroup;
|
||||||
c.workplane = SS.GW.ActiveWorkplane();
|
c.workplane = SS.GW.ActiveWorkplane();
|
||||||
c.comment = _("NEW COMMENT -- DOUBLE-CLICK TO EDIT");
|
c.comment = _("NEW COMMENT -- DOUBLE-CLICK TO EDIT");
|
||||||
newcons.push_back(c);
|
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
|
newcons.push_back(c);
|
||||||
} else {
|
} else {
|
||||||
SS.GW.pending.operation = GraphicsWindow::Pending::COMMAND;
|
SS.GW.pending.operation = GraphicsWindow::Pending::COMMAND;
|
||||||
SS.GW.pending.command = Command::COMMENT;
|
SS.GW.pending.command = Command::COMMENT;
|
||||||
|
Loading…
Reference in New Issue
Block a user