forked from bartvdbraak/blender
add assert for bone renaming, to check if the chanhash is still valid.
This commit is contained in:
parent
4c3d9e358b
commit
9883641f46
@ -188,6 +188,10 @@ struct bPoseChannel *BKE_pose_channel_active(struct Object *ob);
|
||||
*/
|
||||
struct bPoseChannel *BKE_pose_channel_verify(struct bPose *pose, const char *name);
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool BKE_pose_channels_is_valid(const struct bPose *pose);
|
||||
#endif
|
||||
|
||||
/* Copy the data from the action-pose (src) into the pose */
|
||||
void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
|
||||
|
||||
|
@ -489,6 +489,22 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
|
||||
return chan;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool BKE_pose_channels_is_valid(const bPose *pose)
|
||||
{
|
||||
if (pose->chanhash) {
|
||||
bPoseChannel *pchan;
|
||||
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
|
||||
if (BLI_ghash_lookup(pose->chanhash, pchan->name) != pchan) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Find the active posechannel for an object (we can't just use pose, as layer info is in armature) */
|
||||
bPoseChannel *BKE_pose_channel_active(Object *ob)
|
||||
{
|
||||
|
@ -192,6 +192,8 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
|
||||
BLI_ghash_insert(gh, pchan->name, pchan);
|
||||
}
|
||||
}
|
||||
|
||||
BLI_assert(BKE_pose_channels_is_valid(ob->pose) == true);
|
||||
}
|
||||
|
||||
/* Update any object constraints to use the new bone name */
|
||||
|
Loading…
Reference in New Issue
Block a user