diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-18 19:23:09 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-26 18:17:00 +0300 |
commit | 0c98bb75cb1b46206e4ff52df398ea8865f47297 (patch) | |
tree | 3dee153cbcfc18d747dc06c2e27b8d3fe07e56d6 /source/blender/editors | |
parent | 5c48592ccde08e18d13255e89d09067d5dc0f771 (diff) |
Fix Edit Voxel Size label rotation and scale in rotated objects
Previously, the text rotation was always calculated in object space, so
the text rotation always had the object rotation applied. Now the
rotation is calculated in world space, so it always aligns correctly to
the view. Same applies to text scale not taking into account the object
position.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8068
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_remesh.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c index 76323037fd7..e28b5d953a5 100644 --- a/source/blender/editors/object/object_remesh.c +++ b/source/blender/editors/object/object_remesh.c @@ -526,7 +526,9 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev /* Project the selected face in the previous step of the Bounding Box. */ for (int i = 0; i < 4; i++) { - ED_view3d_project(ar, cd->preview_plane[i], preview_plane_proj[i]); + float preview_plane_world_space[3]; + mul_v3_m4v3(preview_plane_world_space, active_object->obmat, cd->preview_plane[i]); + ED_view3d_project(ar, preview_plane_world_space, preview_plane_proj[i]); } /* Get the initial X and Y axis of the basis from the edges of the Bounding Box face. */ @@ -574,7 +576,9 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev copy_v3_v3(cd->text_mat[3], text_pos); /* Scale the text. */ - const float pixelsize = ED_view3d_pixel_size(rv3d, text_pos); + float text_pos_word_space[3]; + mul_v3_m4v3(text_pos_word_space, active_object->obmat, text_pos); + const float pixelsize = ED_view3d_pixel_size(rv3d, text_pos_word_space); scale_m4_fl(scale_mat, pixelsize * 0.5f); mul_m4_m4_post(cd->text_mat, scale_mat); |