Edit Mesh: use params arg for update function, add calc_normals arg
Rename function EDBM_update_generic to EDBM_update, use a parameters argument for better readability. Also add calc_normals argument, which will have benefits when calculating normals and tessellation together is optimized.
This commit is contained in:
@@ -103,7 +103,14 @@ 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 Mesh *me, const bool do_tessellation, const bool is_destructive);
|
||||
struct EDBMUpdate_Params {
|
||||
uint calc_looptri : 1;
|
||||
uint calc_normals : 1;
|
||||
uint is_destructive : 1;
|
||||
};
|
||||
|
||||
void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params);
|
||||
void EDBM_update_extern(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,
|
||||
|
||||
@@ -95,7 +95,12 @@ 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(obedit->data, !exit_editmode, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = !exit_editmode,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
/* userdef */
|
||||
if (exit_editmode) {
|
||||
|
||||
@@ -357,7 +357,12 @@ static int add_primitive_cube_gizmo_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,12 @@ 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(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +139,12 @@ void EDBM_automerge_and_split(Object *obedit,
|
||||
#endif
|
||||
|
||||
if (LIKELY(ok) && update) {
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -403,9 +403,12 @@ static bool edbm_bevel_calc(wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
changed = true;
|
||||
}
|
||||
return changed;
|
||||
@@ -454,7 +457,12 @@ 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(obedit->data, false, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -383,7 +383,12 @@ 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(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
EDBM_selectmode_flush(em);
|
||||
ret = OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -319,9 +319,12 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
|
||||
em->bm, BMO_FLAG_DEFAULTS, "translate vec=%v verts=%hv", offset_local, BM_ELEM_SELECT);
|
||||
}
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -448,11 +451,13 @@ static int edbm_extrude_region_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
/* This normally happens when pushing undo but modal operators
|
||||
* like this one don't push undo data until after modal mode is
|
||||
* done.*/
|
||||
EDBM_mesh_normals_update(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
* like this one don't push undo data until after modal mode is done. */
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -502,13 +507,15 @@ static int edbm_extrude_context_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
edbm_extrude_mesh(obedit, em, op);
|
||||
|
||||
/* This normally happens when pushing undo but modal operators
|
||||
* like this one don't push undo data until after modal mode is
|
||||
* done.*/
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
* like this one don't push undo data until after modal mode is done.*/
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -555,7 +562,12 @@ static int edbm_extrude_verts_exec(bContext *C, wmOperator *op)
|
||||
|
||||
edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -603,7 +615,12 @@ 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(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -651,7 +668,12 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
|
||||
|
||||
edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -884,11 +906,13 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
|
||||
}
|
||||
|
||||
/* This normally happens when pushing undo but modal operators
|
||||
* like this one don't push undo data until after modal mode is
|
||||
* done. */
|
||||
EDBM_mesh_normals_update(vc.em);
|
||||
|
||||
EDBM_update_generic(vc.obedit->data, true, true);
|
||||
* like this one don't push undo data until after modal mode is done. */
|
||||
EDBM_update(vc.obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
||||
|
||||
@@ -155,7 +155,12 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
|
||||
@@ -108,7 +108,12 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -236,7 +236,12 @@ static void edbm_inset_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(obedit->data, false, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +331,12 @@ static bool edbm_inset_calc(wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
changed = true;
|
||||
}
|
||||
return changed;
|
||||
|
||||
@@ -116,8 +116,12 @@ static void edbm_intersect_select(BMEditMesh *em, struct Mesh *me, bool do_selec
|
||||
}
|
||||
}
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(me, true, true);
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -963,8 +967,12 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
#endif
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
#ifdef USE_NET_ISLAND_CONNECT
|
||||
/* we may have remaining isolated regions remaining,
|
||||
@@ -1068,8 +1076,12 @@ 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(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
BLI_stack_free(edges_loose);
|
||||
|
||||
@@ -2805,8 +2805,12 @@ static void knifetool_finish_ex(KnifeTool_OpData *kcd)
|
||||
knife_make_cuts(kcd);
|
||||
|
||||
EDBM_selectmode_flush(kcd->em);
|
||||
EDBM_mesh_normals_update(kcd->em);
|
||||
EDBM_update_generic(kcd->ob->data, true, true);
|
||||
EDBM_update(kcd->ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
/* Re-tessellating makes this invalid, don't use again by accident. */
|
||||
knifetool_free_bmbvh(kcd);
|
||||
|
||||
@@ -209,7 +209,12 @@ 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(lcd->ob->data, true, true);
|
||||
EDBM_update(lcd->ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
if (is_single) {
|
||||
/* de-select endpoints */
|
||||
|
||||
@@ -270,7 +270,12 @@ static void mouse_mesh_shortest_path_vert(Scene *UNUSED(scene),
|
||||
}
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -474,7 +479,12 @@ static void mouse_mesh_shortest_path_edge(Scene *scene,
|
||||
}
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
|
||||
if (op_params->edge_mode == EDGE_MODE_TAG_SEAM) {
|
||||
ED_uvedit_live_unwrap(scene, &obedit, 1);
|
||||
@@ -591,7 +601,12 @@ static void mouse_mesh_shortest_path_face(Scene *UNUSED(scene),
|
||||
BM_mesh_active_face_set(bm, f_dst_last);
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -154,8 +154,12 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C,
|
||||
BM_face_select_set(bm, (BMFace *)ele_act, true);
|
||||
}
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(vc.obedit->data, true, true);
|
||||
EDBM_update(vc.obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
if (basact != NULL) {
|
||||
if (vc.view_layer->basact != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
@@ -237,8 +241,12 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C,
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(vc.obedit->data, true, true);
|
||||
EDBM_update(vc.obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
if (basact != NULL) {
|
||||
if (vc.view_layer->basact != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
@@ -400,8 +408,12 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(vc.obedit->data, true, true);
|
||||
EDBM_update(vc.obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
if (basact != NULL) {
|
||||
if (vc.view_layer->basact != basact) {
|
||||
@@ -488,8 +500,12 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(vc.obedit->data, true, true);
|
||||
EDBM_update(vc.obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
WM_event_add_mousemove(vc.win);
|
||||
|
||||
@@ -578,8 +594,12 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C,
|
||||
if (changed) {
|
||||
edbm_flag_disable_all_multi(vc.view_layer, vc.v3d, BM_ELEM_SELECT);
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
EDBM_update_generic(vc.obedit->data, true, true);
|
||||
EDBM_update(vc.obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
if (vc.view_layer->basact != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
|
||||
@@ -1082,7 +1082,12 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
error_rip_failed = false;
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -223,7 +223,12 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
|
||||
|
||||
BM_mesh_select_mode_flush(bm);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4270,7 +4270,12 @@ 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(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -497,7 +497,12 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (changed) {
|
||||
EDBM_selectmode_flush(em);
|
||||
EDBM_update_generic(ob->data, false, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +524,12 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
EDBM_selectmode_flush(em);
|
||||
EDBM_update_generic(ob->data, false, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,7 +927,12 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (changed) {
|
||||
EDBM_selectmode_flush(em);
|
||||
EDBM_update_generic(ob->data, false, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -939,7 +954,12 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
EDBM_selectmode_flush(em);
|
||||
EDBM_update_generic(ob->data, false, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1213,7 +1233,12 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (changed) {
|
||||
EDBM_selectmode_flush(em);
|
||||
EDBM_update_generic(ob->data, false, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,12 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
|
||||
false,
|
||||
seed);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -324,7 +329,12 @@ static int edbm_subdivide_edge_ring_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -384,7 +394,12 @@ static int edbm_unsubdivide_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
EDBM_selectmode_flush(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -499,7 +514,12 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
||||
@@ -628,7 +648,12 @@ static int edbm_delete_loose_exec(bContext *C, wmOperator *op)
|
||||
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
int totelem_new[3];
|
||||
@@ -686,7 +711,12 @@ static int edbm_collapse_edge_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -971,7 +1001,12 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
changed_multi = true;
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
@@ -1047,7 +1082,12 @@ 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];
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -1117,7 +1157,12 @@ static int edbm_mark_sharp_exec(bContext *C, wmOperator *op)
|
||||
BM_elem_flag_set(eed, BM_ELEM_SMOOTH, clear);
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -1239,7 +1284,12 @@ static bool edbm_connect_vert_pair(BMEditMesh *em, struct Mesh *me, wmOperator *
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(bm, false);
|
||||
|
||||
EDBM_update_generic(me, true, true);
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
MEM_freeN(verts);
|
||||
@@ -1538,7 +1588,12 @@ static int edbm_vert_connect_path_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
else {
|
||||
failed_selection_order_len++;
|
||||
@@ -1603,7 +1658,12 @@ 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(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -1657,7 +1717,12 @@ static int edbm_vert_connect_nonplaner_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -1726,7 +1791,12 @@ static int edbm_face_make_planar_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -1775,7 +1845,12 @@ static bool edbm_edge_split_selected_edges(wmOperator *op, Object *obedit, BMEdi
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_select_flush(em);
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1845,7 +1920,12 @@ static bool edbm_edge_split_selected_verts(wmOperator *op, Object *obedit, BMEdi
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_select_flush(em);
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1958,7 +2038,12 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
|
||||
if (!EDBM_op_finish(em, &bmop, op, true)) {
|
||||
continue;
|
||||
}
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2114,7 +2199,12 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
|
||||
lnor_ed->clnors_data);
|
||||
}
|
||||
BM_loop_normal_editdata_array_free(lnors_ed_arr);
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -2133,7 +2223,12 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (flip_custom_normals(em->bm, lnors_ed_arr) || has_flipped_faces) {
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
if (lnors_ed_arr != NULL) {
|
||||
@@ -2255,7 +2350,12 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2341,7 +2441,12 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (EDBM_mesh_hide(em, unselected)) {
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -2392,7 +2497,12 @@ 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(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
@@ -2458,7 +2568,12 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2570,7 +2685,12 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
|
||||
EDBM_verts_mirror_cache_end(em);
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2694,7 +2814,12 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
|
||||
EDBM_verts_mirror_cache_end(em);
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2787,7 +2912,12 @@ static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
|
||||
mesh_set_smooth_faces(em, 1);
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2830,7 +2960,12 @@ static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
|
||||
mesh_set_smooth_faces(em, 0);
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -2887,7 +3022,12 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -2920,7 +3060,12 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op)
|
||||
if (!EDBM_op_finish(em, &bmop, op, true)) {
|
||||
continue;
|
||||
}
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -2958,7 +3103,12 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* dependencies graph and notification stuff */
|
||||
EDBM_update_generic(ob->data, false, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -2994,7 +3144,12 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -3243,7 +3398,12 @@ static int edbm_merge_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
/* once collapsed, we can't have edge/face selection */
|
||||
if ((em->selectmode & SCE_SELECT_VERTEX) == 0) {
|
||||
@@ -3422,7 +3582,12 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (count) {
|
||||
count_multi += count;
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
@@ -3522,7 +3687,12 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
|
||||
tot_shapekeys++;
|
||||
}
|
||||
|
||||
EDBM_update_generic(me, false, false);
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -3644,7 +3814,12 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
|
||||
interp_v3_v3v3(eve->co, eve->co, co, blend);
|
||||
}
|
||||
}
|
||||
EDBM_update_generic(me, true, false);
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
@@ -3781,7 +3956,12 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -4113,7 +4293,12 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -4516,7 +4701,12 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (retval) {
|
||||
EDBM_update_generic(base->object->data, true, true);
|
||||
EDBM_update(base->object->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
MEM_freeN(bases);
|
||||
@@ -4664,7 +4854,12 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -4958,7 +5153,12 @@ static int edbm_fill_grid_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -5030,7 +5230,12 @@ static int edbm_fill_holes_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -5113,7 +5318,12 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -5197,9 +5407,12 @@ static int edbm_poke_face_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -5301,7 +5514,12 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -5413,7 +5631,12 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -5597,7 +5820,12 @@ static int edbm_decimate_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
EDBM_selectmode_flush_ex(em, selectmode);
|
||||
}
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -5736,7 +5964,12 @@ static int edbm_dissolve_verts_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -5797,7 +6030,12 @@ static int edbm_dissolve_edges_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -5858,7 +6096,12 @@ static int edbm_dissolve_faces_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -6003,7 +6246,12 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_custom_loop_normals_from_vector_layer(em->bm, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -6090,7 +6338,12 @@ 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(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
|
||||
totelem_new[0] += bm->totvert;
|
||||
totelem_new[1] += bm->totedge;
|
||||
@@ -6181,7 +6434,12 @@ static int edbm_delete_edgeloop_exec(bContext *C, wmOperator *op)
|
||||
|
||||
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -6242,10 +6500,13 @@ static int edbm_split_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Geometry has changed, need to recalc normals and looptris */
|
||||
EDBM_mesh_normals_update(em);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
/* Geometry has changed, need to recalculate normals and tessellation. */
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -7085,7 +7346,12 @@ static int edbm_bridge_edge_loops_for_single_editmesh(wmOperator *op,
|
||||
}
|
||||
|
||||
if (EDBM_op_finish(em, &bmop, op, true)) {
|
||||
EDBM_update_generic(me, true, true);
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
/* Always return finished so the user can select different options. */
|
||||
@@ -7220,7 +7486,12 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -7311,7 +7582,12 @@ static int edbm_offset_edgeloop_exec(bContext *C, wmOperator *op)
|
||||
em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
|
||||
|
||||
if (EDBM_op_finish(em, &bmop, op, true)) {
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
changed_multi = true;
|
||||
}
|
||||
}
|
||||
@@ -7441,7 +7717,12 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
EDBM_selectmode_flush(em);
|
||||
}
|
||||
|
||||
@@ -7529,7 +7810,12 @@ static int mesh_symmetrize_exec(bContext *C, wmOperator *op)
|
||||
if (!EDBM_op_finish(em, &bmop, op, true)) {
|
||||
continue;
|
||||
}
|
||||
EDBM_update_generic(obedit->data, true, true);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = true,
|
||||
});
|
||||
EDBM_selectmode_flush(em);
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
@@ -7671,7 +7957,12 @@ static int mesh_symmetry_snap_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
}
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
|
||||
/* No need to end cache, just free the array. */
|
||||
MEM_freeN(index);
|
||||
@@ -8347,7 +8638,12 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
|
||||
|
||||
if (point_normals_ensure(C, op)) {
|
||||
point_normals_apply(C, op, target, do_reset);
|
||||
EDBM_update_generic(obedit->data, true, false); /* Recheck bools. */
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
}); /* Recheck bools. */
|
||||
point_normals_update_header(C, op);
|
||||
}
|
||||
else {
|
||||
@@ -8404,7 +8700,12 @@ static int edbm_point_normals_exec(bContext *C, wmOperator *op)
|
||||
|
||||
point_normals_apply(C, op, target, false);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
point_normals_cancel(C, op);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -8663,7 +8964,12 @@ static int normals_split_merge(bContext *C, const bool do_merge)
|
||||
BM_loop_normal_editdata_array_free(lnors_ed_arr);
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -8875,7 +9181,12 @@ static int edbm_average_normals_exec(bContext *C, wmOperator *op)
|
||||
} while ((l_curr = l_curr->next) != l_first);
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
BLI_heapsimple_free(loop_weight, NULL);
|
||||
@@ -9126,7 +9437,12 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BM_loop_normal_editdata_array_free(lnors_ed_arr);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -9280,7 +9596,12 @@ static int edbm_set_normals_from_faces_exec(bContext *C, wmOperator *op)
|
||||
|
||||
MEM_freeN(loop_set);
|
||||
MEM_freeN(vnors);
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -9388,7 +9709,12 @@ static int edbm_smooth_normals_exec(bContext *C, wmOperator *op)
|
||||
BM_loop_normal_editdata_array_free(lnors_ed_arr);
|
||||
MEM_freeN(smooth_normal);
|
||||
|
||||
EDBM_update_generic(obedit->data, true, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
@@ -9477,7 +9803,12 @@ static int edbm_mod_weighted_strength_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
EDBM_update_generic(obedit->data, false, false);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = false,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
MEM_freeN(objects);
|
||||
|
||||
@@ -1439,20 +1439,25 @@ void EDBM_stats_update(BMEditMesh *em)
|
||||
}
|
||||
}
|
||||
|
||||
/* so many tools call these that we better make it a generic function.
|
||||
/**
|
||||
* So many tools call these that we better make it a generic function.
|
||||
*/
|
||||
void EDBM_update_generic(Mesh *mesh, const bool do_tessellation, const bool is_destructive)
|
||||
void EDBM_update(Mesh *mesh, const struct EDBMUpdate_Params *params)
|
||||
{
|
||||
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) {
|
||||
if (params->calc_normals) {
|
||||
EDBM_mesh_normals_update(em);
|
||||
}
|
||||
|
||||
if (params->calc_looptri) {
|
||||
BKE_editmesh_looptri_calc(em);
|
||||
}
|
||||
|
||||
if (is_destructive) {
|
||||
if (params->is_destructive) {
|
||||
/* TODO. we may be able to remove this now! - Campbell */
|
||||
// BM_mesh_elem_table_free(em->bm, BM_ALL_NOLOOP);
|
||||
}
|
||||
@@ -1477,6 +1482,17 @@ void EDBM_update_generic(Mesh *mesh, const bool do_tessellation, const bool is_d
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Bad level call from Python API. */
|
||||
void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool is_destructive)
|
||||
{
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = do_tessellation,
|
||||
.calc_normals = false,
|
||||
.is_destructive = is_destructive,
|
||||
});
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -745,8 +745,12 @@ 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, true, false);
|
||||
EDBM_mesh_normals_update(me->edit_mesh);
|
||||
EDBM_update(me,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = true,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
|
||||
break;
|
||||
|
||||
@@ -1469,7 +1469,12 @@ 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(ob->data, true, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -1607,7 +1612,12 @@ 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(ob->data, true, false);
|
||||
EDBM_update(ob->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
.calc_normals = false,
|
||||
.is_destructive = false,
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -147,10 +147,10 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
|
||||
}
|
||||
|
||||
{
|
||||
extern void EDBM_update_generic(
|
||||
extern void EDBM_update_extern(
|
||||
struct Mesh * me, const bool do_tessface, const bool is_destructive);
|
||||
|
||||
EDBM_update_generic(me, do_loop_triangles, is_destructive);
|
||||
EDBM_update_extern(me, do_loop_triangles, is_destructive);
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
||||
Reference in New Issue
Block a user