[Bf-blender-cvs] [0c98bb75cb1] master: Fix Edit Voxel Size label rotation and scale in rotated objects

Pablo Dobarro noreply at git.blender.org
Fri Jun 26 17:17:21 CEST 2020


Commit: 0c98bb75cb1b46206e4ff52df398ea8865f47297
Author: Pablo Dobarro
Date:   Thu Jun 18 18:23:09 2020 +0200
Branches: master
https://developer.blender.org/rB0c98bb75cb1b46206e4ff52df398ea8865f47297

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

===================================================================

M	source/blender/editors/object/object_remesh.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list