fix [#30266] B-Mesh: Issue with Weight Painting
authorCampbell Barton <ideasman42@gmail.com>
Mon, 20 Feb 2012 00:18:35 +0000 (00:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 20 Feb 2012 00:18:35 +0000 (00:18 +0000)
thanks to Nicholas Bishop for finding the cause of the problem.

don't tesselate on load, this means me->mface will be NULL by default.

we may need to have this set if existing uses of this array are not resolved before release - so add a define USE_TESSFACE_DEFAULT, to change this easily.

this is a rather indirect fix - need to take care here.

source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/mesh/bmesh_utils.c
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesrna/intern/rna_mesh.c

index 981f9ce..5d21b36 100644 (file)
@@ -3703,7 +3703,11 @@ static void lib_link_mesh(FileData *fd, Main *main)
                         *    waiting until edit mode has been entered/exited, making it easier
                         *    to recognize problems that would otherwise only show up after edits).
                         */
+#ifdef USE_TESSFACE_DEFAULT
                        BKE_mesh_tessface_calc(me);
+#else
+                       BKE_mesh_tessface_clear(me);
+#endif
 
                        me->id.flag -= LIB_NEEDLINK;
                }
index f97a8e1..4f7fab7 100644 (file)
@@ -3262,7 +3262,8 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
        EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
 
        BM_mesh_normals_update(bmnew);
-       BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p", basenew->object->data, basenew->object);
+       BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p notesselation=%i",
+                    basenew->object->data, basenew->object, TRUE);
                
        BM_mesh_free(bmnew);
        ((Mesh *)basenew->object->data)->edit_btmesh = NULL;
index 29404a6..92011b4 100644 (file)
@@ -296,6 +296,11 @@ void EDBM_LoadEditBMesh(Scene *scene, Object *ob)
        BMesh *bm = me->edit_btmesh->bm;
 
        BMO_op_callf(bm, "object_load_bmesh scene=%p object=%p", scene, ob);
+
+#ifdef USE_TESSFACE_DEFAULT
+       BKE_mesh_tessface_calc(me);
+#endif
+
 }
 
 void EDBM_FreeEditBMesh(BMEditMesh *tm)
@@ -520,7 +525,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
 
 #endif
 
-       BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%i", &um->me, 1);
+       BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%i", &um->me, TRUE);
        um->selectmode = em->selectmode;
 
        return um;
index ae9a68f..290defa 100644 (file)
@@ -229,4 +229,7 @@ typedef struct TFace {
 #define USE_BMESH_SAVE_WITHOUT_MFACE
 
 
+/* enable this so meshes get tessfaces calculated by default */
+// #define USE_TESSFACE_DEFAULT
+
 #endif
index 4f5fc2a..7cb1fc4 100644 (file)
@@ -2074,7 +2074,7 @@ static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
        PropertyRNA *prop;
 
        FunctionRNA *func;
-       PropertyRNA *parm;
+       //PropertyRNA *parm;
 
        RNA_def_property_srna(cprop, "MeshPolygons");
        srna= RNA_def_struct(brna, "MeshPolygons", NULL);
@@ -2087,7 +2087,7 @@ static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
 
        func= RNA_def_function(srna, "add", "ED_mesh_polys_add");
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
-       parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
+       RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
 }