code cleanup: redundant includes and add minor comments.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 8 Oct 2013 20:18:38 +0000 (20:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 8 Oct 2013 20:18:38 +0000 (20:18 +0000)
15 files changed:
source/blender/blenlib/BLI_linklist_stack.h
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/operators/bmo_bridge.c
source/blender/bmesh/operators/bmo_connect.c
source/blender/bmesh/operators/bmo_connect_nonplanar.c
source/blender/bmesh/operators/bmo_dupe.c
source/blender/bmesh/operators/bmo_edgenet.c
source/blender/bmesh/operators/bmo_fill_attribute.c
source/blender/bmesh/operators/bmo_fill_holes.c
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_symmetrize.c
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/editors/object/object_vgroup.c

index ca05088..c9fb00e 100644 (file)
        (void)&(_##var##_type); \
 } (void)0
 
-#include "BLI_alloca.h"
-
 /** \} */
 
 #endif  /* __BLI_LINKLIST_STACK_H__ */
index 0b14cf2..8441a6e 100644 (file)
@@ -2282,7 +2282,8 @@ BMVert *bmesh_urmv(BMesh *bm, BMFace *f_sep, BMVert *v_sep)
 
 /**
  * Avoid calling this where possible,
- * low level function for swapping faces.
+ * low level function so both face pointers remain intact but point to swapped data.
+ * \note must be from the same bmesh.
  */
 void bmesh_face_swap_data(BMesh *bm, BMFace *f_a, BMFace *f_b)
 {
index d11ae82..1dfd253 100644 (file)
@@ -30,8 +30,6 @@
 
 #include "DNA_listBase.h"
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_alloca.h"
 #include "BLI_math.h"
 #include "BLI_memarena.h"
@@ -833,10 +831,6 @@ void BM_face_triangulate(BMesh *bm, BMFace *f,
                f_new = BM_face_split(bm, f, l_first->v, l_first->next->next->v, &l_new, NULL, false);
                copy_v3_v3(f_new->no, f->no);
 
-               if (UNLIKELY(!l_new || !f_new)) {
-                       fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__);
-               }
-
                if (use_tag) {
                        BM_elem_flag_enable(l_new->e, BM_ELEM_TAG);
                        BM_elem_flag_enable(f, BM_ELEM_TAG);
@@ -905,13 +899,15 @@ void BM_face_triangulate(BMesh *bm, BMFace *f,
                                BM_elem_flag_enable(l_new->e, BM_ELEM_TAG);
                        }
 
+                       /* add all but the last face which is swapped and removed (below) */
                        if (r_faces_new && sf_tri->prev) {
                                r_faces_new[nf_i++] = f_new;
                        }
                }
 
                if (sf_ctx.fillfacebase.first) {
-                       /* we can't delete the real face, so swap data and delete */
+                       /* we can't delete the real face, because some of the callers expect it to remain valid.
+                        * so swap data and delete the last created tri */
                        bmesh_face_swap_data(bm, f, f_new);
                        BM_face_kill(bm, f_new);
 
index 9dfbf95..10d15d9 100644 (file)
@@ -26,8 +26,6 @@
  * Connect verts across faces (splits faces) and bridge tool.
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_listbase.h"
index b3a42ba..d0f64eb 100644 (file)
@@ -26,8 +26,6 @@
  * Connect verts across faces (splits faces).
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_alloca.h"
index 6108559..bd7a625 100644 (file)
@@ -26,8 +26,6 @@
  * Connect verts non-planer faces iteratively (splits faces).
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_alloca.h"
index bd2485b..a5c34f7 100644 (file)
@@ -26,8 +26,6 @@
  * Duplicate, Split, Split operators.
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_math.h"
 #include "BLI_alloca.h"
 
index fdee80b..de41bc7 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_listbase.h"
 #include "BLI_math.h"
 #include "BLI_array.h"
-#include "BLI_alloca.h"
-#include "BLI_smallhash.h"
-#include "BLI_rand.h"
-#include "BLI_heap.h"
 
 #include "bmesh.h"
 #include "bmesh_tools.h"
index f53b453..fa77e6b 100644 (file)
@@ -27,8 +27,6 @@
  * Fill in geometry with the attributes of their adjacent data.
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_linklist_stack.h"
 
index 8160d28..eadfbdb 100644 (file)
@@ -26,8 +26,6 @@
  * Fill boundary edge loop(s) with faces.
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_utildefines.h"
 
 #include "bmesh.h"
index 20cd828..e20556a 100644 (file)
@@ -31,7 +31,6 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_math.h"
-#include "BLI_array.h"
 #include "BLI_alloca.h"
 #include "BLI_memarena.h"
 #include "BKE_customdata.h"
index 4b538dc..74f8809 100644 (file)
@@ -26,9 +26,6 @@
  * Makes the mesh symmetrical by splitting along an axis and duplicating the geometry.
  */
 
-
-#include "MEM_guardedalloc.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
 
index 590b5ea..ca45289 100644 (file)
@@ -26,7 +26,6 @@
  * Triangulate faces, also defines triangle fill.
  */
 
-#include "MEM_guardedalloc.h"
 #include "DNA_listBase.h"
 
 #include "BLI_math.h"
index e23358b..c89fee7 100644 (file)
@@ -32,7 +32,6 @@
 #include "DNA_meshdata_types.h"
 
 #include "BLI_math.h"
-#include "BLI_heap.h"
 #include "BLI_alloca.h"
 
 #include "BKE_customdata.h"
index 82454ba..b0d8845 100644 (file)
@@ -47,6 +47,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_particle_types.h"
 
+#include "BLI_alloca.h"
 #include "BLI_array.h"
 #include "BLI_math.h"
 #include "BLI_blenlib.h"