From af1e94413ab67c1880a5c0d2306159ca68ce339c Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Wed, 29 May 2019 13:27:27 +0200 Subject: TexturePaint: Projection Edit Disable all overlays except the texture paint overlay. Add alpha to the resulting image buffer. Reviewed By: brecht Differential Revision: https://developer.blender.org/D4974 --- .../editors/sculpt_paint/paint_image_proj.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 6f20b853881..2cc8adf6f36 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6167,7 +6167,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from"); return OPERATOR_CANCELLED; } - View3D *v3d = sa->spacedata.first; + ARegion *ar = BKE_area_find_region_active_win(sa); if (!ar) { BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from"); @@ -6186,10 +6186,25 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) h = maxsize; } + /* Create a copy of the overlays where they are all turned off, except the + * texture paint overlay opacity */ + View3D *v3d = sa->spacedata.first; + View3D v3d_copy = *v3d; + v3d_copy.gridflag = 0; + v3d_copy.flag2 = 0; + v3d_copy.flag = V3D_HIDE_HELPLINES; + v3d_copy.gizmo_flag = V3D_GIZMO_HIDE; + + memset(&v3d_copy.overlay, 0, sizeof(View3DOverlay)); + v3d_copy.overlay.flag = V3D_OVERLAY_HIDE_CURSOR | V3D_OVERLAY_HIDE_TEXT | + V3D_OVERLAY_HIDE_MOTION_PATHS | V3D_OVERLAY_HIDE_BONES | + V3D_OVERLAY_HIDE_OBJECT_XTRAS | V3D_OVERLAY_HIDE_OBJECT_ORIGINS; + v3d_copy.overlay.texture_paint_mode_opacity = v3d->overlay.texture_paint_mode_opacity; + ibuf = ED_view3d_draw_offscreen_imbuf(depsgraph, scene, - v3d->shading.type, - v3d, + v3d_copy.shading.type, + &v3d_copy, ar, w, h, @@ -6199,6 +6214,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) NULL, NULL, err_out); + if (!ibuf) { /* Mostly happens when OpenGL offscreen buffer was failed to create, */ /* but could be other reasons. Should be handled in the future. nazgul */ -- cgit v1.2.3