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/sculpt_paint/paint_cursor.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/sculpt_paint/paint_cursor.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 71ec444098e..b85b878af7d 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1071,7 +1071,7 @@ static void cursor_draw_tiling_preview(const uint gpuattr, for (int dim = 0; dim < 3; dim++) { location[dim] = cur[dim] * step[dim] + orgLoc[dim]; } - cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3); + cursor_draw_point_screen_space(gpuattr, region, location, ob->object_to_world, 3); } } } @@ -1092,7 +1092,7 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, /* Axis Symmetry. */ flip_v3_v3(location, true_location, (char)i); - cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3); + cursor_draw_point_screen_space(gpuattr, region, location, ob->object_to_world, 3); /* Tiling. */ cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius); @@ -1107,7 +1107,7 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, mul_m4_v3(symm_rot_mat, location); cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius); - cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3); + cursor_draw_point_screen_space(gpuattr, region, location, ob->object_to_world, 3); } } } @@ -1334,7 +1334,7 @@ static void paint_cursor_update_pixel_radius(PaintCursorContext *pcontext) } copy_v3_v3(pcontext->scene_space_location, pcontext->location); - mul_m4_v3(pcontext->vc.obact->obmat, pcontext->scene_space_location); + mul_m4_v3(pcontext->vc.obact->object_to_world, pcontext->scene_space_location); } else { Sculpt *sd = CTX_data_tool_settings(pcontext->C)->sculpt; @@ -1464,7 +1464,7 @@ static void paint_cursor_drawing_setup_cursor_space(PaintCursorContext *pcontext float cursor_trans[4][4], cursor_rot[4][4]; const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f}; float quat[4]; - copy_m4_m4(cursor_trans, pcontext->vc.obact->obmat); + copy_m4_m4(cursor_trans, pcontext->vc.obact->object_to_world); translate_m4(cursor_trans, pcontext->location[0], pcontext->location[1], pcontext->location[2]); rotation_between_vecs_to_quat(quat, z_axis, pcontext->normal); quat_to_mat4(cursor_rot, quat); @@ -1508,7 +1508,7 @@ static void paint_cursor_pose_brush_origins_draw(PaintCursorContext *pcontext) cursor_draw_point_screen_space(pcontext->pos, pcontext->region, ss->pose_ik_chain_preview->segments[i].initial_orig, - pcontext->vc.obact->obmat, + pcontext->vc.obact->object_to_world, 3); } } @@ -1526,7 +1526,7 @@ static void paint_cursor_preview_boundary_data_pivot_draw(PaintCursorContext *pc pcontext->pos, pcontext->region, SCULPT_vertex_co_get(pcontext->ss, pcontext->ss->boundary_preview->pivot_vertex), - pcontext->vc.obact->obmat, + pcontext->vc.obact->object_to_world, 3); } @@ -1634,7 +1634,7 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext * pcontext->pos, pcontext->region, SCULPT_vertex_co_get(pcontext->ss, pcontext->ss->expand_cache->initial_active_vertex), - pcontext->vc.obact->obmat, + pcontext->vc.obact->object_to_world, 2); } @@ -1656,7 +1656,7 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext * NULL); GPU_matrix_push(); - GPU_matrix_mul(pcontext->vc.obact->obmat); + GPU_matrix_mul(pcontext->vc.obact->object_to_world); /* Drawing Cursor overlays in 3D object space. */ if (is_brush_tool && brush->sculpt_tool == SCULPT_TOOL_GRAB && @@ -1747,7 +1747,7 @@ static void paint_cursor_cursor_draw_3d_view_brush_cursor_active(PaintCursorCont NULL, NULL); GPU_matrix_push(); - GPU_matrix_mul(pcontext->vc.obact->obmat); + GPU_matrix_mul(pcontext->vc.obact->object_to_world); /* Draw the special active cursors different tools may have. */ |