Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2019-12-10 17:18:16 +0300
committerJeroen Bakker <jeroen@blender.org>2019-12-11 18:58:14 +0300
commit7878adf49cfff6ccbb18203f21c6355a518b34db (patch)
tree8f54eacad26647c6bd6db0b665ea4ff8063ab2ec /source/blender/editors/sculpt_paint
parent61e0e936441828c148b701c9a942d2ab6d9fe3a9 (diff)
DrawManager: Disable Clipping in material/rendered mode
Viewport: Disable Clipping For EEVEE and External Renderers Currently it is possible that, when using viewport clipping, the display and tools communicate different information to the user then the renderer does. The reason is that the renderer does not support viewport clipping. Both EEVEE and Cycles do not support it. This patch will disable the clipping in all the tools and drawing code when the viewport drawing mode is `Material Preview` or `Rendered`. This patch introduces a `RV3D_CLIPPING_ENABLED` util that checks if clipping is enabled for the given `rv3d` and `v3d`. Also in places where it was needed we added the `ViewContext` as a carrier for the `View3D` and `RegionView3D`. There are a few areas in the tooling (select, projection painting) that still needs to be tackled after this patch. Reviewed By: fclem Differential Revision: https://developer.blender.org/D6047
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 510d734451b..c57490041bc 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -887,7 +887,7 @@ static bool project_bucket_point_occluded(const ProjPaintState *ps,
const float pixelScreenCo[4])
{
int isect_ret;
- const bool do_clip = ps->rv3d ? (ps->rv3d->rflag & RV3D_CLIPPING) != 0 : 0;
+ const bool do_clip = RV3D_CLIPPING_ENABLED(ps->v3d, ps->rv3d);
/* we could return 0 for 1 face buckets, as long as this function assumes
* that the point its testing is only every originated from an existing face */
@@ -3024,7 +3024,7 @@ static void project_paint_face_init(const ProjPaintState *ps,
const bool is_ortho = ps->is_ortho;
const bool is_flip_object = ps->is_flip_object;
const bool do_backfacecull = ps->do_backfacecull;
- const bool do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
+ const bool do_clip = RV3D_CLIPPING_ENABLED(ps->v3d, ps->rv3d);
vCo[0] = ps->mvert_eval[lt_vtri[0]].co;
vCo[1] = ps->mvert_eval[lt_vtri[1]].co;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index f813be7d0a2..b26d706bbf4 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1013,6 +1013,7 @@ void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar, Object *ob)
void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
{
RegionView3D *rv3d = ss->cache ? ss->cache->vc->rv3d : ss->rv3d;
+ View3D *v3d = ss->cache ? ss->cache->vc->v3d : ss->v3d;
test->radius_squared = ss->cache ? ss->cache->radius_squared :
ss->cursor_radius * ss->cursor_radius;
@@ -1033,7 +1034,7 @@ void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
test->mirror_symmetry_pass = ss->cache ? ss->cache->mirror_symmetry_pass : 0;
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
test->clip_rv3d = rv3d;
}
else {
@@ -6896,6 +6897,7 @@ static float sculpt_raycast_init(ViewContext *vc,
float dist;
Object *ob = vc->obact;
RegionView3D *rv3d = vc->ar->regiondata;
+ View3D *v3d = vc->v3d;
/* TODO: what if the segment is totally clipped? (return == 0) */
ED_view3d_win_to_segment_clipped(
@@ -6910,7 +6912,7 @@ static float sculpt_raycast_init(ViewContext *vc,
if ((rv3d->is_persp == false) &&
/* if the ray is clipped, don't adjust its start/end */
- ((rv3d->rflag & RV3D_CLIPPING) == 0)) {
+ RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
BKE_pbvh_raycast_project_ray_root(ob->sculpt->pbvh, original, ray_start, ray_end, ray_normal);
/* recalculate the normal */
@@ -7005,6 +7007,7 @@ bool sculpt_cursor_geometry_info_update(bContext *C,
copy_v3_v3(ss->cursor_normal, srd.face_normal);
copy_v3_v3(ss->cursor_location, out->location);
ss->rv3d = vc.rv3d;
+ ss->v3d = vc.v3d;
if (!BKE_brush_use_locked_size(scene, brush)) {
radius = paint_calc_object_space_radius(&vc, out->location, BKE_brush_size_get(scene, brush));