Make normals and workplanes non-stylable.

This does not seem to have any useful application, and it can
result in odd misrenderings with some styles.
pull/4/head
EvilSpirit 2016-03-25 14:45:49 +06:00 committed by whitequark
parent 614902ebdd
commit 73f28b9731
6 changed files with 23 additions and 16 deletions

View File

@ -19,15 +19,6 @@ bool GraphicsWindow::Selection::IsEmpty(void) {
return true;
}
bool GraphicsWindow::Selection::IsStylable(void) {
if(entity.v) return true;
if(constraint.v) {
Constraint *c = SK.GetConstraint(constraint);
if(c->type == Constraint::COMMENT) return true;
}
return false;
}
bool GraphicsWindow::Selection::HasEndpoints(void) {
if(!entity.v) return false;
Entity *e = SK.GetEntity(entity);
@ -257,12 +248,14 @@ void GraphicsWindow::GroupSelection(void) {
(gs.n)++;
Entity *e = SK.entity.FindById(s->entity);
if(e->IsStylable()) gs.stylables++;
// A list of points, and a list of all entities that aren't points.
if(e->IsPoint()) {
gs.point[(gs.points)++] = s->entity;
} else {
gs.entity[(gs.entities)++] = s->entity;
(gs.stylables)++;
}
// And an auxiliary list of normals, including normals from
@ -305,10 +298,8 @@ void GraphicsWindow::GroupSelection(void) {
if(s->constraint.v) {
gs.constraint[(gs.constraints)++] = s->constraint;
Constraint *c = SK.GetConstraint(s->constraint);
if(c->type == Constraint::COMMENT) {
(gs.stylables)++;
(gs.comments)++;
}
if(c->IsStylable()) gs.stylables++;
if(c->type == Constraint::COMMENT) gs.comments++;
}
}
}

View File

@ -1117,3 +1117,8 @@ void Constraint::GetEdges(SEdgeList *sel) {
dogd.sel = NULL;
}
bool Constraint::IsStylable() {
if(type == COMMENT) return true;
return false;
}

View File

@ -205,6 +205,13 @@ Vector Entity::GetReferencePos(void) {
return dogd.refp;
}
bool Entity::IsStylable() {
if(IsPoint()) return false;
if(IsWorkplane()) return false;
if(IsNormal()) return false;
return true;
}
bool Entity::IsVisible(void) {
Group *g = SK.GetGroup(group);

View File

@ -494,6 +494,7 @@ public:
void LineDrawOrGetDistance(Vector a, Vector b, bool maybeFat=false);
void DrawOrGetDistance(void);
bool IsStylable();
bool IsVisible(void);
bool PointIsFromReferences(void);
@ -676,6 +677,7 @@ public:
Vector GetReferencePos(void);
void Draw(void);
void GetEdges(SEdgeList *sel);
bool IsStylable();
void LineDrawOrGetDistance(Vector a, Vector b);
void DrawOrGetDistance(Vector *labelPos);

View File

@ -148,6 +148,9 @@ void Style::AssignSelectionToStyle(uint32_t v) {
int i;
for(i = 0; i < SS.GW.gs.entities; i++) {
hEntity he = SS.GW.gs.entity[i];
Entity *e = SK.GetEntity(he);
if(!e->IsStylable()) continue;
if(!he.isFromRequest()) {
showError = true;
continue;
@ -161,7 +164,7 @@ void Style::AssignSelectionToStyle(uint32_t v) {
for(i = 0; i < SS.GW.gs.constraints; i++) {
hConstraint hc = SS.GW.gs.constraint[i];
Constraint *c = SK.GetConstraint(hc);
if(c->type != Constraint::COMMENT) continue;
if(!c->IsStylable()) continue;
c->disp.style.v = v;
}

View File

@ -618,7 +618,6 @@ public:
void Clear(void);
bool IsEmpty(void);
bool Equals(Selection *b);
bool IsStylable(void);
bool HasEndpoints(void);
};
Selection hover;