[Bf-blender-cvs] [fd28c19d09d] sculpt-dev: Scupt: Fix failed scene projection with ortographic views

Pablo Dobarro noreply at git.blender.org
Mon Feb 8 20:27:39 CET 2021


Commit: fd28c19d09d0cb2048f8d289dc7cc8e3e7ebd32c
Author: Pablo Dobarro
Date:   Mon Feb 8 18:59:26 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rBfd28c19d09d0cb2048f8d289dc7cc8e3e7ebd32c

Scupt: Fix failed scene projection with ortographic views

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

M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 7a8ada3a7f1..16e80174fd1 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3624,9 +3624,15 @@ static void sculpt_scene_project_view_ray_init(Object *ob,
   SculptSession *ss = ob->sculpt;
   float world_space_vertex_co[3];
   mul_v3_m4v3(world_space_vertex_co, ob->obmat, SCULPT_vertex_co_get(ss, vertex_index));
-  sub_v3_v3v3(r_ray_normal, world_space_vertex_co, ss->cache->view_origin);
-  normalize_v3(r_ray_normal);
-  copy_v3_v3(r_ray_origin, ss->cache->view_origin);
+  if (ss->cache->vc->rv3d->is_persp) {
+    sub_v3_v3v3(r_ray_normal, world_space_vertex_co, ss->cache->view_origin);
+    normalize_v3(r_ray_normal);
+    copy_v3_v3(r_ray_origin, ss->cache->view_origin);
+  }
+  else {
+    mul_v3_mat3_m4v3(r_ray_normal, ob->obmat, ss->cache->view_normal);
+    sub_v3_v3v3(r_ray_origin, world_space_vertex_co, r_ray_normal);
+  }
 }
 
 static void sculpt_scene_project_vertex_normal_ray_init(Object *ob,



More information about the Bf-blender-cvs mailing list