Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-11-27 19:33:31 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-11-27 19:52:21 +0300
commit91034646c7c93e77c2ffda5e67e5ee0b23207fc9 (patch)
tree29dd1e9260dca517ded408a12d648d4e8f47568f
parent14c3ef8253290da8f4fbb2e1c1ffeaffadd9f83a (diff)
Fix T53291: Deleting objects do not delete them from the blend file
User count was wrong for newly created files. We increase/decrease user count when we link/delete objects from a SceneCollection. So we don't want to leave user count of 1 after calling BKE_libblock_alloc in BKE_object_add_only_object().
-rw-r--r--source/blender/blenkernel/intern/object.c3
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 8fa4ebb8b3c..107e9299740 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -706,6 +706,9 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
ob = BKE_libblock_alloc(bmain, ID_OB, name, 0);
+ /* We increase object user count when linking to SceneCollections. */
+ id_us_min(&ob->id);
+
/* default object vars */
ob->type = type;
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index d1b28bffc7e..f15006fa0ed 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -249,7 +249,6 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char
}
ob = BKE_object_add_only_object(bmain, type, safe_name);
- id_us_min(&ob->id);
ob->data = data;
test_object_materials(ob, ob->data);