diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-08 17:41:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-08 17:41:32 +0300 |
commit | 8f7c106e6488054b2572bf71935d67703b7c4c5e (patch) | |
tree | 23bd7f897a58ceb242f04a3f034d0db43ae919a4 /source/blender/editors | |
parent | 05af8dfe53728ed3276485fa04fcf9a592bdc203 (diff) |
Fix #20604: Make Normals Consistent (Ctrl N) doesn't respect selection.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_mods.c | 23 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index d7f421331e5..572cf214c6a 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1265,7 +1265,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se EM_select_flush(em); /* flushes vertex -> edge -> face selection */ if(type!=PRIM_PLANE && type!=PRIM_MONKEY) - righthandfaces(em, 1); /* otherwise monkey has eyes in wrong direction */ + EM_recalc_normal_direction(em, 0, 0); /* otherwise monkey has eyes in wrong direction */ BKE_mesh_end_editmesh(obedit->data, em); } diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 827b28f954b..dee831b7fd0 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -3800,8 +3800,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) /* **************** NORMALS ************** */ -/* XXX value of select is messed up, it means two things */ -void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning */ +void EM_recalc_normal_direction(EditMesh *em, int inside, int select) /* makes faces righthand turning */ { EditEdge *eed, *ed1, *ed2, *ed3, *ed4; EditFace *efa, *startvl; @@ -3893,16 +3892,12 @@ void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning * cent_tri_v3(cent, startvl->v1->co, startvl->v2->co, startvl->v3->co); } /* first normal is oriented this way or the other */ - if(select) { - if(select==2) { - if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] > 0.0) flipface(em, startvl); - } - else { - if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0) flipface(em, startvl); - } + if(inside) { + if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] > 0.0) flipface(em, startvl); + } + else { + if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0) flipface(em, startvl); } - else if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0) flipface(em, startvl); - eed= startvl->e1; if(eed->v1==startvl->v1) eed->f2= 1; @@ -4012,7 +4007,7 @@ void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning * } -static int righthandfaces_exec(bContext *C, wmOperator *op) +static int normals_make_consistent_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -4020,7 +4015,7 @@ static int righthandfaces_exec(bContext *C, wmOperator *op) /* 'standard' behaviour - check if selected, then apply relevant selection */ // XXX need other args - righthandfaces(em, RNA_boolean_get(op->ptr, "inside")); + EM_recalc_normal_direction(em, RNA_boolean_get(op->ptr, "inside"), 1); BKE_mesh_end_editmesh(obedit->data, em); @@ -4038,7 +4033,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot) ot->idname= "MESH_OT_normals_make_consistent"; /* api callbacks */ - ot->exec= righthandfaces_exec; + ot->exec= normals_make_consistent_exec; ot->poll= ED_operator_editmesh; /* flags */ diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 31e8cb16abc..94bdbdc73aa 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -172,7 +172,7 @@ void MESH_OT_select_nth(struct wmOperatorType *ot); extern EditEdge *findnearestedge(ViewContext *vc, int *dist); extern void EM_automerge(Scene *scene, Object *obedit, int update); void editmesh_select_by_material(EditMesh *em, int index); -void righthandfaces(EditMesh *em, int select); /* makes faces righthand turning */ +void EM_recalc_normal_direction(EditMesh *em, int inside, int select); /* makes faces righthand turning */ void EM_select_more(EditMesh *em); void selectconnected_mesh_all(EditMesh *em); void faceloop_select(EditMesh *em, EditEdge *startedge, int select); |