diff options
Diffstat (limited to 'source/blender/editors/mesh/mesh_navmesh.c')
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index b95921964eb..d7e59a05772 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -40,8 +40,8 @@ #include "BLI_math_vector.h" #include "BLI_linklist.h" +#include "BKE_layer.h" #include "BKE_library.h" -#include "BKE_depsgraph.h" #include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_scene.h" @@ -58,6 +58,8 @@ #include "recast-capi.h" +#include "DEG_depsgraph.h" + #include "mesh_intern.h" /* own include */ @@ -72,18 +74,21 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, LinkNode *oblink, *dmlink; DerivedMesh *dm; Scene *scene = CTX_data_scene(C); + EvaluationContext eval_ctx; LinkNode *dms = NULL; int nverts, ntris, *tris; float *verts; + CTX_data_eval_ctx(C, &eval_ctx); + nverts = 0; ntris = 0; /* calculate number of verts and tris */ for (oblink = obs; oblink; oblink = oblink->next) { ob = (Object *) oblink->link; - dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH); + dm = mesh_create_derived_no_virtual(&eval_ctx, scene, ob, NULL, CD_MASK_MESH); DM_ensure_tessface(dm); BLI_linklist_prepend(&dms, dm); @@ -333,7 +338,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, int i, j, k; unsigned short *v; int face[3]; - Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); Object *obedit; int createob = base == NULL; int nverts, nmeshes, nvp; @@ -351,8 +356,8 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, } else { obedit = base->object; - BKE_scene_base_deselect_all(scene); - BKE_scene_base_select(scene, base); + BKE_view_layer_base_deselect_all(view_layer); + BKE_view_layer_base_select(view_layer, base); copy_v3_v3(obedit->loc, co); copy_v3_v3(obedit->rot, rot); } @@ -440,7 +445,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, recast_destroyPolyMesh(pmesh); recast_destroyPolyMeshDetail(dmesh); - DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); + DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); @@ -461,6 +466,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, static int navmesh_create_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); LinkNode *obs = NULL; Base *navmeshBase = NULL; @@ -468,7 +474,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op) { if (base->object->type == OB_MESH) { if (base->object->body_type == OB_BODY_TYPE_NAVMESH) { - if (!navmeshBase || base == scene->basact) { + if (!navmeshBase || base == view_layer->basact) { navmeshBase = base; } } @@ -551,7 +557,7 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op) } } - DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); + DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; @@ -632,7 +638,7 @@ static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op)) } } - DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); + DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; @@ -681,7 +687,7 @@ static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op)) BKE_mesh_ensure_navmesh(me); - DAG_id_tag_update(&me->id, OB_RECALC_DATA); + DEG_id_tag_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id); return OPERATOR_FINISHED; @@ -709,7 +715,7 @@ static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op)) CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly); - DAG_id_tag_update(&me->id, OB_RECALC_DATA); + DEG_id_tag_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id); return OPERATOR_FINISHED; |