diff options
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index c4e3bd5cf91..2841e017ef6 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -88,6 +88,7 @@ #include "engines/basic/basic_engine.h" #include "engines/workbench/workbench_engine.h" #include "engines/external/external_engine.h" +#include "engines/gpencil/gpencil_engine.h" #include "GPU_context.h" @@ -206,6 +207,8 @@ bool DRW_object_use_hide_faces(const struct Object *ob) const Mesh *me = ob->data; switch (ob->mode) { + case OB_MODE_SCULPT: + return true; case OB_MODE_TEXTURE_PAINT: return (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; case OB_MODE_VERTEX_PAINT: @@ -1916,6 +1919,13 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph DST.buffer_finish_called = false; } +static void drw_view_reset(void) +{ + DST.view_default = NULL; + DST.view_active = NULL; + DST.view_previous = NULL; +} + void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph) { Scene *scene = DEG_get_evaluated_scene(depsgraph); @@ -1998,14 +2008,12 @@ void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph) for (RenderView *render_view = render_result->views.first; render_view != NULL; render_view = render_view->next) { RE_SetActiveRenderView(render, render_view->name); - /* Reset the view. */ - DST.view_default = NULL; - DST.view_active = NULL; - DST.view_previous = NULL; + drw_view_reset(); engine_type->draw_engine->render_to_image(data, engine, render_layer, &render_rect); /* grease pencil: render result is merged in the previous render result. */ if (DRW_render_check_grease_pencil(depsgraph)) { DRW_state_reset(); + drw_view_reset(); DRW_render_gpencil_to_image(engine, render_layer, &render_rect); } DST.buffer_finish_called = false; @@ -2374,6 +2382,13 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, } } + /* TODO: GPXX Workaround for grease pencil selection while draw manager support a callback from + * scene finish */ + void *data = GPU_viewport_engine_data_get(DST.viewport, &draw_engine_gpencil_type); + if (data != NULL) { + DRW_gpencil_free_runtime_data(data); + } + DRW_state_lock(0); DRW_draw_callbacks_post_scene(); @@ -2590,6 +2605,8 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object) world_clip_planes = rv3d->clip_local; } + drw_batch_cache_validate(object); + switch (object->type) { case OB_MESH: { GPUBatch *batch; @@ -2715,6 +2732,14 @@ void DRW_draw_select_id_object(Scene *scene, select_mode = ts->selectmode; } + /* Init the scene of the draw context. When using face dot selection on + * when the subsurf modifier is active on the cage, the scene needs to be + * valid. It is read from the context in the + * `DRW_mesh_batch_cache_create_requested` and used in the `isDisabled` + * method of the SubSurfModifier. */ + DRWContextState *draw_ctx = &DST.draw_ctx; + draw_ctx->scene = scene; + GPU_matrix_mul(ob->obmat); const float(*world_clip_planes)[4] = NULL; |