Fix a crash; it was possible to attempt to draw in a workplane
that's in a group that solves after the current group. This means that the constraint/request gets deleted instantly, and stuff like auto-constraints on the just-created entities blow up. I now check that the active workplane comes from the active group or one solved before it. [git-p4: depot-paths = "//depot/solvespace/": change = 1729]solver
parent
48132082ba
commit
30ad41f4a2
|
@ -6,11 +6,10 @@ char *Constraint::DescriptionString(void) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
hConstraint Constraint::AddConstraint(Constraint *c) {
|
||||
void Constraint::AddConstraint(Constraint *c) {
|
||||
SS.constraint.AddAndAssignId(c);
|
||||
|
||||
SS.GW.GeneratePerSolving();
|
||||
return c->h;
|
||||
}
|
||||
|
||||
void Constraint::Constrain(int type, hEntity ptA, hEntity ptB, hEntity entityA)
|
||||
|
|
|
@ -237,11 +237,20 @@ void GraphicsWindow::EnsureValidActives(void) {
|
|||
}
|
||||
|
||||
// The active coordinate system must also exist.
|
||||
if(activeWorkplane.v != Entity::FREE_IN_3D.v &&
|
||||
!SS.entity.FindByIdNoOops(activeWorkplane))
|
||||
{
|
||||
activeWorkplane = Entity::FREE_IN_3D;
|
||||
change = true;
|
||||
if(activeWorkplane.v != Entity::FREE_IN_3D.v) {
|
||||
Entity *e = SS.entity.FindByIdNoOops(activeWorkplane);
|
||||
if(e) {
|
||||
hGroup hgw = e->group;
|
||||
if(hgw.v != activeGroup.v && SS.GroupsInOrder(activeGroup, hgw)) {
|
||||
// The active workplane is in a group that comes after the
|
||||
// active group; so any request or constraint will fail.
|
||||
activeWorkplane = Entity::FREE_IN_3D;
|
||||
change = true;
|
||||
}
|
||||
} else {
|
||||
activeWorkplane = Entity::FREE_IN_3D;
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool in3d = (activeWorkplane.v == Entity::FREE_IN_3D.v);
|
||||
|
@ -322,7 +331,6 @@ void GraphicsWindow::MenuRequest(int id) {
|
|||
SS.GW.GroupSelection();
|
||||
if(SS.GW.gs.n == 1 && SS.GW.gs.workplanes == 1) {
|
||||
SS.GW.activeWorkplane = SS.GW.gs.entity[0];
|
||||
SS.GW.ClearSelection();
|
||||
}
|
||||
|
||||
if(SS.GW.activeWorkplane.v == Entity::FREE_IN_3D.v) {
|
||||
|
@ -335,7 +343,7 @@ void GraphicsWindow::MenuRequest(int id) {
|
|||
Quaternion quatf = e->Normal()->NormalGetNum();
|
||||
Vector offsetf = (e->WorkplaneGetOffset()).ScaledBy(-1);
|
||||
SS.GW.AnimateOnto(quatf, offsetf);
|
||||
SS.GW.EnsureValidActives();
|
||||
SS.GW.ClearSuper();
|
||||
SS.TW.Show();
|
||||
break;
|
||||
}
|
||||
|
|
2
sketch.h
2
sketch.h
|
@ -372,7 +372,7 @@ public:
|
|||
|
||||
char *DescriptionString(void);
|
||||
|
||||
static hConstraint AddConstraint(Constraint *c);
|
||||
static void AddConstraint(Constraint *c);
|
||||
static void MenuConstrain(int id);
|
||||
|
||||
struct {
|
||||
|
|
|
@ -292,6 +292,7 @@ void TextWindow::ScreenActivateGroup(int link, DWORD v) {
|
|||
// workplane too.
|
||||
SS.GW.activeWorkplane = g->h.entity(0);
|
||||
}
|
||||
SS.GW.ClearSuper();
|
||||
}
|
||||
void TextWindow::ShowListOfGroups(void) {
|
||||
Printf(true, "%Ftactive show group-name%E");
|
||||
|
|
Loading…
Reference in New Issue