From a9a8eedd163e17fcf345726fd4c4db891771cac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 18 Sep 2019 15:26:04 +0200 Subject: Fix T65816: Alembic export of procedural mesh results in a static mesh and crashes The static mesh issue described in T65816 has been resolved by @Sergey in T60094. This commit fixes the last bit of the puzzle, which was two-fold: - A missing depsgraph update when setting `orig_object.data = new_mesh` from Python. Thanks @Sergey for providing the fix :) - Properly locking the interface while exporting. This prevents crashes as described in T60094. The previous approach of calling `BKE_spacedata_draw_locks()` was not enough. --- source/blender/alembic/intern/alembic_capi.cc | 7 ++++--- source/blender/depsgraph/intern/depsgraph_build.cc | 10 +++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index 6547ce54a00..98e5477f2b2 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -222,6 +222,7 @@ static void find_iobject(const IObject &object, IObject &ret, const std::string struct ExportJobData { ViewLayer *view_layer; Main *bmain; + wmWindowManager *wm; char filename[1024]; ExportSettings settings; @@ -246,8 +247,7 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo * scene frame in separate threads */ G.is_rendering = true; - BKE_spacedata_draw_locks(true); - + WM_set_locked_interface(data->wm, true); G.is_break = false; DEG_graph_build_from_view_layer( @@ -296,7 +296,7 @@ static void export_endjob(void *customdata) } G.is_rendering = false; - BKE_spacedata_draw_locks(false); + WM_set_locked_interface(data->wm, false); } bool ABC_export(Scene *scene, @@ -310,6 +310,7 @@ bool ABC_export(Scene *scene, job->view_layer = CTX_data_view_layer(C); job->bmain = CTX_data_main(C); + job->wm = CTX_wm_manager(C); job->export_ok = false; BLI_strncpy(job->filename, filepath, 1024); diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 968ed8ef403..e34c8af0cf3 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -59,6 +59,7 @@ extern "C" { #include "intern/node/deg_node_id.h" #include "intern/node/deg_node_operation.h" +#include "intern/depsgraph_registry.h" #include "intern/depsgraph_type.h" /* ****************** */ @@ -356,12 +357,7 @@ void DEG_graph_relations_update(Depsgraph *graph, Main *bmain, Scene *scene, Vie void DEG_relations_tag_update(Main *bmain) { DEG_GLOBAL_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__); - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { - Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false); - if (depsgraph != NULL) { - DEG_graph_tag_relations_update(depsgraph); - } - } + for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) { + DEG_graph_tag_relations_update(reinterpret_cast(depsgraph)); } } -- cgit v1.2.3