[Bf-blender-cvs] [c128b30bd13] master: Edit Mesh: pass in Mesh instead of BMEditMesh to EDBM_update_generic

Campbell Barton noreply at git.blender.org
Tue Jan 7 12:18:35 CET 2020


Commit: c128b30bd13bbf48a701fe068fa27c1d21378515
Author: Campbell Barton
Date:   Tue Jan 7 22:11:19 2020 +1100
Branches: master
https://developer.blender.org/rBc128b30bd13bbf48a701fe068fa27c1d21378515

Edit Mesh: pass in Mesh instead of BMEditMesh to EDBM_update_generic

This avoids a list lookup in Main (recently added), passing in a mesh
instead of an edit-mesh, since the mesh links to the edit-mesh.

===================================================================

M	source/blender/editors/include/ED_mesh.h
M	source/blender/editors/mesh/editmesh_add.c
M	source/blender/editors/mesh/editmesh_add_gizmo.c
M	source/blender/editors/mesh/editmesh_automerge.c
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/editors/mesh/editmesh_bisect.c
M	source/blender/editors/mesh/editmesh_extrude.c
M	source/blender/editors/mesh/editmesh_extrude_screw.c
M	source/blender/editors/mesh/editmesh_extrude_spin.c
M	source/blender/editors/mesh/editmesh_inset.c
M	source/blender/editors/mesh/editmesh_intersect.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/mesh/editmesh_path.c
M	source/blender/editors/mesh/editmesh_polybuild.c
M	source/blender/editors/mesh/editmesh_rip.c
M	source/blender/editors/mesh/editmesh_rip_edge.c
M	source/blender/editors/mesh/editmesh_select.c
M	source/blender/editors/mesh/editmesh_select_similar.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/mesh/editmesh_utils.c
M	source/blender/editors/object/object_data_transform.c
M	source/blender/editors/uvedit/uvedit_ops.c
M	source/blender/python/bmesh/bmesh_py_api.c

===================================================================

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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list