diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-05-26 13:43:03 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-05-26 13:43:03 +0300 |
commit | 8a6604f253e22bbade3dcf60b9a1c437ace44151 (patch) | |
tree | fee875d0a0b09fbe0df52aa83094159144048205 /source/blender/blenkernel/intern/armature.c | |
parent | edf1b833674a6e54df7a16c14f0c6193fbbb482e (diff) | |
parent | afec66c024dc2b75447537d45406c06342ec201e (diff) |
Merge branch 'master' into temp-gpencil-maskingtemp-gpencil-masking
Conflicts:
source/blender/blenloader/intern/versioning_300.c
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index a1ebec1d756..4ea71922df5 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2444,7 +2444,7 @@ static void pose_proxy_sync(Object *ob, Object *from, int layer_protected) static int rebuild_pose_bone( bPose *pose, Bone *bone, bPoseChannel *parchan, int counter, Bone **r_last_visited_bone_p) { - bPoseChannel *pchan = BKE_pose_channel_verify(pose, bone->name); /* verify checks and/or adds */ + bPoseChannel *pchan = BKE_pose_channel_ensure(pose, bone->name); /* verify checks and/or adds */ pchan->bone = bone; pchan->parent = parchan; @@ -2515,6 +2515,17 @@ void BKE_pchan_rebuild_bbone_handles(bPose *pose, bPoseChannel *pchan) pchan->bbone_next = pose_channel_find_bone(pose, pchan->bone->bbone_next); } +void BKE_pose_channels_clear_with_null_bone(bPose *pose, const bool do_id_user) +{ + LISTBASE_FOREACH_MUTABLE (bPoseChannel *, pchan, &pose->chanbase) { + if (pchan->bone == NULL) { + BKE_pose_channel_free_ex(pchan, do_id_user); + BKE_pose_channels_hash_free(pose); + BLI_freelinkN(&pose->chanbase, pchan); + } + } +} + /** * Only after leave editmode, duplicating, validating older files, library syncing. * @@ -2526,7 +2537,7 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_ { Bone *bone; bPose *pose; - bPoseChannel *pchan, *next; + bPoseChannel *pchan; int counter = 0; /* only done here */ @@ -2549,16 +2560,9 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_ } /* and a check for garbage */ - for (pchan = pose->chanbase.first; pchan; pchan = next) { - next = pchan->next; - if (pchan->bone == NULL) { - BKE_pose_channel_free_ex(pchan, do_id_user); - BKE_pose_channels_hash_free(pose); - BLI_freelinkN(&pose->chanbase, pchan); - } - } + BKE_pose_channels_clear_with_null_bone(pose, do_id_user); - BKE_pose_channels_hash_make(pose); + BKE_pose_channels_hash_ensure(pose); for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { /* Find the custom B-Bone handles. */ @@ -2877,7 +2881,8 @@ bool BKE_pose_minmax(Object *ob, float r_min[3], float r_max[3], bool use_hidden NULL; if (bb_custom) { float mat[4][4], smat[4][4]; - scale_m4_fl(smat, PCHAN_CUSTOM_DRAW_SIZE(pchan)); + scale_m4_fl(smat, PCHAN_CUSTOM_BONE_LENGTH(pchan)); + rescale_m4(smat, pchan->custom_scale_xyz); mul_m4_series(mat, ob->obmat, pchan_tx->pose_mat, smat); BKE_boundbox_minmax(bb_custom, mat, r_min, r_max); } |