[Bf-blender-cvs] [d1474371fac] blender2.8: Fixed deadlock on viewlayer update when there are drivers

Sybren A. Stüvel noreply at git.blender.org
Thu Jun 7 12:41:34 CEST 2018


Commit: d1474371facd1dd975603954c310547c9d618fc0
Author: Sybren A. Stüvel
Date:   Thu Jun 7 12:37:48 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd1474371facd1dd975603954c310547c9d618fc0

Fixed deadlock on viewlayer update when there are drivers

When calling the bpy.ops.poselib.apply_pose() operator from Python, Blender
would deadlock when the rig has drivers.

Similar BPy_{BEGIN,END}_ALLOW_THREADS calls were already in place in the
rna_Scene_update_tagged() function.

===================================================================

M	source/blender/makesrna/intern/rna_layer.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 1d8c7c1f248..060b075cb29 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -49,6 +49,10 @@
 
 #ifdef RNA_RUNTIME
 
+#ifdef WITH_PYTHON
+#  include "BPY_extern.h"
+#endif
+
 #include "DNA_group_types.h"
 #include "DNA_object_types.h"
 
@@ -165,9 +169,18 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po
 
 static void rna_ViewLayer_update_tagged(ID *id_ptr, ViewLayer *view_layer, Main *bmain)
 {
+#ifdef WITH_PYTHON
+	/* Allow drivers to be evaluated */
+	BPy_BEGIN_ALLOW_THREADS;
+#endif
+
 	Scene *scene = (Scene *)id_ptr;
 	Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
 	BKE_scene_graph_update_tagged(depsgraph, bmain);
+
+#ifdef WITH_PYTHON
+	BPy_END_ALLOW_THREADS;
+#endif
 }
 
 static void rna_ObjectBase_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)



More information about the Bf-blender-cvs mailing list