diff options
author | Jeroen Bakker <jeroen@blender.org> | 2019-12-10 17:18:16 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2019-12-11 18:58:14 +0300 |
commit | 7878adf49cfff6ccbb18203f21c6355a518b34db (patch) | |
tree | 8f54eacad26647c6bd6db0b665ea4ff8063ab2ec /source/blender/editors/mesh/editmesh_knife.c | |
parent | 61e0e936441828c148b701c9a942d2ab6d9fe3a9 (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/mesh/editmesh_knife.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 1adbbe30286..4c4aa4214b2 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1460,7 +1460,8 @@ static bool point_is_visible(KnifeTool_OpData *kcd, BMFace *f_hit; /* If box clipping on, make sure p is not clipped */ - if (kcd->vc.rv3d->rflag & RV3D_CLIPPING && ED_view3d_clipping_test(kcd->vc.rv3d, p, true)) { + if (RV3D_CLIPPING_ENABLED(kcd->vc.v3d, kcd->vc.rv3d) && + ED_view3d_clipping_test(kcd->vc.rv3d, p, true)) { return false; } @@ -1484,7 +1485,7 @@ static bool point_is_visible(KnifeTool_OpData *kcd, dist = kcd->vc.v3d->clip_end * 2.0f; } - if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(kcd->vc.v3d, kcd->vc.rv3d)) { float view_clip[2][3]; /* note: view_clip[0] should never get clipped */ copy_v3_v3(view_clip[0], p_ofs); @@ -1935,7 +1936,7 @@ static int knife_sample_screen_density(KnifeTool_OpData *kcd, const float radius dis_sq = len_squared_v2v2(kfv->sco, sco); if (dis_sq < radius_sq) { - if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(kcd->vc.v3d, kcd->vc.rv3d)) { if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, true) == 0) { c++; } @@ -2045,7 +2046,7 @@ static KnifeEdge *knife_find_closest_edge( /* now we have 'lambda' calculated (in screen-space) */ knife_interp_v3_v3v3(kcd, test_cagep, kfe->v1->cageco, kfe->v2->cageco, lambda); - if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(kcd->vc.v3d, kcd->vc.rv3d)) { /* check we're in the view */ if (ED_view3d_clipping_test(kcd->vc.rv3d, test_cagep, true)) { continue; @@ -2152,7 +2153,7 @@ static KnifeVert *knife_find_closest_vert( dis_sq = len_squared_v2v2(kfv->sco, sco); if (dis_sq < curdis_sq && dis_sq < maxdist_sq) { - if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(kcd->vc.v3d, kcd->vc.rv3d)) { if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, true) == 0) { curv = kfv; curdis_sq = dis_sq; |