diff options
Diffstat (limited to 'source/blender')
24 files changed, 136 insertions, 142 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 1153944068e..95d6d5cab3b 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -104,9 +104,7 @@ bool EDBM_vert_color_check(struct BMEditMesh *em); bool EDBM_mesh_hide(struct BMEditMesh *em, bool swap); bool EDBM_mesh_reveal(struct BMEditMesh *em, bool select); -void EDBM_update_generic(struct BMEditMesh *em, - const bool do_tessellation, - const bool is_destructive); +void EDBM_update_generic(struct Mesh *me, const bool do_tessellation, const bool is_destructive); struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, const struct Scene *scene, diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index a7d1e54ad59..7a0124e72bb 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -92,7 +92,7 @@ static void make_prim_finish(bContext *C, EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); /* only recalc editmode tessface if we are staying in editmode */ - EDBM_update_generic(em, !exit_editmode, true); + EDBM_update_generic(obedit->data, !exit_editmode, true); /* userdef */ if (exit_editmode) { diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index 66832ceba7f..c748560ae1b 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -357,7 +357,7 @@ static int add_primitive_cube_gizmo_exec(bContext *C, wmOperator *op) } EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/editmesh_automerge.c b/source/blender/editors/mesh/editmesh_automerge.c index 55b52e01fc3..ffde9f338b4 100644 --- a/source/blender/editors/mesh/editmesh_automerge.c +++ b/source/blender/editors/mesh/editmesh_automerge.c @@ -79,7 +79,7 @@ void EDBM_automerge(Object *obedit, bool update, const char hflag, const float d BMO_op_finish(bm, &weldop); if ((totvert_prev != bm->totvert) && update) { - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } } @@ -189,7 +189,7 @@ void EDBM_automerge_and_split(Object *obedit, #endif if (LIKELY(ok) && update) { - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } } diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 710fbf9f693..b2b1e1ff4f5 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -406,7 +406,7 @@ static bool edbm_bevel_calc(wmOperator *op) EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); changed = true; } return changed; @@ -446,7 +446,7 @@ static void edbm_bevel_cancel(bContext *C, wmOperator *op) Object *obedit = opdata->ob_store[ob_index].ob; BMEditMesh *em = BKE_editmesh_from_object(obedit); EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, em, true); - EDBM_update_generic(em, false, true); + EDBM_update_generic(obedit->data, false, true); } } diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 4a511bbb5a2..0bf9688888b 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -384,7 +384,7 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op) bm, bmop.slots_out, "geom_cut.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, true); if (EDBM_op_finish(em, &bmop, op, true)) { - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); EDBM_selectmode_flush(em); ret = OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 5496362024d..b653484322a 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -306,7 +306,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -427,7 +427,7 @@ static int edbm_extrude_region_exec(bContext *C, wmOperator *op) * done.*/ EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); return OPERATOR_FINISHED; @@ -482,7 +482,7 @@ static int edbm_extrude_context_exec(bContext *C, wmOperator *op) EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); return OPERATOR_FINISHED; @@ -528,7 +528,7 @@ static int edbm_extrude_verts_exec(bContext *C, wmOperator *op) edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -576,7 +576,7 @@ static int edbm_extrude_edges_exec(bContext *C, wmOperator *op) edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, use_normal_flip); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -624,7 +624,7 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op) edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -861,7 +861,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w * done. */ EDBM_mesh_normals_update(vc.em); - EDBM_update_generic(vc.em, true, true); + EDBM_update_generic(vc.obedit->data, true, true); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c index 252f95a10ac..ef393acdb4e 100644 --- a/source/blender/editors/mesh/editmesh_extrude_screw.c +++ b/source/blender/editors/mesh/editmesh_extrude_screw.c @@ -155,7 +155,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index 7cad7e1e062..f19a988809a 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -111,7 +111,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 1413e0db41d..9e004f3e289 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -51,7 +51,8 @@ #include "mesh_intern.h" /* own include */ typedef struct { - BMEditMesh *em; + /** Must have a valid edit-mesh. */ + Object *ob; BMBackup mesh_backup; } InsetObjectStore; @@ -141,7 +142,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale); BMEditMesh *em = BKE_editmesh_from_object(obedit); if (em->bm->totvertsel > 0) { - opdata->ob_store[objects_used_len].em = em; + opdata->ob_store[objects_used_len].ob = obedit; objects_used_len++; } } @@ -167,8 +168,9 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) ARegion *ar = CTX_wm_region(C); for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { - opdata->ob_store[ob_index].mesh_backup = EDBM_redo_state_store( - opdata->ob_store[ob_index].em); + Object *obedit = opdata->ob_store[ob_index].ob; + BMEditMesh *em = BKE_editmesh_from_object(obedit); + opdata->ob_store[ob_index].mesh_backup = EDBM_redo_state_store(em); } opdata->draw_handle_pixel = ED_region_draw_cb_activate( @@ -218,9 +220,10 @@ static void edbm_inset_cancel(bContext *C, wmOperator *op) opdata = op->customdata; if (opdata->is_modal) { for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { - EDBM_redo_state_free( - &opdata->ob_store[ob_index].mesh_backup, opdata->ob_store[ob_index].em, true); - EDBM_update_generic(opdata->ob_store[ob_index].em, false, true); + Object *obedit = opdata->ob_store[ob_index].ob; + BMEditMesh *em = BKE_editmesh_from_object(obedit); + EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, em, true); + EDBM_update_generic(obedit->data, false, true); } } @@ -233,7 +236,6 @@ static void edbm_inset_cancel(bContext *C, wmOperator *op) static bool edbm_inset_calc(wmOperator *op) { InsetData *opdata; - BMEditMesh *em; BMOperator bmop; bool changed = false; @@ -252,7 +254,8 @@ static bool edbm_inset_calc(wmOperator *op) opdata = op->customdata; for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { - em = opdata->ob_store[ob_index].em; + Object *obedit = opdata->ob_store[ob_index].ob; + BMEditMesh *em = BKE_editmesh_from_object(obedit); if (opdata->is_modal) { EDBM_redo_state_restore(opdata->ob_store[ob_index].mesh_backup, em, false); @@ -310,7 +313,7 @@ static bool edbm_inset_calc(wmOperator *op) continue; } else { - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); changed = true; } } diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c index ec740447f93..847a8ecacc3 100644 --- a/source/blender/editors/mesh/editmesh_intersect.c +++ b/source/blender/editors/mesh/editmesh_intersect.c @@ -101,7 +101,7 @@ static int bm_face_isect_pair_swap(BMFace *f, void *UNUSED(user_data)) /** * Use for intersect and boolean. */ -static void edbm_intersect_select(BMEditMesh *em, bool do_select) +static void edbm_intersect_select(BMEditMesh *em, struct Mesh *me, bool do_select) { if (do_select) { BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); @@ -119,7 +119,7 @@ static void edbm_intersect_select(BMEditMesh *em, bool do_select) } EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(me, true, true); } /* -------------------------------------------------------------------- */ @@ -212,7 +212,7 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op) em->bm, BM_elem_cb_check_hflag_enabled_simple(const BMFace *, BM_ELEM_SELECT)); } - edbm_intersect_select(em, has_isect); + edbm_intersect_select(em, obedit->data, has_isect); if (!has_isect) { isect_len++; @@ -318,7 +318,7 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op) boolean_operation, eps); - edbm_intersect_select(em, has_isect); + edbm_intersect_select(em, obedit->data, has_isect); if (!has_isect) { isect_len++; @@ -847,7 +847,7 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op)) #endif EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); #ifdef USE_NET_ISLAND_CONNECT /* we may have remaining isolated regions remaining, @@ -952,7 +952,7 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op)) BLI_ghash_free(face_edge_map, NULL, NULL); EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } BLI_stack_free(edges_loose); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 1b6827dac87..bad24eaa47c 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2564,7 +2564,7 @@ static void knifetool_finish_ex(KnifeTool_OpData *kcd) EDBM_selectmode_flush(kcd->em); EDBM_mesh_normals_update(kcd->em); - EDBM_update_generic(kcd->em, true, true); + EDBM_update_generic(kcd->ob->data, true, true); /* re-tessellating makes this invalid, dont use again by accident */ knifetool_free_bmbvh(kcd); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 3c3e91e8afe..fd5f35e7596 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -197,7 +197,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) /* when used in a macro the tessfaces will be recalculated anyway, * this is needed here because modifiers depend on updated tessellation, see T45920 */ - EDBM_update_generic(em, true, true); + EDBM_update_generic(lcd->ob->data, true, true); if (is_single) { /* de-select endpoints */ diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 06c41b78c37..e09bcaf4edc 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -270,7 +270,7 @@ static void mouse_mesh_shortest_path_vert(Scene *UNUSED(scene), } } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } /** \} */ @@ -474,7 +474,7 @@ static void mouse_mesh_shortest_path_edge(Scene *scene, } } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); if (op_params->edge_mode == EDGE_MODE_TAG_SEAM) { ED_uvedit_live_unwrap(scene, &obedit, 1); @@ -591,7 +591,7 @@ static void mouse_mesh_shortest_path_face(Scene *UNUSED(scene), BM_mesh_active_face_set(bm, f_dst_last); } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } /** \} */ diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index a91f0f9274e..781e77de34a 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -155,7 +155,7 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C, } EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(vc.obedit->data, true, true); if (basact != NULL) { if (vc.view_layer->basact != basact) { ED_object_base_activate(C, basact); @@ -238,7 +238,7 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C, if (changed) { EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(vc.obedit->data, true, true); if (basact != NULL) { if (vc.view_layer->basact != basact) { ED_object_base_activate(C, basact); @@ -403,7 +403,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con if (changed) { EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(vc.obedit->data, true, true); if (basact != NULL) { if (vc.view_layer->basact != basact) { @@ -493,7 +493,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C, if (changed) { EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(vc.obedit->data, true, true); WM_event_add_mousemove(C); @@ -586,7 +586,7 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C, edbm_flag_disable_all_multi(vc.view_layer, vc.v3d, BM_ELEM_SELECT); EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(vc.obedit->data, true, true); if (vc.view_layer->basact != basact) { ED_object_base_activate(C, basact); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index ffdb434405e..71bf77cc788 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -1075,7 +1075,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event) } error_rip_failed = false; - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); diff --git a/source/blender/editors/mesh/editmesh_rip_edge.c b/source/blender/editors/mesh/editmesh_rip_edge.c index 61253f06f9f..5dd3c85f34f 100644 --- a/source/blender/editors/mesh/editmesh_rip_edge.c +++ b/source/blender/editors/mesh/editmesh_rip_edge.c @@ -223,7 +223,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve BM_mesh_select_mode_flush(bm); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } } diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index ebd8d50cfc3..ffbcacafd44 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -4223,7 +4223,7 @@ static int edbm_select_nth_exec(bContext *C, wmOperator *op) if (edbm_deselect_nth(em, &op_params) == true) { found_active_elt = true; - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } } MEM_freeN(objects); diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c index 2782cc92aca..cee048b9513 100644 --- a/source/blender/editors/mesh/editmesh_select_similar.c +++ b/source/blender/editors/mesh/editmesh_select_similar.c @@ -497,7 +497,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) if (changed) { EDBM_selectmode_flush(em); - EDBM_update_generic(em, false, false); + EDBM_update_generic(ob->data, false, false); } } @@ -519,7 +519,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) } } EDBM_selectmode_flush(em); - EDBM_update_generic(em, false, false); + EDBM_update_generic(ob->data, false, false); } } @@ -917,7 +917,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) if (changed) { EDBM_selectmode_flush(em); - EDBM_update_generic(em, false, false); + EDBM_update_generic(ob->data, false, false); } } @@ -939,7 +939,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) } } EDBM_selectmode_flush(em); - EDBM_update_generic(em, false, false); + EDBM_update_generic(ob->data, false, false); } } @@ -1186,7 +1186,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op) if (changed) { EDBM_selectmode_flush(em); - EDBM_update_generic(em, false, false); + EDBM_update_generic(ob->data, false, false); } } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 54605f4cb68..de0aa513da0 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -133,7 +133,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op) false, seed); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -325,7 +325,7 @@ static int edbm_subdivide_edge_ring_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -385,7 +385,7 @@ static int edbm_unsubdivide_exec(bContext *C, wmOperator *op) } EDBM_selectmode_flush(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -534,7 +534,7 @@ static int edbm_delete_exec(bContext *C, wmOperator *op) EDBM_flag_disable_all(em, BM_ELEM_SELECT); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); DEG_id_tag_update(obedit->data, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); @@ -663,7 +663,7 @@ static int edbm_delete_loose_exec(bContext *C, wmOperator *op) EDBM_flag_disable_all(em, BM_ELEM_SELECT); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } int totelem_new[3]; @@ -721,7 +721,7 @@ static int edbm_collapse_edge_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -1004,7 +1004,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); changed_multi = true; } MEM_freeN(objects); @@ -1080,8 +1080,7 @@ static int edbm_mark_seam_exec(bContext *C, wmOperator *op) for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *obedit = objects[ob_index]; - BMEditMesh *em = BKE_editmesh_from_object(obedit); - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -1151,7 +1150,7 @@ static int edbm_mark_sharp_exec(bContext *C, wmOperator *op) BM_elem_flag_set(eed, BM_ELEM_SMOOTH, clear); } - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -1185,7 +1184,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -static bool edbm_connect_vert_pair(BMEditMesh *em, wmOperator *op) +static bool edbm_connect_vert_pair(BMEditMesh *em, struct Mesh *me, wmOperator *op) { BMesh *bm = em->bm; BMOperator bmop; @@ -1264,7 +1263,7 @@ static bool edbm_connect_vert_pair(BMEditMesh *em, wmOperator *op) /* so newly created edges get the selection state from the vertex */ EDBM_selectmode_flush(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(me, true, true); } } MEM_freeN(verts); @@ -1284,7 +1283,7 @@ static int edbm_vert_connect_exec(bContext *C, wmOperator *op) Object *obedit = objects[ob_index]; BMEditMesh *em = BKE_editmesh_from_object(obedit); - if (!edbm_connect_vert_pair(em, op)) { + if (!edbm_connect_vert_pair(em, obedit->data, op)) { failed_objects_len++; } } @@ -1541,7 +1540,7 @@ static int edbm_vert_connect_path_exec(bContext *C, wmOperator *op) /* when there is only 2 vertices, we can ignore selection order */ if (is_pair) { - if (!edbm_connect_vert_pair(em, op)) { + if (!edbm_connect_vert_pair(em, obedit->data, op)) { failed_connect_len++; } continue; @@ -1558,7 +1557,7 @@ static int edbm_vert_connect_path_exec(bContext *C, wmOperator *op) if (bm_vert_connect_select_history(bm)) { EDBM_selectmode_flush(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } else { failed_selection_order_len++; @@ -1617,7 +1616,7 @@ static int edbm_vert_connect_concave_exec(bContext *C, wmOperator *op) em, op, "faces.out", true, "connect_verts_concave faces=%hf", BM_ELEM_SELECT)) { continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -1671,7 +1670,7 @@ static int edbm_vert_connect_nonplaner_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -1740,7 +1739,7 @@ static int edbm_face_make_planar_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -1794,7 +1793,7 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op) EDBM_select_flush(em); } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -1863,7 +1862,7 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op) if (!EDBM_op_finish(em, &bmop, op, true)) { continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -1920,7 +1919,7 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -2031,7 +2030,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -2117,7 +2116,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op) } if (EDBM_mesh_hide(em, unselected)) { - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); changed = true; } } @@ -2168,7 +2167,7 @@ static int edbm_reveal_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(obedit); if (EDBM_mesh_reveal(em, select)) { - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } } MEM_freeN(objects); @@ -2221,7 +2220,7 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op) EDBM_op_callf(em, op, "reverse_faces faces=%hf flip_multires=%b", BM_ELEM_SELECT, true); } - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -2335,7 +2334,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) EDBM_verts_mirror_cache_end(em); } - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -2459,7 +2458,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) EDBM_verts_mirror_cache_end(em); } - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -2552,7 +2551,7 @@ static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op)) } mesh_set_smooth_faces(em, 1); - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } MEM_freeN(objects); @@ -2595,7 +2594,7 @@ static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op)) } mesh_set_smooth_faces(em, 0); - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } MEM_freeN(objects); @@ -2652,7 +2651,7 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } MEM_freeN(objects); @@ -2685,7 +2684,7 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op) if (!EDBM_op_finish(em, &bmop, op, true)) { continue; } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } MEM_freeN(objects); @@ -2723,7 +2722,7 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op) } /* dependencies graph and notification stuff */ - EDBM_update_generic(em, false, false); + EDBM_update_generic(ob->data, false, false); } MEM_freeN(objects); @@ -2739,8 +2738,8 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op) view_layer, CTX_wm_view3d(C), &objects_len); for (uint ob_index = 0; ob_index < objects_len; ob_index++) { - Object *ob = objects[ob_index]; - BMEditMesh *em = BKE_editmesh_from_object(ob); + Object *obedit = objects[ob_index]; + BMEditMesh *em = BKE_editmesh_from_object(obedit); if (em->bm->totfacesel == 0) { continue; @@ -2759,7 +2758,7 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } MEM_freeN(objects); @@ -3003,7 +3002,7 @@ static int edbm_merge_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); /* once collapsed, we can't have edge/face selection */ if ((em->selectmode & SCE_SELECT_VERTEX) == 0) { @@ -3176,7 +3175,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) if (count) { count_multi += count; - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } } MEM_freeN(objects); @@ -3270,7 +3269,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op) tot_shapekeys++; } - EDBM_update_generic(em, false, false); + EDBM_update_generic(me, false, false); } MEM_freeN(objects); @@ -3396,7 +3395,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) interp_v3_v3v3(eve->co, eve->co, co, blend); } } - EDBM_update_generic(em, true, false); + EDBM_update_generic(me, true, false); } } MEM_freeN(objects); @@ -3532,7 +3531,7 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -3861,7 +3860,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); return OPERATOR_FINISHED; } @@ -4259,7 +4258,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) } if (retval) { - EDBM_update_generic(em, true, true); + EDBM_update_generic(base->object->data, true, true); } } MEM_freeN(bases); @@ -4406,7 +4405,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -4679,7 +4678,7 @@ static int edbm_fill_grid_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -4751,7 +4750,7 @@ static int edbm_fill_holes_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -4834,7 +4833,7 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -4920,7 +4919,7 @@ static int edbm_poke_face_exec(bContext *C, wmOperator *op) EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5018,7 +5017,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5126,7 +5125,7 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5310,7 +5309,7 @@ static int edbm_decimate_exec(bContext *C, wmOperator *op) } EDBM_selectmode_flush_ex(em, selectmode); } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5446,7 +5445,7 @@ static int edbm_dissolve_verts_exec(bContext *C, wmOperator *op) use_boundary_tear)) { continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5503,7 +5502,7 @@ static int edbm_dissolve_edges_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5560,7 +5559,7 @@ static int edbm_dissolve_faces_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5703,7 +5702,7 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) use_dissolve_boundaries, delimit); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5790,7 +5789,7 @@ static int edbm_dissolve_degenerate_exec(bContext *C, wmOperator *op) /* tricky to maintain correct selection here, so just flush up from verts */ EDBM_select_flush(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); totelem_new[0] += bm->totvert; totelem_new[1] += bm->totedge; @@ -5881,7 +5880,7 @@ static int edbm_delete_edgeloop_exec(bContext *C, wmOperator *op) EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -5941,7 +5940,7 @@ static int edbm_split_exec(bContext *C, wmOperator *op) /* Geometry has changed, need to recalc normals and looptris */ EDBM_mesh_normals_update(em); - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -6683,6 +6682,7 @@ static int edbm_bridge_tag_boundary_edges(BMesh *bm) static int edbm_bridge_edge_loops_for_single_editmesh(wmOperator *op, BMEditMesh *em, + struct Mesh *me, const bool use_pairs, const bool use_cyclic, const bool use_merge, @@ -6784,7 +6784,7 @@ static int edbm_bridge_edge_loops_for_single_editmesh(wmOperator *op, } if (EDBM_op_finish(em, &bmop, op, true)) { - EDBM_update_generic(em, true, true); + EDBM_update_generic(me, true, true); } /* Always return finished so the user can select different options. */ @@ -6813,7 +6813,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) } edbm_bridge_edge_loops_for_single_editmesh( - op, em, use_pairs, use_cyclic, use_merge, merge_factor, twist_offset); + op, em, obedit->data, use_pairs, use_cyclic, use_merge, merge_factor, twist_offset); } MEM_freeN(objects); return OPERATOR_FINISHED; @@ -6919,7 +6919,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -7030,7 +7030,7 @@ static int edbm_offset_edgeloop_exec(bContext *C, wmOperator *op) continue; } else { - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); ret = OPERATOR_FINISHED; } } @@ -7147,7 +7147,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) continue; } - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); EDBM_selectmode_flush(em); } @@ -7236,7 +7236,7 @@ static int mesh_symmetrize_exec(bContext *C, wmOperator *op) continue; } else { - EDBM_update_generic(em, true, true); + EDBM_update_generic(obedit->data, true, true); EDBM_selectmode_flush(em); } } @@ -7379,7 +7379,7 @@ static int mesh_symmetry_snap_exec(bContext *C, wmOperator *op) } } } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); /* No need to end cache, just free the array. */ MEM_freeN(index); @@ -8027,7 +8027,7 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent * RNA_property_float_set_array(op->ptr, prop_target, target); } point_normals_apply(C, op, target, do_reset); - EDBM_update_generic(em, true, false); /* Recheck bools. */ + EDBM_update_generic(obedit->data, true, false); /* Recheck bools. */ point_normals_update_header(C, op); } @@ -8058,7 +8058,6 @@ static int edbm_point_normals_invoke(bContext *C, wmOperator *op, const wmEvent static int edbm_point_normals_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); if (!point_normals_init(C, op, NULL)) { point_normals_free(C, op); @@ -8073,7 +8072,7 @@ static int edbm_point_normals_exec(bContext *C, wmOperator *op) point_normals_apply(C, op, target, false); - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); point_normals_free(C, op); return OPERATOR_FINISHED; @@ -8325,7 +8324,7 @@ static int normals_split_merge(bContext *C, const bool do_merge) BM_loop_normal_editdata_array_free(lnors_ed_arr); } - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -8531,7 +8530,7 @@ static int edbm_average_normals_exec(bContext *C, wmOperator *op) } BLI_heapsimple_free(loop_weight, NULL); - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -8778,7 +8777,7 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op) BM_loop_normal_editdata_array_free(lnors_ed_arr); - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -8926,7 +8925,7 @@ static int edbm_set_normals_from_faces_exec(bContext *C, wmOperator *op) MEM_freeN(loop_set); MEM_freeN(vnors); - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -9028,7 +9027,7 @@ static int edbm_smoothen_normals_exec(bContext *C, wmOperator *op) BM_loop_normal_editdata_array_free(lnors_ed_arr); MEM_freeN(smooth_normal); - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } MEM_freeN(objects); @@ -9117,7 +9116,7 @@ static int edbm_mod_weighted_strength_exec(bContext *C, wmOperator *op) } } - EDBM_update_generic(em, false, false); + EDBM_update_generic(obedit->data, false, false); } MEM_freeN(objects); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index e3883ea04d4..96fa31e17e9 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1421,18 +1421,12 @@ void EDBM_stats_update(BMEditMesh *em) /* so many tools call these that we better make it a generic function. */ -void EDBM_update_generic(BMEditMesh *em, const bool do_tessellation, const bool is_destructive) +void EDBM_update_generic(Mesh *mesh, const bool do_tessellation, const bool is_destructive) { - /* FIXME: pass in mesh. */ - Main *bmain = G_MAIN; - for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) { - if (mesh->edit_mesh == em) { - /* Order of calling isn't important. */ - DEG_id_tag_update(&mesh->id, ID_RECALC_GEOMETRY); - WM_main_add_notifier(NC_GEOM | ND_DATA, &mesh->id); - break; - } - } + BMEditMesh *em = mesh->edit_mesh; + /* Order of calling isn't important. */ + DEG_id_tag_update(&mesh->id, ID_RECALC_GEOMETRY); + WM_main_add_notifier(NC_GEOM | ND_DATA, &mesh->id); if (do_tessellation) { BKE_editmesh_looptri_calc(em); diff --git a/source/blender/editors/object/object_data_transform.c b/source/blender/editors/object/object_data_transform.c index 29b0cb88935..97191374bdc 100644 --- a/source/blender/editors/object/object_data_transform.c +++ b/source/blender/editors/object/object_data_transform.c @@ -538,7 +538,7 @@ void ED_object_data_xform_tag_update(struct XFormObjectData *xod_base) case ID_ME: { Mesh *me = (Mesh *)xod_base->id; if (xod_base->is_edit_mode) { - EDBM_update_generic(me->edit_mesh, true, false); + EDBM_update_generic(me, true, false); EDBM_mesh_normals_update(me->edit_mesh); } DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 18b43bcf460..d74bb048404 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -4657,7 +4657,7 @@ static int uv_hide_exec(bContext *C, wmOperator *op) if (ts->uv_flag & UV_SYNC_SELECTION) { if (EDBM_mesh_hide(em, swap)) { - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } return OPERATOR_FINISHED; } @@ -4785,7 +4785,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op) /* call the mesh function if we are in mesh sync sel */ if (ts->uv_flag & UV_SYNC_SELECTION) { if (EDBM_mesh_reveal(em, select)) { - EDBM_update_generic(em, true, false); + EDBM_update_generic(obedit->data, true, false); } return OPERATOR_FINISHED; } diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index 8ab5e7adea7..7f5b10e6759 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -148,9 +148,9 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, { extern void EDBM_update_generic( - BMEditMesh * em, const bool do_tessface, const bool is_destructive); + struct Mesh * me, const bool do_tessface, const bool is_destructive); - EDBM_update_generic(me->edit_mesh, do_loop_triangles, is_destructive); + EDBM_update_generic(me, do_loop_triangles, is_destructive); } Py_RETURN_NONE; |