diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-14 17:38:05 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-15 13:09:16 +0300 |
commit | 2f39ca38437d94a63ba020ef110b413ee3f7894b (patch) | |
tree | 6c20d5c789447009cf35ddd5c7f9721df4344adf | |
parent | 93867cfafcf5474c565505f4f54e89e1cda6c99f (diff) |
Cleanup BKE_id_free_ex().
Add 'missing' bpy code from BKE_libblock_free_ex(), now both functions
do exactly the same thing, only the later is less flexible (fewer
'exotic' behaviors supported, like handling IDs outside of bmain etc.).
Next step: nuke usages of BKE_libblock_free functions, makes no sense to
have twice the same code around!
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 458d723c95a..a671b02cb67 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -846,7 +846,12 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i } #ifdef WITH_PYTHON +# ifdef WITH_PYTHON_SAFETY BPY_id_release(id); +# endif + if (id->py_instance) { + BPY_DECREF_RNA_INVALIDATE(id->py_instance); + } #endif if ((flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0) { @@ -856,7 +861,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i BKE_libblock_free_datablock(id, flag); /* avoid notifying on removed data */ - if (bmain) { + if ((flag & LIB_ID_FREE_NO_MAIN) == 0) { BKE_main_lock(bmain); } @@ -877,7 +882,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i BKE_libblock_free_data(id, (flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0); - if (bmain) { + if ((flag & LIB_ID_FREE_NO_MAIN) == 0) { BKE_main_unlock(bmain); } |