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:
authorCampbell Barton <ideasman42@gmail.com>2013-10-01 17:28:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-10-01 17:28:59 +0400
commit9883641f46ebf4a9db407f125903a45ea617464e (patch)
treec5705d9e93d85a77396f1b84568bdf135cb9de0b /source/blender
parent4c3d9e358be04b6b2d8979ae9ef59e4b86f3bf13 (diff)
add assert for bone renaming, to check if the chanhash is still valid.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_action.h4
-rw-r--r--source/blender/blenkernel/intern/action.c16
-rw-r--r--source/blender/editors/armature/armature_naming.c2
3 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index d485632955d..698098d28c3 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 644fefad3b0..b0644da4598 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -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)
{
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index 98128404977..60f5e69621f 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -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 */