[Bf-blender-cvs] [b46e828b0c3] master: Cleanup/refactor: move default init of armature to proper place.

Bastien Montagne noreply at git.blender.org
Thu Oct 8 13:24:26 CEST 2020


Commit: b46e828b0c3ca0d7a136d97be8d68f13efc3be2b
Author: Bastien Montagne
Date:   Thu Oct 8 13:22:53 2020 +0200
Branches: master
https://developer.blender.org/rBb46e828b0c3ca0d7a136d97be8d68f13efc3be2b

Cleanup/refactor: move default init of armature to proper place.

===================================================================

M	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;
 }



More information about the Bf-blender-cvs mailing list