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]
This commit is contained in:
parent
48132082ba
commit
30ad41f4a2
|
@ -6,11 +6,10 @@ char *Constraint::DescriptionString(void) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
hConstraint Constraint::AddConstraint(Constraint *c) {
|
void Constraint::AddConstraint(Constraint *c) {
|
||||||
SS.constraint.AddAndAssignId(c);
|
SS.constraint.AddAndAssignId(c);
|
||||||
|
|
||||||
SS.GW.GeneratePerSolving();
|
SS.GW.GeneratePerSolving();
|
||||||
return c->h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Constraint::Constrain(int type, hEntity ptA, hEntity ptB, hEntity entityA)
|
void Constraint::Constrain(int type, hEntity ptA, hEntity ptB, hEntity entityA)
|
||||||
|
|
|
@ -237,12 +237,21 @@ void GraphicsWindow::EnsureValidActives(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The active coordinate system must also exist.
|
// The active coordinate system must also exist.
|
||||||
if(activeWorkplane.v != Entity::FREE_IN_3D.v &&
|
if(activeWorkplane.v != Entity::FREE_IN_3D.v) {
|
||||||
!SS.entity.FindByIdNoOops(activeWorkplane))
|
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;
|
activeWorkplane = Entity::FREE_IN_3D;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
activeWorkplane = Entity::FREE_IN_3D;
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool in3d = (activeWorkplane.v == Entity::FREE_IN_3D.v);
|
bool in3d = (activeWorkplane.v == Entity::FREE_IN_3D.v);
|
||||||
CheckMenuById(MNU_FREE_IN_3D, in3d);
|
CheckMenuById(MNU_FREE_IN_3D, in3d);
|
||||||
|
@ -322,7 +331,6 @@ void GraphicsWindow::MenuRequest(int id) {
|
||||||
SS.GW.GroupSelection();
|
SS.GW.GroupSelection();
|
||||||
if(SS.GW.gs.n == 1 && SS.GW.gs.workplanes == 1) {
|
if(SS.GW.gs.n == 1 && SS.GW.gs.workplanes == 1) {
|
||||||
SS.GW.activeWorkplane = SS.GW.gs.entity[0];
|
SS.GW.activeWorkplane = SS.GW.gs.entity[0];
|
||||||
SS.GW.ClearSelection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SS.GW.activeWorkplane.v == Entity::FREE_IN_3D.v) {
|
if(SS.GW.activeWorkplane.v == Entity::FREE_IN_3D.v) {
|
||||||
|
@ -335,7 +343,7 @@ void GraphicsWindow::MenuRequest(int id) {
|
||||||
Quaternion quatf = e->Normal()->NormalGetNum();
|
Quaternion quatf = e->Normal()->NormalGetNum();
|
||||||
Vector offsetf = (e->WorkplaneGetOffset()).ScaledBy(-1);
|
Vector offsetf = (e->WorkplaneGetOffset()).ScaledBy(-1);
|
||||||
SS.GW.AnimateOnto(quatf, offsetf);
|
SS.GW.AnimateOnto(quatf, offsetf);
|
||||||
SS.GW.EnsureValidActives();
|
SS.GW.ClearSuper();
|
||||||
SS.TW.Show();
|
SS.TW.Show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
2
sketch.h
2
sketch.h
|
@ -372,7 +372,7 @@ public:
|
||||||
|
|
||||||
char *DescriptionString(void);
|
char *DescriptionString(void);
|
||||||
|
|
||||||
static hConstraint AddConstraint(Constraint *c);
|
static void AddConstraint(Constraint *c);
|
||||||
static void MenuConstrain(int id);
|
static void MenuConstrain(int id);
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -292,6 +292,7 @@ void TextWindow::ScreenActivateGroup(int link, DWORD v) {
|
||||||
// workplane too.
|
// workplane too.
|
||||||
SS.GW.activeWorkplane = g->h.entity(0);
|
SS.GW.activeWorkplane = g->h.entity(0);
|
||||||
}
|
}
|
||||||
|
SS.GW.ClearSuper();
|
||||||
}
|
}
|
||||||
void TextWindow::ShowListOfGroups(void) {
|
void TextWindow::ShowListOfGroups(void) {
|
||||||
Printf(true, "%Ftactive show group-name%E");
|
Printf(true, "%Ftactive show group-name%E");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user