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
This commit is contained in:
parent
f9e0d51e31
commit
af1e94413a
|
@ -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) ||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue