[Bf-blender-cvs] [af1e94413ab] master: TexturePaint: Projection Edit
Jeroen Bakker
noreply at git.blender.org
Tue Jun 18 11:15:04 CEST 2019
Commit: af1e94413ab67c1880a5c0d2306159ca68ce339c
Author: Jeroen Bakker
Date: Wed May 29 13:27:27 2019 +0200
Branches: master
https://developer.blender.org/rBaf1e94413ab67c1880a5c0d2306159ca68ce339c
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
===================================================================
M source/blender/draw/engines/workbench/workbench_data.c
M source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index fce1d725133..04e1255521f 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -79,9 +79,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
WORKBENCH_UBO_World *wd = &wpd->world_data;
wd->matcap_orientation = (wpd->shading.flag & V3D_SHADING_MATCAP_FLIP_X) != 0;
- wd->background_alpha = (DRW_state_is_image_render() && scene->r.alphamode == R_ALPHAPREMUL) ?
- 0.0f :
- 1.0f;
+ wd->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f;
if ((scene->world != NULL) &&
(!v3d || (v3d && ((v3d->shading.background_type == V3D_SHADING_BACKGROUND_WORLD) ||
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 */
More information about the Bf-blender-cvs
mailing list