From b46e828b0c3ca0d7a136d97be8d68f13efc3be2b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 8 Oct 2020 13:22:53 +0200 Subject: Cleanup/refactor: move default init of armature to proper place. --- source/blender/blenkernel/intern/armature.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/armature.c') diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index db5a5ce8ddf..1406ee02afd 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -38,6 +38,8 @@ #include "BLI_utildefines.h" #include "BLT_translation.h" +#include "DNA_defaults.h" + #include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_listBase.h" @@ -87,6 +89,14 @@ static void copy_bonechildren_custom_handles(Bone *bone_dst, bArmature *arm_dst) /** \name Armature Data-block * \{ */ +static void armature_init_data(ID *id) +{ + bArmature *armature = (bArmature *)id; + BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(armature, id)); + + MEMCPY_STRUCT_AFTER(armature, DNA_struct_default_get(bArmature), id); +} + /** * Only copy internal data of Armature ID from source * to already allocated/initialized destination. @@ -308,7 +318,7 @@ IDTypeInfo IDType_ID_AR = { .translation_context = BLT_I18NCONTEXT_ID_ARMATURE, .flags = 0, - .init_data = NULL, + .init_data = armature_init_data, .copy_data = armature_copy_data, .free_data = armature_free_data, .make_local = NULL, @@ -332,9 +342,6 @@ bArmature *BKE_armature_add(Main *bmain, const char *name) bArmature *arm; arm = BKE_id_new(bmain, ID_AR, name); - arm->deformflag = ARM_DEF_VGROUP | ARM_DEF_ENVELOPE; - arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */ - arm->layer = 1; return arm; } -- cgit v1.2.3