diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-10-24 15:16:37 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-11-01 12:48:18 +0300 |
commit | f17fbf80653dc0e1561b30fe03f46e354deb12bf (patch) | |
tree | 46003d781a1b9ca0272112a9a9c2cdf45482d640 /source/blender/editors/mesh/editmesh_extrude.c | |
parent | 8b2b5b0b8384c95d92da41297b1a950e729cd782 (diff) |
Refactor: Rename Object->obmat to Object->object_to_world
Motivation is to disambiguate on the naming level what the matrix
actually means. It is very easy to understand the meaning backwards,
especially since in Python the name goes the opposite way (it is
called `world_matrix` in the Python API).
It is important to disambiguate the naming without making developers
to look into the comment in the header file (which is also not super
clear either). Additionally, more clear naming facilitates the unit
verification (or, in this case, space validation) when reading an
expression.
This patch calls the matrix `object_to_world` which makes it clear
from the local code what is it exactly going on. This is only done
on DNA level, and a lot of local variables still follow the old
naming.
A DNA rename is setup in a way that there is no change on the file
level, so there should be no regressions at all.
The possibility is to add `_matrix` or `_mat` suffix to the name
to make it explicit that it is a matrix. Although, not sure if it
really helps the readability, or is it something redundant.
Differential Revision: https://developer.blender.org/D16328
Diffstat (limited to 'source/blender/editors/mesh/editmesh_extrude.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude.c | 12 |
1 files changed, 6 insertions, 6 deletions
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 */ |