[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45372] trunk/blender/source/blender/ editors/armature/poseobject.c: fix [#30340] bpy.ops.pose.select_hierarchy() doesn't work on disconnected parents/children

Campbell Barton ideasman42 at gmail.com
Tue Apr 3 14:20:52 CEST 2012


Revision: 45372
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45372
Author:   campbellbarton
Date:     2012-04-03 12:20:44 +0000 (Tue, 03 Apr 2012)
Log Message:
-----------
fix [#30340] bpy.ops.pose.select_hierarchy() doesn't work on disconnected parents/children

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/poseobject.c

Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c	2012-04-03 12:02:32 UTC (rev 45371)
+++ trunk/blender/source/blender/editors/armature/poseobject.c	2012-04-03 12:20:44 UTC (rev 45372)
@@ -407,8 +407,30 @@
 					}
 				} 
 				else { /* direction == BONE_SELECT_CHILD */
+
+					/* the child member is only assigned to connected bones, see [#30340] */
+#if 0
 					if (pchan->child == NULL) continue;
 					else chbone = pchan->child->bone;
+#else
+					/* instead. find _any_ visible child bone, using the first one is a little arbitrary  - campbell */
+					chbone = pchan->child ? pchan->child->bone : NULL;
+					if (chbone == NULL) {
+						bPoseChannel *pchan_child;
+
+						for (pchan_child = ob->pose->chanbase.first; pchan_child; pchan_child = pchan_child->next) {
+							/* possible we have multiple children, some invisible */
+							if (PBONE_VISIBLE(arm, pchan_child->bone)) {
+								if (pchan_child->parent == pchan) {
+									chbone = pchan_child->bone;
+									break;
+								}
+							}
+						}
+					}
+
+					if (chbone == NULL) continue;
+#endif
 					
 					if (PBONE_VISIBLE(arm, chbone)) {
 						if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;




More information about the Bf-blender-cvs mailing list