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
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')
-rw-r--r--source/blender/blenkernel/BKE_paint.h3
-rw-r--r--source/blender/draw/DRW_engine.h1
-rw-r--r--source/blender/draw/engines/overlay/overlay_engine.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_data.c23
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c2
-rw-r--r--source/blender/draw/intern/draw_manager.c10
-rw-r--r--source/blender/draw/intern/draw_manager_text.c6
-rw-r--r--source/blender/draw/intern/draw_manager_text.h2
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c11
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h3
16 files changed, 48 insertions, 38 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 536268c067e..fdd3bd7cd86 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -265,7 +265,10 @@ typedef struct SculptSession {
float cursor_location[3];
float cursor_normal[3];
float cursor_view_normal[3];
+
+ /* TODO(jbakker): Replace rv3d adn v3d with ViewContext */
struct RegionView3D *rv3d;
+ struct View3D *v3d;
/* Dynamic mesh preview */
int *preview_vert_index_list;
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 5edfadd7f41..b9e7908b3ef 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -134,6 +134,7 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
struct View3D *v3d,
struct GPUViewport *viewport);
void DRW_draw_depth_object(struct ARegion *ar,
+ struct View3D *v3d,
struct GPUViewport *viewport,
struct Object *object);
void DRW_draw_select_id(struct Depsgraph *depsgraph,
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c
index 41d099772ee..06044ff92b3 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -74,7 +74,7 @@ static void OVERLAY_engine_init(void *vedata)
}
pd->wireframe_mode = (v3d->shading.type == OB_WIRE);
- pd->clipping_state = (rv3d->rflag & RV3D_CLIPPING) ? DRW_STATE_CLIP_PLANES : 0;
+ pd->clipping_state = RV3D_CLIPPING_ENABLED(v3d, rv3d) ? DRW_STATE_CLIP_PLANES : 0;
pd->xray_enabled = XRAY_ACTIVE(v3d);
pd->xray_enabled_and_not_wire = pd->xray_enabled && v3d->shading.type > OB_WIRE;
pd->clear_in_front = (v3d->shading.type != OB_SOLID);
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index 42375f29d4d..f07b21ebcc2 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -116,6 +116,8 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
wpd->preferences = &U;
View3D *v3d = draw_ctx->v3d;
+ RegionView3D *rv3d = draw_ctx->rv3d;
+
if (!v3d || (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_workbench(scene))) {
wpd->shading = scene->display.shading;
wpd->shading.xray_alpha = XRAY_ALPHA((&scene->display));
@@ -193,22 +195,19 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
wd->curvature_valley = 0.7f / max_ff(SQUARE(wpd->shading.curvature_valley_factor), 1e-4f);
/* Will be NULL when rendering. */
- if (draw_ctx->rv3d != NULL) {
- RegionView3D *rv3d = draw_ctx->rv3d;
- if (rv3d->rflag & RV3D_CLIPPING) {
- wpd->world_clip_planes = rv3d->clip;
- UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, wpd->world_clip_planes_color);
- if (wpd->use_color_management) {
- srgb_to_linearrgb_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color);
- }
- else {
- copy_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color);
- }
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
+ wpd->world_clip_planes = rv3d->clip;
+ UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, wpd->world_clip_planes_color);
+ if (wpd->use_color_management) {
+ srgb_to_linearrgb_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color);
}
else {
- wpd->world_clip_planes = NULL;
+ copy_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color);
}
}
+ else {
+ wpd->world_clip_planes = NULL;
+ }
workbench_world_data_update_shadow_direction_vs(wpd);
workbench_world_data_ubo_ensure(scene, wpd);
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index da5ab0c3122..8e61750da38 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -716,7 +716,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
}
DRW_shgroup_call(grp, DRW_cache_fullscreen_quad_get(), NULL);
- if (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && draw_ctx->rv3d->clipbb) {
+ if (RV3D_CLIPPING_ENABLED(draw_ctx->v3d, draw_ctx->rv3d)) {
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND);
grp = DRW_shgroup_create(shader, psl->background_pass);
wpd->world_clip_planes_batch = DRW_draw_background_clipping_batch_from_rv3d(draw_ctx->rv3d);
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 87f3b28c665..dbd7ebfe0d1 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -421,7 +421,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
/* TODO(campbell): displays but masks geometry,
* only use with wire or solid-without-xray for now. */
if ((wpd->shading.type != OB_WIRE && !XRAY_FLAG_ENABLED(wpd)) &&
- (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && draw_ctx->rv3d->clipbb)) {
+ RV3D_CLIPPING_ENABLED(draw_ctx->v3d, draw_ctx->rv3d)) {
psl->background_pass = DRW_pass_create("Background",
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL);
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 4bfae75848b..5832db31c4e 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -584,7 +584,7 @@ static void drw_context_state_init(void)
}
DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_DEFAULT;
- if (DST.draw_ctx.rv3d && DST.draw_ctx.rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(DST.draw_ctx.v3d, DST.draw_ctx.rv3d)) {
DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_CLIPPED;
}
}
@@ -1235,7 +1235,7 @@ static void drw_engines_draw_text(void)
PROFILE_START(stime);
if (data->text_draw_cache) {
- DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar);
+ DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar, DST.draw_ctx.v3d);
}
PROFILE_END_UPDATE(data->render_time, stime);
@@ -2571,7 +2571,7 @@ static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_
/**
* Clears the Depth Buffer and draws only the specified object.
*/
-void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object)
+void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, Object *object)
{
RegionView3D *rv3d = ar->regiondata;
@@ -2588,7 +2588,7 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object)
GPU_depth_test(true);
const float(*world_clip_planes)[4] = NULL;
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_set(rv3d);
ED_view3d_clipping_local(rv3d, object->obmat);
world_clip_planes = rv3d->clip_local;
@@ -2625,7 +2625,7 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object)
break;
}
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_disable();
}
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c
index b6dab0b2077..9462a0d8072 100644
--- a/source/blender/draw/intern/draw_manager_text.c
+++ b/source/blender/draw/intern/draw_manager_text.c
@@ -119,7 +119,7 @@ void DRW_text_cache_add(DRWTextStore *dt,
}
}
-void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
+void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
{
RegionView3D *rv3d = ar->regiondata;
ViewCachedString *vos;
@@ -147,7 +147,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
if (tot) {
int col_pack_prev = 0;
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_disable();
}
@@ -185,7 +185,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
GPU_matrix_pop();
GPU_matrix_projection_set(original_proj);
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_enable();
}
}
diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h
index 5e9692ff490..a8eb45ee8f5 100644
--- a/source/blender/draw/intern/draw_manager_text.h
+++ b/source/blender/draw/intern/draw_manager_text.h
@@ -41,7 +41,7 @@ void DRW_text_cache_add(struct DRWTextStore *dt,
short flag,
const uchar col[4]);
-void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar);
+void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar, struct View3D *v3d);
void DRW_text_edit_mesh_measure_stats(struct ARegion *ar,
struct View3D *v3d,
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;
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));
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 6235f994272..061977d0c91 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -796,7 +796,7 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
GPU_clear(GPU_DEPTH_BIT);
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_set(rv3d);
}
/* get surface depth without bias */
@@ -817,7 +817,7 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
WM_draw_region_viewport_unbind(ar);
- if (rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_disable();
}
rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED;
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 17b575cedae..38cb5ad8651 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -228,7 +228,7 @@ void ED_view3d_backbuf_depth_validate(ViewContext *vc)
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) {
GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
- DRW_draw_depth_object(vc->ar, viewport, obact_eval);
+ DRW_draw_depth_object(vc->ar, vc->v3d, viewport, obact_eval);
}
vc->v3d->flag &= ~V3D_INVALID_BACKBUF;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index d7f7e96ba08..8b4012d6547 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1099,7 +1099,7 @@ int view3d_opengl_select(ViewContext *vc,
GPU_depth_test(true);
}
- if (vc->rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(vc->v3d, vc->rv3d)) {
ED_view3d_clipping_set(vc->rv3d);
}
@@ -1167,7 +1167,7 @@ int view3d_opengl_select(ViewContext *vc,
GPU_depth_test(false);
}
- if (vc->rv3d->rflag & RV3D_CLIPPING) {
+ if (RV3D_CLIPPING_ENABLED(v3d, vc->rv3d)) {
ED_view3d_clipping_disable();
}
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index a9a20980677..93b93bbdbf7 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -376,6 +376,9 @@ typedef struct View3D {
#define RV3D_VIEW_CAMERA 8
#define RV3D_VIEW_IS_AXIS(view) (((view) >= RV3D_VIEW_FRONT) && ((view) <= RV3D_VIEW_BOTTOM))
+#define RV3D_CLIPPING_ENABLED(v3d, rv3d) \
+ (rv3d && v3d && (rv3d->rflag & RV3D_CLIPPING) && ELEM(v3d->shading.type, OB_WIRE, OB_SOLID) && \
+ rv3d->clipbb)
/** #View3D.flag2 (int) */
#define V3D_HIDE_OVERLAYS (1 << 2)