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:
authorBastien Montagne <bastien@blender.org>2020-10-08 17:11:56 +0300
committerBastien Montagne <bastien@blender.org>2020-10-08 17:11:56 +0300
commit70a8498cece0ec710b6e52d51591a15d4c094364 (patch)
treeff3562289cbcf2b88ad31c672261deddc34119e6 /source/blender/blenkernel/intern/collection.c
parente900f6ed14508f9872adae4fbd3d2bd6f3132dff (diff)
Cleanup/refactor: move init of Collection to proper place.
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r--source/blender/blenkernel/intern/collection.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 9c4f46dac4b..ed89a964237 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -42,6 +42,8 @@
#include "BKE_rigidbody.h"
#include "BKE_scene.h"
+#include "DNA_defaults.h"
+
#include "DNA_ID.h"
#include "DNA_collection_types.h"
#include "DNA_layer_types.h"
@@ -81,6 +83,16 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll
/** \name Collection Data-Block
* \{ */
+static void collection_init_data(ID *id)
+{
+ Collection *collection = (Collection *)id;
+ BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(collection, id));
+
+ MEMCPY_STRUCT_AFTER(collection, DNA_struct_default_get(Collection), id);
+
+ collection->color_tag = COLLECTION_COLOR_NONE;
+}
+
/**
* Only copy internal data of Collection ID from source
* to already allocated/initialized destination.
@@ -168,7 +180,7 @@ IDTypeInfo IDType_ID_GR = {
.translation_context = BLT_I18NCONTEXT_ID_COLLECTION,
.flags = IDTYPE_FLAGS_NO_ANIMDATA,
- .init_data = NULL,
+ .init_data = collection_init_data,
.copy_data = collection_copy_data,
.free_data = collection_free_data,
.make_local = NULL,
@@ -204,7 +216,6 @@ static Collection *collection_add(Main *bmain,
/* Create new collection. */
Collection *collection = BKE_id_new(bmain, ID_GR, name);
- collection->color_tag = COLLECTION_COLOR_NONE;
/* We increase collection user count when linking to Collections. */
id_us_min(&collection->id);