diff options
author | Bastien Montagne <bastien@blender.org> | 2022-08-12 17:19:09 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-08-12 17:23:12 +0300 |
commit | 62eb21e3ce87451a86b8ad78b6980cd8c9013f89 (patch) | |
tree | ba785a65dad2cc109ab86ed69958b16dbc9f2acc /source/blender | |
parent | 515a15f200ed3323b7cccc584c2c46d28a4ca562 (diff) |
Fix T100203: Freeze using `override_hierarchy_create` with Object level property with custom getter function.
As suggested by @brecht, use the `BPy_BEGIN`/`END_ALLOW_THREADS` macros.
Note that there may be other bits of code needing this too.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index b4fa7088d38..242bfd99eae 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -234,6 +234,10 @@ const struct IDFilterEnumPropertyItem rna_enum_id_type_filter_items[] = { # include "WM_api.h" +# ifdef WITH_PYTHON +# include "BPY_extern.h" +# endif + void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value) { IDOverrideLibraryPropertyOperation *opop = ptr->data; @@ -695,7 +699,16 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true); } - ID *local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages); + ID *local_id = NULL; +# ifdef WITH_PYTHON + BPy_BEGIN_ALLOW_THREADS; +# endif + + local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages); + +# ifdef WITH_PYTHON + BPy_END_ALLOW_THREADS; +# endif if (remap_local_usages) { BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); @@ -717,9 +730,18 @@ static ID *rna_ID_override_hierarchy_create( BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); ID *id_root_override = NULL; + +# ifdef WITH_PYTHON + BPy_BEGIN_ALLOW_THREADS; +# endif + BKE_lib_override_library_create( bmain, scene, view_layer, NULL, id, id, id_instance_hint, &id_root_override, false); +# ifdef WITH_PYTHON + BPy_END_ALLOW_THREADS; +# endif + WM_main_add_notifier(NC_ID | NA_ADDED, NULL); WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); |