diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-04-26 16:25:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-04-26 16:31:13 +0300 |
commit | 03d482d212945eb46144524ccb8824d6889e8039 (patch) | |
tree | 66e11c55d5382bbcb1681f8c918b21f7fb620443 /source/blender/python | |
parent | 7440f98f980b203d73c047e6aefc144495b4c3c6 (diff) |
Fix T63896: Removing Drivers in Python Leads to Crash
Adding and removing drivers must always tag relations for update.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 7eb008efeef..fc945562c98 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -24,6 +24,7 @@ set(INC ../../blenlib ../../blenloader ../../blentranslation + ../../depsgraph ../../editors/include ../../gpu ../../imbuf diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 2cd8c8641bb..79c31c8caad 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -55,6 +55,8 @@ #include "../generic/python_utildefines.h" +#include "DEG_depsgraph_build.h" + /* for keyframes and drivers */ static int pyrna_struct_anim_args_parse_ex(PointerRNA *ptr, const char *error_prefix, @@ -586,7 +588,9 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) ret = pyrna_struct_CreatePyObject(&tptr); } + bContext *context = BPy_GetContext(); WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL); + DEG_relations_tag_update(CTX_data_main(context)); } else { /* XXX, should be handled by reports, */ @@ -644,7 +648,9 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args) return NULL; } - WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL); + bContext *context = BPy_GetContext(); + WM_event_add_notifier(context, NC_ANIMATION | ND_FCURVES_ORDER, NULL); + DEG_relations_tag_update(CTX_data_main(context)); return PyBool_FromLong(result); } |