From 253dbe71dcefabc7abfb992d800caa1d963324d1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 7 Oct 2020 18:01:25 +0200 Subject: Refactor: remove `BKE__copy` functions. Those were only shallow wrappers around `BKE_id_copy`, barely used (even fully unused in some cases), and we want to get rid of those ID-specific helpers for the common ID management tasks. Also prevents weird custom behaviors (like `BKE_object_copy`, who was the only basic ID copy function to reset user count of the new copy to zero). Part of 71219. --- source/blender/blenkernel/intern/object.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'source/blender/blenkernel/intern/object.c') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 676277dae8c..6ab47f1b1f8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -360,9 +360,9 @@ static void object_make_local(Main *bmain, ID *id, const int flags) } } else { - Object *ob_new = BKE_object_copy(bmain, ob); + Object *ob_new = (Object *)BKE_id_copy(bmain, &ob->id); + id_us_min(&ob_new->id); - ob_new->id.us = 0; ob_new->proxy = ob_new->proxy_from = ob_new->proxy_group = NULL; /* setting newid is mandatory for complex make_lib_local logic... */ @@ -1785,19 +1785,6 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src) copy_v3_v3(ob_tar->scale, ob_src->scale); } -/** - * Copy objects, will re-initialize cached simulation data. - */ -Object *BKE_object_copy(Main *bmain, const Object *ob) -{ - Object *ob_copy = (Object *)BKE_id_copy(bmain, &ob->id); - - /* We increase object user count when linking to Collections. */ - id_us_min(&ob_copy->id); - - return ob_copy; -} - /** * Perform deep-copy of object and its 'children' data-blocks (obdata, materials, actions, etc.). * -- cgit v1.2.3