[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60486] trunk/blender/source/blender: add assert for bone renaming, to check if the chanhash is still valid.

Campbell Barton ideasman42 at gmail.com
Tue Oct 1 15:28:59 CEST 2013


Revision: 60486
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60486
Author:   campbellbarton
Date:     2013-10-01 13:28:59 +0000 (Tue, 01 Oct 2013)
Log Message:
-----------
add assert for bone renaming, to check if the chanhash is still valid.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_action.h
    trunk/blender/source/blender/blenkernel/intern/action.c
    trunk/blender/source/blender/editors/armature/armature_naming.c

Modified: trunk/blender/source/blender/blenkernel/BKE_action.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_action.h	2013-10-01 12:56:25 UTC (rev 60485)
+++ trunk/blender/source/blender/blenkernel/BKE_action.h	2013-10-01 13:28:59 UTC (rev 60486)
@@ -188,6 +188,10 @@
  */
 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);
 

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2013-10-01 12:56:25 UTC (rev 60485)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2013-10-01 13:28:59 UTC (rev 60486)
@@ -489,6 +489,22 @@
 	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)
 {

Modified: trunk/blender/source/blender/editors/armature/armature_naming.c
===================================================================
--- trunk/blender/source/blender/editors/armature/armature_naming.c	2013-10-01 12:56:25 UTC (rev 60485)
+++ trunk/blender/source/blender/editors/armature/armature_naming.c	2013-10-01 13:28:59 UTC (rev 60486)
@@ -192,6 +192,8 @@
 							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 */




More information about the Bf-blender-cvs mailing list