[Bf-blender-cvs] [bc3da3ad41a] master: Sculpt: fix T103454: SCULPT_vertex_is_occluded is not compatible with filters
Joseph Eagar
noreply at git.blender.org
Fri Jan 13 09:12:32 CET 2023
Commit: bc3da3ad41a906414c589625bb3cd92384ddbcc3
Author: Joseph Eagar
Date: Fri Jan 13 00:10:46 2023 -0800
Branches: master
https://developer.blender.org/rBbc3da3ad41a906414c589625bb3cd92384ddbcc3
Sculpt: fix T103454: SCULPT_vertex_is_occluded is not compatible with
filters
===================================================================
M source/blender/editors/sculpt_paint/sculpt.cc
M source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc
index dd3e38258dc..af03fe06092 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -6225,9 +6225,12 @@ bool SCULPT_vertex_is_occluded(SculptSession *ss, PBVHVertRef vertex, bool origi
copy_v3_v3(co, SCULPT_vertex_co_get(ss, vertex));
float mouse[2];
- ED_view3d_project_float_v2_m4(ss->cache->vc->region, co, mouse, ss->cache->projection_mat);
+ ViewContext *vc = ss->cache ? ss->cache->vc : &ss->filter_cache->vc;
- int depth = SCULPT_raycast_init(ss->cache->vc, mouse, ray_end, ray_start, ray_normal, original);
+ ED_view3d_project_float_v2_m4(
+ vc->region, co, mouse, ss->cache ? ss->cache->projection_mat : ss->filter_cache->viewmat);
+
+ int depth = SCULPT_raycast_init(vc, mouse, ray_end, ray_start, ray_normal, original);
negate_v3(ray_normal);
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index f6bf9c0c488..9ffe10360af 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -152,6 +152,8 @@ void SCULPT_filter_cache_init(bContext *C,
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewContext vc;
ED_view3d_viewcontext_init(C, &vc, depsgraph);
+
+ ss->filter_cache->vc = vc;
copy_m4_m4(ss->filter_cache->viewmat, vc.rv3d->viewmat);
copy_m4_m4(ss->filter_cache->viewmat_inv, vc.rv3d->viewinv);
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 6a6fce851e7..700fba4cd40 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -22,6 +22,8 @@
#include "BLI_gsqueue.h"
#include "BLI_threads.h"
+#include "ED_view3d.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -486,6 +488,8 @@ typedef struct FilterCache {
/* Pre-smoothed colors used by sharpening. Colors are HSL. */
float (*pre_smoothed_color)[4];
+
+ ViewContext vc;
} FilterCache;
/**
More information about the Bf-blender-cvs
mailing list