diff options
Diffstat (limited to 'source/blender/editors/mesh')
18 files changed, 68 insertions, 66 deletions
diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc index 888a8340d51..1c6d1747516 100644 --- a/source/blender/editors/mesh/editface.cc +++ b/source/blender/editors/mesh/editface.cc @@ -383,7 +383,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3]) return ok; } - copy_m3_m4(bmat, ob->obmat); + copy_m3_m4(bmat, ob->object_to_world); const Span<MVert> verts = me->verts(); const Span<MPoly> polys = me->polys(); @@ -403,7 +403,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3]) const MLoop *ml = &loops[poly.loopstart]; for (int b = 0; b < poly.totloop; b++, ml++) { mul_v3_m3v3(vec, bmat, verts[ml->v].co); - add_v3_v3v3(vec, vec, ob->obmat[3]); + add_v3_v3v3(vec, vec, ob->object_to_world[3]); minmax_v3v3_v3(r_min, r_max, vec); } diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index f5090c0143d..ad900c997f8 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -316,7 +316,7 @@ static int add_primitive_cube_gizmo_exec(bContext *C, wmOperator *op) PropertyRNA *prop_matrix = RNA_struct_find_property(op->ptr, "matrix"); if (RNA_property_is_set(op->ptr, prop_matrix)) { RNA_property_float_get_array(op->ptr, prop_matrix, &matrix[0][0]); - invert_m4_m4(obedit->imat, obedit->obmat); + invert_m4_m4(obedit->imat, obedit->object_to_world); mul_m4_m4m4(matrix, obedit->imat, matrix); } else { diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 3284cd70646..85801668510 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -244,7 +244,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__); for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) { Object *obedit = objects[ob_index]; - float scale = mat4_to_scale(obedit->obmat); + float scale = mat4_to_scale(obedit->object_to_world); opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale); BMEditMesh *em = BKE_editmesh_from_object(obedit); if (em->bm->totvertsel > 0) { diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 5c5a12b3e64..aab33678bec 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -314,9 +314,9 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op) copy_v3_v3(plane_co_local, plane_co); copy_v3_v3(plane_no_local, plane_no); - invert_m4_m4(imat, obedit->obmat); + invert_m4_m4(imat, obedit->object_to_world); mul_m4_v3(imat, plane_co_local); - mul_transposed_mat3_m4_v3(obedit->obmat, plane_no_local); + mul_transposed_mat3_m4_v3(obedit->object_to_world, plane_no_local); BMOperator bmop; EDBM_op_init( diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 55e9c32e41b..9df3a521cfa 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -55,8 +55,8 @@ static void edbm_extrude_edge_exclude_mirror( float mtx[4][4]; if (mmd->mirror_ob) { float imtx[4][4]; - invert_m4_m4(imtx, mmd->mirror_ob->obmat); - mul_m4_m4m4(mtx, imtx, obedit->obmat); + invert_m4_m4(imtx, mmd->mirror_ob->object_to_world); + mul_m4_m4m4(mtx, imtx, obedit->object_to_world); } BM_ITER_MESH (edge, &iter, bm, BM_EDGES_OF_MESH) { @@ -293,7 +293,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) Object *obedit = objects[ob_index]; BMEditMesh *em = BKE_editmesh_from_object(obedit); - copy_m3_m4(tmat, obedit->obmat); + copy_m3_m4(tmat, obedit->object_to_world); invert_m3(tmat); mul_v3_m3v3(offset_local, tmat, offset); @@ -736,7 +736,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w } mul_v3_fl(local_center, 1.0f / (float)local_verts_len); - mul_m4_v3(vc.obedit->obmat, local_center); + mul_m4_v3(vc.obedit->object_to_world, local_center); mul_v3_fl(local_center, (float)local_verts_len); add_v3_v3(center, local_center); @@ -761,7 +761,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w continue; } - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + invert_m4_m4(vc.obedit->imat, vc.obedit->object_to_world); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); float local_center[3]; @@ -823,7 +823,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w /* center */ copy_v3_v3(ofs, local_center); - mul_m4_v3(vc.obedit->obmat, ofs); /* view space */ + mul_m4_v3(vc.obedit->object_to_world, ofs); /* view space */ ED_view3d_win_to_3d_int(vc.v3d, vc.region, ofs, event->mval, ofs); mul_m4_v3(vc.obedit->imat, ofs); /* back in object space */ diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c index be2d04b14a1..9d0bcfe4e90 100644 --- a/source/blender/editors/mesh/editmesh_extrude_screw.c +++ b/source/blender/editors/mesh/editmesh_extrude_screw.c @@ -102,11 +102,11 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) continue; } - copy_v3_v3(nor, obedit->obmat[2]); + copy_v3_v3(nor, obedit->object_to_world[2]); /* calculate dvec */ - mul_v3_m4v3(v1_co_global, obedit->obmat, v1->co); - mul_v3_m4v3(v2_co_global, obedit->obmat, v2->co); + mul_v3_m4v3(v1_co_global, obedit->object_to_world, v1->co); + mul_v3_m4v3(v2_co_global, obedit->object_to_world, v2->co); sub_v3_v3v3(dvec, v1_co_global, v2_co_global); mul_v3_fl(dvec, 1.0f / steps); @@ -126,7 +126,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) dvec, turns * steps, DEG2RADF(360.0f * turns), - obedit->obmat, + obedit->object_to_world, false)) { continue; } diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index 1b9c98db5eb..756d7f73d10 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -77,7 +77,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) d, steps, -angle, - obedit->obmat, + obedit->object_to_world, use_normal_flip, dupli, use_auto_merge)) { diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c index 687f06c8dcf..19e23f4f212 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c @@ -362,7 +362,7 @@ static void gizmo_mesh_spin_init_refresh(const bContext *C, wmGizmoGroup *gzgrou } if (totsel) { mul_v3_fl(select_center, 1.0f / totsel); - mul_m4_v3(obedit->obmat, select_center); + mul_m4_v3(obedit->object_to_world, select_center); copy_v3_v3(ggd->data.select_center, select_center); ggd->data.use_select_center = true; } diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 068e6215c26..fa4ae7f984c 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -136,7 +136,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__); for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) { Object *obedit = objects[ob_index]; - float scale = mat4_to_scale(obedit->obmat); + float scale = mat4_to_scale(obedit->object_to_world); opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale); BMEditMesh *em = BKE_editmesh_from_object(obedit); if (em->bm->totvertsel > 0) { diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index a147594b25b..369162e80a3 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -586,9 +586,9 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd, float axis[3]; float arc_angle; - const float inverse_average_scale = 1 / - (kcd->curr.ob->obmat[0][0] + kcd->curr.ob->obmat[1][1] + - kcd->curr.ob->obmat[2][2]); + const float inverse_average_scale = 1 / (kcd->curr.ob->object_to_world[0][0] + + kcd->curr.ob->object_to_world[1][1] + + kcd->curr.ob->object_to_world[2][2]); const float px_scale = 3.0f * inverse_average_scale * @@ -1194,7 +1194,7 @@ static void knife_bm_tri_cagecos_get_worldspace(const KnifeTool_OpData *kcd, knife_bm_tri_cagecos_get(kcd, ob_index, tri_index, cos); const Object *ob = kcd->objects[ob_index]; for (int i = 0; i < 3; i++) { - mul_m4_v3(ob->obmat, cos[i]); + mul_m4_v3(ob->object_to_world, cos[i]); } } @@ -1744,7 +1744,7 @@ static KnifeVert *get_bm_knife_vert(KnifeTool_OpData *kcd, BMVert *v, Object *ob } float cageco_ws[3]; - mul_v3_m4v3(cageco_ws, ob->obmat, cageco); + mul_v3_m4v3(cageco_ws, ob->object_to_world, cageco); kfv = new_knife_vert(kcd, v->co, cageco_ws); kfv->v = v; @@ -2657,14 +2657,14 @@ static void calc_ortho_extent(KnifeTool_OpData *kcd) if (cagecos) { for (int i = 0; i < em->bm->totvert; i++) { copy_v3_v3(ws, cagecos[i]); - mul_m4_v3(ob->obmat, ws); + mul_m4_v3(ob->object_to_world, ws); minmax_v3v3_v3(min, max, ws); } } else { BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { copy_v3_v3(ws, v->co); - mul_m4_v3(ob->obmat, ws); + mul_m4_v3(ob->object_to_world, ws); minmax_v3v3_v3(min, max, ws); } } @@ -5072,7 +5072,7 @@ void EDBM_mesh_knife(ViewContext *vc, BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { float cent[3], cent_ss[2]; BM_face_calc_point_in_face(f, cent); - mul_m4_v3(ob->obmat, cent); + mul_m4_v3(ob->object_to_world, cent); knife_project_v2(kcd, cent, cent_ss); if (edbm_mesh_knife_point_isect(polys, cent_ss)) { BM_elem_flag_enable(f, BM_ELEM_TAG); @@ -5113,7 +5113,7 @@ void EDBM_mesh_knife(ViewContext *vc, if (found) { float cent[3], cent_ss[2]; BM_face_calc_point_in_face(f, cent); - mul_m4_v3(ob->obmat, cent); + mul_m4_v3(ob->object_to_world, cent); knife_project_v2(kcd, cent, cent_ss); if ((kcd->cut_through || point_is_visible(kcd, cent, cent_ss, (BMElem *)f)) && edbm_mesh_knife_point_isect(polys, cent_ss)) { diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 494e0ff4a27..9a91d7836fe 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -88,7 +88,7 @@ typedef struct RingSelOpData { static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg) { RingSelOpData *lcd = arg; - EDBM_preselect_edgering_draw(lcd->presel_edgering, lcd->ob->obmat); + EDBM_preselect_edgering_draw(lcd->presel_edgering, lcd->ob->object_to_world); } static void edgering_select(RingSelOpData *lcd) diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index bf9664fa10d..63e37b18827 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -124,7 +124,7 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C, BMEditMesh *em = vc.em; BMesh *bm = em->bm; - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + invert_m4_m4(vc.obedit->imat, vc.obedit->object_to_world); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); if (!ele_act) { @@ -192,7 +192,7 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C, BMEditMesh *em = vc.em; BMesh *bm = em->bm; - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + invert_m4_m4(vc.obedit->imat, vc.obedit->object_to_world); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); if (!ele_act) { @@ -286,7 +286,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con BMEditMesh *em = vc.em; BMesh *bm = em->bm; - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + invert_m4_m4(vc.obedit->imat, vc.obedit->object_to_world); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); edbm_selectmode_ensure(vc.scene, vc.em, SCE_SELECT_VERTEX); @@ -294,7 +294,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con if (ele_act == NULL || ele_act->head.htype == BM_FACE) { /* Just add vert */ copy_v3_v3(center, vc.scene->cursor.location); - mul_v3_m4v3(center, vc.obedit->obmat, center); + mul_v3_m4v3(center, vc.obedit->object_to_world, center); ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); @@ -309,7 +309,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con BMFace *f_reference = e_act->l ? e_act->l->f : NULL; mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co); - mul_m4_v3(vc.obedit->obmat, center); + mul_m4_v3(vc.obedit->object_to_world, center); ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); if (f_reference->len == 3 && RNA_boolean_get(op->ptr, "create_quads")) { @@ -364,7 +364,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con BMFace *f_reference = e_pair[0]->l ? e_pair[0]->l->f : NULL; - mul_v3_m4v3(center, vc.obedit->obmat, v_act->co); + mul_v3_m4v3(center, vc.obedit->object_to_world, v_act->co); ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); @@ -386,7 +386,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con } else { /* Just add edge */ - mul_m4_v3(vc.obedit->obmat, center); + mul_m4_v3(vc.obedit->object_to_world, center); ED_view3d_win_to_3d_int(vc.v3d, vc.region, v_act->co, event->mval, center); mul_m4_v3(vc.obedit->imat, center); @@ -464,7 +464,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C, BMEditMesh *em = vc.em; BMesh *bm = em->bm; - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + invert_m4_m4(vc.obedit->imat, vc.obedit->object_to_world); ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); edbm_selectmode_ensure(vc.scene, vc.em, SCE_SELECT_VERTEX); @@ -475,7 +475,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C, if (ele_act->head.htype == BM_EDGE) { BMEdge *e_act = (BMEdge *)ele_act; mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co); - mul_m4_v3(vc.obedit->obmat, center); + mul_m4_v3(vc.obedit->object_to_world, center); ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); diff --git a/source/blender/editors/mesh/editmesh_preselect_elem.c b/source/blender/editors/mesh/editmesh_preselect_elem.c index cf73e579700..732f39e4123 100644 --- a/source/blender/editors/mesh/editmesh_preselect_elem.c +++ b/source/blender/editors/mesh/editmesh_preselect_elem.c @@ -243,7 +243,7 @@ static void view3d_preselect_update_preview_triangle_from_vert(struct EditMesh_P } if (e_pair[1] != NULL) { - mul_v3_m4v3(center, vc->obedit->obmat, v_act->co); + mul_v3_m4v3(center, vc->obedit->object_to_world, v_act->co); ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center); mul_m4_v3(vc->obedit->imat, center); @@ -311,7 +311,7 @@ static void view3d_preselect_update_preview_triangle_from_edge(struct EditMesh_P psel->preview_tris = MEM_mallocN(sizeof(*psel->preview_tris), __func__); psel->preview_lines = MEM_mallocN(sizeof(*psel->preview_lines) * 3, __func__); mid_v3_v3v3(center, eed->v1->co, eed->v2->co); - mul_m4_v3(vc->obedit->obmat, center); + mul_m4_v3(vc->obedit->object_to_world, center); ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center); mul_m4_v3(vc->obedit->imat, center); diff --git a/source/blender/editors/mesh/editmesh_select.cc b/source/blender/editors/mesh/editmesh_select.cc index 76d0bab8a52..2ef2772d404 100644 --- a/source/blender/editors/mesh/editmesh_select.cc +++ b/source/blender/editors/mesh/editmesh_select.cc @@ -1060,7 +1060,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, float imat3[3][3]; ED_view3d_viewcontext_init_object(vc, obedit); - copy_m3_m4(imat3, obedit->obmat); + copy_m3_m4(imat3, obedit->object_to_world); invert_m3(imat3); const float(*coords)[3] = nullptr; @@ -1085,7 +1085,8 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, for (uint j = 0; j < 2; j++) { BMVert *v = *((&e->v1) + j); float point[3]; - mul_v3_m4v3(point, obedit->obmat, coords ? coords[BM_elem_index_get(v)] : v->co); + mul_v3_m4v3( + point, obedit->object_to_world, coords ? coords[BM_elem_index_get(v)] : v->co); const float dist_sq_test = dist_squared_to_ray_v3_normalized( ray_origin, ray_direction, point); if (dist_sq_test < dist_sq_best_vert) { @@ -1114,7 +1115,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, else { mid_v3_v3v3(point, e->v1->co, e->v2->co); } - mul_m4_v3(obedit->obmat, point); + mul_m4_v3(obedit->object_to_world, point); const float dist_sq_test = dist_squared_to_ray_v3_normalized( ray_origin, ray_direction, point); if (dist_sq_test < dist_sq_best_edge) { @@ -1139,7 +1140,8 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == false) { float point[3]; - mul_v3_m4v3(point, obedit->obmat, coords ? coords[BM_elem_index_get(v)] : v->co); + mul_v3_m4v3( + point, obedit->object_to_world, coords ? coords[BM_elem_index_get(v)] : v->co); const float dist_sq_test = dist_squared_to_ray_v3_normalized( ray_origin, ray_direction, point); if (dist_sq_test < dist_sq_best_vert) { @@ -1169,7 +1171,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, else { mid_v3_v3v3(point, e->v1->co, e->v2->co); } - mul_m4_v3(obedit->obmat, point); + mul_m4_v3(obedit->object_to_world, point); const float dist_sq_test = dist_squared_to_ray_v3_normalized( ray_origin, ray_direction, point); if (dist_sq_test < dist_sq_best_edge) { @@ -1198,7 +1200,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, else { BM_face_calc_center_median(f, point); } - mul_m4_v3(obedit->obmat, point); + mul_m4_v3(obedit->object_to_world, point); const float dist_sq_test = dist_squared_to_ray_v3_normalized( ray_origin, ray_direction, point); if (dist_sq_test < dist_sq_best_face) { @@ -4947,7 +4949,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) { float vertex_world[3]; - mul_v3_m4v3(vertex_world, obedit->obmat, v_act->co); + mul_v3_m4v3(vertex_world, obedit->object_to_world, v_act->co); value = dot_v3v3(axis_vector, vertex_world); } @@ -4977,7 +4979,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN | BM_ELEM_SELECT)) { float v_iter_world[3]; - mul_v3_m4v3(v_iter_world, obedit_iter->obmat, v->co); + mul_v3_m4v3(v_iter_world, obedit_iter->object_to_world, v->co); const float value_iter = dot_v3v3(axis_vector, v_iter_world); switch (sign) { case SELECT_AXIS_ALIGN: diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c index 47c76b7709b..9469639718f 100644 --- a/source/blender/editors/mesh/editmesh_select_similar.c +++ b/source/blender/editors/mesh/editmesh_select_similar.c @@ -137,7 +137,7 @@ static void face_to_plane(const Object *ob, BMFace *face, float r_plane[4]) copy_v3_v3(normal, face->no); mul_transposed_mat3_m4_v3(ob->imat, normal); normalize_v3(normal); - mul_v3_m4v3(co, ob->obmat, BM_FACE_FIRST_LOOP(face)->v->co); + mul_v3_m4v3(co, ob->object_to_world, BM_FACE_FIRST_LOOP(face)->v->co); plane_from_point_normal_v3(r_plane, co, normal); } @@ -206,7 +206,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(ob); BMesh *bm = em->bm; Material ***material_array = NULL; - invert_m4_m4(ob->imat, ob->obmat); + invert_m4_m4(ob->imat, ob->object_to_world); int custom_data_offset = 0; if (bm->totfacesel == 0) { @@ -214,7 +214,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) } float ob_m3[3][3]; - copy_m3_m4(ob_m3, ob->obmat); + copy_m3_m4(ob_m3, ob->object_to_world); switch (type) { case SIMFACE_MATERIAL: { @@ -335,7 +335,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) int custom_data_offset; float ob_m3[3][3]; - copy_m3_m4(ob_m3, ob->obmat); + copy_m3_m4(ob_m3, ob->object_to_world); bool has_custom_data_layer = false; switch (type) { @@ -559,8 +559,8 @@ static void edge_pos_direction_worldspace_get(Object *ob, BMEdge *edge, float *r copy_v3_v3(v1, edge->v1->co); copy_v3_v3(v2, edge->v2->co); - mul_m4_v3(ob->obmat, v1); - mul_m4_v3(ob->obmat, v2); + mul_m4_v3(ob->object_to_world, v1); + mul_m4_v3(ob->object_to_world, v2); sub_v3_v3v3(r_dir, v1, v2); normalize_v3(r_dir); @@ -586,8 +586,8 @@ static float edge_length_squared_worldspace_get(Object *ob, BMEdge *edge) { float v1[3], v2[3]; - mul_v3_mat3_m4v3(v1, ob->obmat, edge->v1->co); - mul_v3_mat3_m4v3(v2, ob->obmat, edge->v2->co); + mul_v3_mat3_m4v3(v1, ob->object_to_world, edge->v1->co); + mul_v3_mat3_m4v3(v2, ob->object_to_world, edge->v2->co); return len_squared_v3v3(v1, v2); } @@ -705,7 +705,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) } float ob_m3[3][3], ob_m3_inv[3][3]; - copy_m3_m4(ob_m3, ob->obmat); + copy_m3_m4(ob_m3, ob->object_to_world); invert_m3_m3(ob_m3_inv, ob_m3); BMEdge *edge; /* Mesh edge. */ @@ -812,7 +812,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) } float ob_m3[3][3], ob_m3_inv[3][3]; - copy_m3_m4(ob_m3, ob->obmat); + copy_m3_m4(ob_m3, ob->object_to_world); invert_m3_m3(ob_m3_inv, ob_m3); BMEdge *edge; /* Mesh edge. */ @@ -1028,7 +1028,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op) BLI_bitmap *defbase_selected = NULL; int defbase_len = 0; - invert_m4_m4(ob->imat, ob->obmat); + invert_m4_m4(ob->imat, ob->object_to_world); if (bm->totvertsel == 0) { continue; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 9f3ef8af17d..9f5c0d74ced 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3356,7 +3356,7 @@ static bool merge_target(BMEditMesh *em, if (use_cursor) { vco = scene->cursor.location; copy_v3_v3(co, vco); - invert_m4_m4(ob->imat, ob->obmat); + invert_m4_m4(ob->imat, ob->object_to_world); mul_m4_v3(ob->imat, co); } else { @@ -6684,7 +6684,7 @@ static void sort_bmelem_flag(bContext *C, int coidx = (action == SRT_VIEW_ZAXIS) ? 2 : 0; /* Apply the view matrix to the object matrix. */ - mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat); + mul_m4_m4m4(mat, rv3d->viewmat, ob->object_to_world); if (totelem[0]) { pb = pblock[0] = MEM_callocN(sizeof(char) * totelem[0], "sort_bmelem vert pblock"); @@ -6753,7 +6753,7 @@ static void sort_bmelem_flag(bContext *C, copy_v3_v3(cur, scene->cursor.location); - invert_m4_m4(mat, ob->obmat); + invert_m4_m4(mat, ob->object_to_world); mul_m4_v3(mat, cur); if (totelem[0]) { diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 4fc44f01ea0..10acfc96ca8 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1858,7 +1858,7 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, ED_view3d_win_to_segment_clipped(depsgraph, region, v3d, mval_f, origin, end, false); - invert_m4_m4(invmat, obedit->obmat); + invert_m4_m4(invmat, obedit->object_to_world); mul_m4_v3(invmat, origin); copy_v3_v3(co1, e->v1->co); diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc index 4d75ab7f041..147c26e521f 100644 --- a/source/blender/editors/mesh/meshtools.cc +++ b/source/blender/editors/mesh/meshtools.cc @@ -132,7 +132,7 @@ static void join_mesh_single(Depsgraph *depsgraph, float cmat[4][4]; /* Watch this: switch matrix multiplication order really goes wrong. */ - mul_m4_m4m4(cmat, imat, ob_src->obmat); + mul_m4_m4m4(cmat, imat, ob_src->object_to_world); /* transform vertex coordinates into new space */ for (a = 0; a < me->totvert; a++, mvert++) { @@ -386,7 +386,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) * NOTE: This doesn't apply recursive parenting. */ if (join_parent) { ob->parent = nullptr; - BKE_object_apply_mat4_ex(ob, ob->obmat, ob->parent, ob->parentinv, false); + BKE_object_apply_mat4_ex(ob, ob->object_to_world, ob->parent, ob->parentinv, false); } /* that way the active object is always selected */ @@ -594,7 +594,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) /* Inverse transform for all selected meshes in this object, * See #object_join_exec for detailed comment on why the safe version is used. */ - invert_m4_m4_safe_ortho(imat, ob->obmat); + invert_m4_m4_safe_ortho(imat, ob->object_to_world); /* Add back active mesh first. * This allows to keep things similar as they were, as much as possible |