Clean up face selection code
parent
adb2768154
commit
aee47a42c6
|
@ -185,7 +185,7 @@ void GraphicsWindow::MakeSelected(Selection *stog) {
|
||||||
|
|
||||||
if(stog->entity.v != 0 && SK.GetEntity(stog->entity)->IsFace()) {
|
if(stog->entity.v != 0 && SK.GetEntity(stog->entity)->IsFace()) {
|
||||||
// In the interest of speed for the triangle drawing code,
|
// In the interest of speed for the triangle drawing code,
|
||||||
// only three faces may be selected at a time.
|
// only MAX_SELECTABLE_FACES faces may be selected at a time.
|
||||||
int c = 0;
|
int c = 0;
|
||||||
Selection *s;
|
Selection *s;
|
||||||
selection.ClearTags();
|
selection.ClearTags();
|
||||||
|
@ -193,9 +193,9 @@ void GraphicsWindow::MakeSelected(Selection *stog) {
|
||||||
hEntity he = s->entity;
|
hEntity he = s->entity;
|
||||||
if(he.v != 0 && SK.GetEntity(he)->IsFace()) {
|
if(he.v != 0 && SK.GetEntity(he)->IsFace()) {
|
||||||
c++;
|
c++;
|
||||||
// Modify also Group::DrawMesh "case DrawMeshAs::SELECTED:"
|
// See also GraphicsWindow::GroupSelection "if(e->IsFace())"
|
||||||
// Magic numers are ugly :-(
|
// and Group::DrawMesh "case DrawMeshAs::SELECTED:"
|
||||||
if(c >= 3) s->tag = 1;
|
if(c >= MAX_SELECTABLE_FACES) s->tag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selection.RemoveTagged();
|
selection.RemoveTagged();
|
||||||
|
|
|
@ -635,11 +635,11 @@ void Group::DrawMesh(DrawMeshAs how, Canvas *canvas) {
|
||||||
std::vector<uint32_t> faces;
|
std::vector<uint32_t> faces;
|
||||||
SS.GW.GroupSelection();
|
SS.GW.GroupSelection();
|
||||||
auto const &gs = SS.GW.gs;
|
auto const &gs = SS.GW.gs;
|
||||||
// Modify also GraphicsWindow::MakeSelected "if(c >= 3) s->tag = 1;"
|
// See also GraphicsWindow::MakeSelected "if(c >= MAX_SELECTABLE_FACES)"
|
||||||
// Magic numers are ugly :-(
|
// and GraphicsWindow::GroupSelection "if(e->IsFace())"
|
||||||
if(gs.faces > 0) faces.push_back(gs.face[0].v);
|
for(auto &fc : gs.face) {
|
||||||
if(gs.faces > 1) faces.push_back(gs.face[1].v);
|
faces.push_back(fc.v);
|
||||||
if(gs.faces > 2) faces.push_back(gs.face[2].v);
|
}
|
||||||
canvas->DrawFaces(displayMesh, faces, hcf);
|
canvas->DrawFaces(displayMesh, faces, hcf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
1
src/ui.h
1
src/ui.h
|
@ -750,6 +750,7 @@ public:
|
||||||
Selection hover;
|
Selection hover;
|
||||||
bool hoverWasSelectedOnMousedown;
|
bool hoverWasSelectedOnMousedown;
|
||||||
List<Selection> selection;
|
List<Selection> selection;
|
||||||
|
const unsigned MAX_SELECTABLE_FACES = 3u;
|
||||||
|
|
||||||
Selection ChooseFromHoverToSelect();
|
Selection ChooseFromHoverToSelect();
|
||||||
Selection ChooseFromHoverToDrag();
|
Selection ChooseFromHoverToDrag();
|
||||||
|
|
Loading…
Reference in New Issue