Fix T55344: linked collection instance has user count 0.

This commit is contained in:
Brecht Van Lommel 2018-06-06 11:08:56 +02:00
parent 3e87c039ba
commit c4ce4034e6
Notes: blender-bot 2023-02-14 05:46:38 +01:00
Referenced by issue #55344, Linked in collection has user count of 0
2 changed files with 3 additions and 0 deletions

View File

@ -10064,6 +10064,7 @@ static void add_collections_to_scene(
/* Assign the collection. */
ob->dup_group = collection;
id_us_plus(&collection->id);
ob->transflag |= OB_DUPLICOLLECTION;
copy_v3_v3(ob->loc, scene->cursor.location);
}

View File

@ -361,6 +361,7 @@ static int collection_create_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "name", name);
Collection *collection = BKE_collection_add(bmain, NULL, name);
id_fake_user_set(&collection->id);
CTX_DATA_BEGIN (C, Base *, base, selected_bases)
{
@ -402,6 +403,7 @@ static int collection_add_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
Collection *collection = BKE_collection_add(bmain, NULL, "Collection");
id_fake_user_set(&collection->id);
BKE_collection_object_add(bmain, collection, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);