From 7c8b8b24572fb7e6b4d15c2f8fd55e5ff09c3214 Mon Sep 17 00:00:00 2001 From: YimingWu Date: Tue, 8 Jul 2025 18:11:59 +0200 Subject: [PATCH] Fix #141475: LineArt: Prevent image editor drawing when baking strokes Line art bakes strokes in a separate thread, which will also update depsgraph, and if an image editor is present, it will try to iterate all the objects in the view layer and this is unsafe. Now line art will set region drawing lock to prevent image editor from drawing while baking. Pull Request: https://projects.blender.org/blender/blender/pulls/141551 --- .../editors/grease_pencil/intern/grease_pencil_lineart.cc | 4 ++++ source/blender/editors/space_image/space_image.cc | 1 + 2 files changed, 5 insertions(+) diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_lineart.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_lineart.cc index 68409128d5d..2519ce51b46 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_lineart.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_lineart.cc @@ -18,6 +18,7 @@ #include "BKE_modifier.hh" #include "BKE_report.hh" #include "BKE_scene.hh" +#include "BKE_screen.hh" #include "DNA_curves_types.h" #include "DNA_modifier_types.h" @@ -295,6 +296,8 @@ static void lineart_bake_startjob(void *customdata, wmJobWorkerStatus *worker_st guard_modifiers(*bj); + BKE_spacedata_draw_locks(true); + for (int frame = bj->frame_begin; frame <= bj->frame_end; frame += bj->frame_increment) { if (G.is_break) { @@ -331,6 +334,7 @@ static void lineart_bake_endjob(void *customdata) { LineartBakeJob *bj = static_cast(customdata); + BKE_spacedata_draw_locks(false); WM_set_locked_interface(CTX_wm_manager(bj->C), false); WM_main_add_notifier(NC_SCENE | ND_FRAME, bj->scene); diff --git a/source/blender/editors/space_image/space_image.cc b/source/blender/editors/space_image/space_image.cc index c100c87bcb5..6de8c3d9619 100644 --- a/source/blender/editors/space_image/space_image.cc +++ b/source/blender/editors/space_image/space_image.cc @@ -1237,6 +1237,7 @@ void ED_spacetype_image() art->init = image_main_region_init; art->draw = image_main_region_draw; art->listener = image_main_region_listener; + art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */ BLI_addhead(&st->regiontypes, art); /* regions: list-view/buttons/scopes */