fix [#30266] B-Mesh: Issue with Weight Painting

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.
This commit is contained in:
Campbell Barton 2012-02-20 00:18:35 +00:00
parent 40c59b1a3d
commit 818e19713a
5 changed files with 17 additions and 4 deletions

View 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;
}

View 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;

View 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;

View 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

View 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);
}