fix [#27121] Normals always recalculated when adding a mesh in Edit mode
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Apr 2011 10:04:07 +0000 (10:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Apr 2011 10:04:07 +0000 (10:04 +0000)
source/blender/editors/mesh/editmesh_add.c

index b3492a5fb09dc1d158d9e6d6095e626b4145fa48..8365d88d0c80816774a722cd7383b1d7685a7d5b 100644 (file)
@@ -1081,6 +1081,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
                        }
                        eve= eve->next;
                }
                        }
                        eve= eve->next;
                }
+               recalc_editnormals(em);
                break;
                        
        case PRIM_UVSPHERE: /*  UVsphere */
                break;
                        
        case PRIM_UVSPHERE: /*  UVsphere */
@@ -1102,7 +1103,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
                        eve= addvertlist(em, vec, NULL);
                        eve->f= 1+2+4;
                        if(a==0) v1= eve;
                        eve= addvertlist(em, vec, NULL);
                        eve->f= 1+2+4;
                        if(a==0) v1= eve;
-                       else addedgelist(em, eve->prev, eve, NULL);
+                       else addedgelist(em, eve, eve->prev, NULL);
                        phi+= phid;
                }
                
                        phi+= phid;
                }
                
@@ -1128,6 +1129,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
                        }
                        eve= eve->next;
                }
                        }
                        eve= eve->next;
                }
+               recalc_editnormals(em);
                break;
        case PRIM_ICOSPHERE: /* Icosphere */
                {
                break;
        case PRIM_ICOSPHERE: /* Icosphere */
                {
@@ -1320,9 +1322,9 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
        EM_stats_update(em);
        /* simple selection flush OK, based on fact it's a single model */
        EM_select_flush(em); /* flushes vertex -> edge -> face selection */
        EM_stats_update(em);
        /* simple selection flush OK, based on fact it's a single model */
        EM_select_flush(em); /* flushes vertex -> edge -> face selection */
-       
-       if(type!=PRIM_PLANE && type!=PRIM_MONKEY)
-               EM_recalc_normal_direction(em, 0, 0);   /* otherwise monkey has eyes in wrong direction */
+
+       if(!ELEM5(type, PRIM_GRID, PRIM_PLANE, PRIM_ICOSPHERE, PRIM_UVSPHERE, PRIM_MONKEY))
+               EM_recalc_normal_direction(em, FALSE, TRUE);    /* otherwise monkey has eyes in wrong direction */
 
        BKE_mesh_end_editmesh(obedit->data, em);
 }
 
        BKE_mesh_end_editmesh(obedit->data, em);
 }