[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26702] trunk/blender/source/blender/ editors/armature/editarmature.c: Bugfix: Toggle Select All behaviour in PoseMode was not correctly taking the active bone into account

Joshua Leung aligorith at gmail.com
Mon Feb 8 12:00:43 CET 2010


Revision: 26702
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26702
Author:   aligorith
Date:     2010-02-08 12:00:43 +0100 (Mon, 08 Feb 2010)

Log Message:
-----------
Bugfix: Toggle Select All behaviour in PoseMode was not correctly taking the active bone into account

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

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2010-02-08 10:47:34 UTC (rev 26701)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2010-02-08 11:00:43 UTC (rev 26702)
@@ -5114,11 +5114,20 @@
 	int action = RNA_enum_get(op->ptr, "action");
 
 	if (action == SEL_TOGGLE) {
-		action = SEL_SELECT;
-		/* Determine if there are any selected bones and therefore whether we are selecting or deselecting */
-		// NOTE: we have to check for > 1 not > 0, since there is almost always an active bone that can't be cleared...
-		if (CTX_DATA_COUNT(C, selected_pose_bones) > 1)
+		bPoseChannel *pchan= CTX_data_active_pose_bone(C);
+		int num_sel = CTX_DATA_COUNT(C, selected_pose_bones);
+		
+		/* cases for deselect:
+		 * 	1) there's only one bone selected, and that is the active one
+		 *	2) there's more than one bone selected
+		 */
+		if ( ((num_sel == 1) && (pchan) && (pchan->bone->flag & BONE_SELECTED)) ||
+			 (num_sel > 1) )
+		{
 			action = SEL_DESELECT;
+		}
+		else 
+			action = SEL_SELECT;
 	}
 	
 	/*	Set the flags */





More information about the Bf-blender-cvs mailing list