Merged changes in the trunk up to revision 46557.
[blender-staging.git] / source / blender / editors / mesh / mesh_navmesh.c
index 3d57c5144de0b9d2b4a67aaa69fde7df12d2c6b6..14d20d684552d22551e716efe3bde5d55acf8a5e 100644 (file)
@@ -316,7 +316,8 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
        }
        else {
                obedit = base->object;
-               scene_select_base(scene, base);
+               BKE_scene_base_deselect_all(scene);
+               BKE_scene_base_select(scene, base);
                copy_v3_v3(obedit->loc, co);
                copy_v3_v3(obedit->rot, rot);
        }
@@ -430,7 +431,8 @@ static int navmesh_create_exec(bContext *C, wmOperator *op)
        LinkNode *obs = NULL;
        Base *navmeshBase = NULL;
 
-       CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+       CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
+       {
                if (base->object->type == OB_MESH) {
                        if (base->object->body_type == OB_BODY_TYPE_NAVMESH) {
                                if (!navmeshBase || base == scene->basact) {
@@ -500,7 +502,7 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
 
                        if (targetPolyIdx > 0) {
                                /* set target poly idx to other selected faces */
-                               BM_ITER (efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+                               BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                                        if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
                                                int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
                                                *recastDataBlock = targetPolyIdx;
@@ -549,7 +551,7 @@ static int findFreeNavPolyIndex(BMEditMesh *em)
        int i, idx = em->bm->totface - 1, freeIdx = 1;
 
        /*XXX this originally went last to first, but that isn't possible anymore*/
-       BM_ITER (ef, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+       BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
                int polyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
                indices[idx] = polyIdx;
                idx--;
@@ -585,7 +587,7 @@ static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
                        /* set target poly idx to selected faces */
                        /*XXX this originally went last to first, but that isn't possible anymore*/
                        
-                       BM_ITER (ef, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+                       BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
                                if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
                                        int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
                                        *recastDataBlock = targetPolyIdx;