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 14:22:53 +0300
committerBastien Montagne <bastien@blender.org>2020-10-08 14:23:30 +0300
commitb46e828b0c3ca0d7a136d97be8d68f13efc3be2b (patch)
treeef75b8dacf60daab09b165b42811cef3de76319f /source/blender/blenkernel/intern/armature.c
parentcbbdfe24aff76f610c2cd6c2f5210e2ed1aab00d (diff)
Cleanup/refactor: move default init of armature to proper place.
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r--source/blender/blenkernel/intern/armature.c15
1 files changed, 11 insertions, 4 deletions
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;
}