Fix T72063: Workbench Sculpt Render

When sculpting and doing a image render the workbench used the sculpt
batch what is created by a different GPU context and would not show up.

In debug builds an assert for this case is checked. I rechecked all
`use_sculpt_pbvh` that it also checked if it was rendering. Only the
workbench deferred didn't do this for the default render mode.

With this change the user can render a workbench render directly from
sculpt mode.
This commit is contained in:
Jeroen Bakker 2020-01-14 11:01:15 +01:00
parent 1e0b790364
commit 9954cbfca6
Notes: blender-bot 2023-02-21 17:59:30 +01:00
Referenced by issue #72063, Workbench crashes when rendering from sculpt mode the second time
1 changed files with 2 additions and 1 deletions

View File

@ -1027,7 +1027,8 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
WORKBENCH_MaterialData *material;
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
const bool is_active = (ob == draw_ctx->obact);
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d);
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
!DRW_state_is_image_render();
const bool use_hide = is_active && DRW_object_use_hide_faces(ob);
const int materials_len = MAX2(1, ob->totcol);
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;