marked navmesh as BMESH_TODO, mixed mface/mpoly functions were being used for navmesh...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 13 Feb 2012 04:52:41 +0000 (04:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 13 Feb 2012 04:52:41 +0000 (04:52 +0000)
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/mesh.c
source/blender/editors/mesh/mesh_navmesh.c

index 8f9964d0cc311dc0049373431a215c8cd670b3b9..573edb78687b98d88727db74cb0fdd590a1a3452 100644 (file)
@@ -2715,6 +2715,15 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
 /* --- NAVMESH (begin) --- */
 #ifdef WITH_GAMEENGINE
 
+/* BMESH_TODO, navmesh is not working right currently
+ * All tools set this as MPoly data, but derived mesh currently draws from MFace (tessface)
+ *
+ * Proposed solution, rather then copy CD_RECAST into the MFace array,
+ * use ORIGINDEX to get the original poly index and then get the CD_RECAST
+ * data from the original me->mpoly layer. - campbell
+ */
+
+
 BM_INLINE int navmesh_bit(int a, int b)
 {
        return (a & (1 << b)) >> b;
index 4a4f5fa700e87d2c43697ac5ffd90b16f79b4bb1..2d3c4e8669b8fe13e626bd186be2b5538de131c4 100644 (file)
@@ -2936,16 +2936,16 @@ void mesh_translate(Mesh *me, float offset[3], int do_keys)
 
 void BKE_mesh_ensure_navmesh(Mesh *me)
 {
-       if (!CustomData_has_layer(&me->fdata, CD_RECAST)) {
+       if (!CustomData_has_layer(&me->pdata, CD_RECAST)) {
                int i;
-               int numFaces = me->totface;
+               int numFaces = me->totpoly;
                int* recastData;
-               CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
-               recastData = (int*)CustomData_get_layer(&me->fdata, CD_RECAST);
+               CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
+               recastData = (int*)CustomData_get_layer(&me->pdata, CD_RECAST);
                for (i=0; i<numFaces; i++) {
                        recastData[i] = i+1;
                }
-               CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
+               CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
        }
 }
 
index 9593e54acd72bc9021e50fb491e858e26bdd4cf3..99947cb9ae21dadafa26b895175f4172806a2d54 100644 (file)
@@ -618,7 +618,7 @@ static int navmesh_obmode_data_poll(bContext *C)
        Object *ob = ED_object_active_context(C);
        if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
                Mesh *me= ob->data;
-               return CustomData_has_layer(&me->fdata, CD_RECAST);
+               return CustomData_has_layer(&me->pdata, CD_RECAST);
        }
        return FALSE;
 }
@@ -637,7 +637,7 @@ static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
        Object *ob = ED_object_active_context(C);
        Mesh *me= ob->data;
 
-       CustomData_free_layers(&me->fdata, CD_RECAST, me->totface);
+       CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
 
        BKE_mesh_ensure_navmesh(me);
 
@@ -667,7 +667,7 @@ static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
        Object *ob = ED_object_active_context(C);
        Mesh *me= ob->data;
 
-       CustomData_free_layers(&me->fdata, CD_RECAST, me->totface);
+       CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
 
        DAG_id_tag_update(&me->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id);