From 7c9131d11eb01a70db440fac7bb3f4b3833d544a Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 7 Oct 2020 14:27:33 +0200 Subject: Refactor `BKE_id_copy_ex` to return the new ID pointer. Note that possibility to pass the new ID pointer as parameter was kept, as this is needed for some rather specific cases (like in depsgraph/COW, when copying into already allocated memory). Part of T71219. --- .../blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc') diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 0bf6c38bc89..f1e1fbd28a1 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -301,8 +301,10 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid) id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, id); #endif - bool result = BKE_id_copy_ex( - nullptr, (ID *)id_for_copy, &newid, (LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE)); + bool result = (BKE_id_copy_ex(nullptr, + (ID *)id_for_copy, + &newid, + LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != NULL); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -328,8 +330,10 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, &scene->id); #endif - bool result = BKE_id_copy_ex( - nullptr, id_for_copy, (ID **)&new_scene, LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE); + bool result = (BKE_id_copy_ex(nullptr, + id_for_copy, + (ID **)&new_scene, + LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != NULL); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { -- cgit v1.2.3