diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-29 14:27:27 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-06-18 12:14:25 +0300 |
commit | af1e94413ab67c1880a5c0d2306159ca68ce339c (patch) | |
tree | 2c52f570181113369683861b7f78ddd9f3fd5cd5 /source/blender/editors/sculpt_paint/paint_image_proj.c | |
parent | f9e0d51e318e513fc4ce72c2acdfbded647b4a23 (diff) |
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
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 22 |
1 files changed, 19 insertions, 3 deletions
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 */ |