Revision: 41911
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41911
Author:   campbellbarton
Date:     2011-11-16 12:56:33 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
fix for error in last commit, also make BM_ElemIndex_Validate() check dirty 
flag and complain if its set when it didnt need to be (this function isnt 
called yet)

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c     
2011-11-16 12:47:37 UTC (rev 41910)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c     
2011-11-16 12:56:33 UTC (rev 41911)
@@ -522,7 +522,7 @@
 
 /* array checking/setting macros */
 /* currently vert/edge/loop/face index data is being abused, but we should
- * eventually be able to rely on it being valid. To this end are macro's
+ * eventually be able to rely on it being valid. To this end, there are macros
  * that validate them (so blender doesnt crash), but also print errors so we 
can
  * fix the offending parts of the code, this way after some months we can
  * confine this code for debug mode.
@@ -536,12 +536,14 @@
        BMHeader *ele;
        int types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
        const char *type_names[3]= {"vert", "edge", "face"};
+       const char type_flags[3]= {BM_VERT, BM_EDGE, BM_FACE};
        int i;
        int is_any_error= 0;
 
        for (i=0; i<3; i++) {
+               const int is_dirty= (type_flags[i] & bm->elem_index_dirty);
                int index= 0;
-               int is_error= 0;
+               int is_error= FALSE;
                int err_val= 0;
                int err_idx= 0;
 
@@ -549,19 +551,25 @@
                        if (BM_GetIndex(ele) != index) {
                                err_val= BM_GetIndex(ele);
                                err_idx= index;
-                               is_error= 1;
+                               is_error= TRUE;
                        }
 
                        BM_SetIndex(ele, index); /* set_ok */
                        index++;
                }
 
-               if (is_error) {
-                       is_any_error= 1;
+               if ((is_error == TRUE) && (is_dirty == FALSE)) {
+                       is_any_error= TRUE;
                        fprintf(stderr,
                                "Invalid Index: at %s, %s, %s[%d] invalid index 
%d, '%s', '%s'\n",
                                location, func, type_names[i], err_idx, 
err_val, msg_a, msg_b);
                }
+               else if ((is_error == FALSE) && (is_dirty == TRUE)) {
+                       /* dirty may have been incorrectly set */
+                       fprintf(stderr,
+                               "Invalid Dirty: at %s, %s (%s), dirty flag was 
set but all index values are correct, '%s', '%s'\n",
+                               location, func, type_names[i], msg_a, msg_b);
+               }
        }
 
 #ifdef DEBUG

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c  
2011-11-16 12:47:37 UTC (rev 41910)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c  
2011-11-16 12:56:33 UTC (rev 41911)
@@ -1599,7 +1599,7 @@
 
                maxindex++;
        }
-       em->bm->elem_index_dirty |= BM_EDGE;
+       bm->elem_index_dirty |= BM_EDGE;
 
        /* Make enough verts to split v for each group */
        verts = MEM_callocN(sizeof(BMVert *) * maxindex, "bmesh_cutvert");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to