[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26622] trunk/blender/source/blender/ editors/animation/anim_filter.c: Bugfix for "Show Only Selected" option and Bones (in Animation Editors):

Joshua Leung aligorith at gmail.com
Fri Feb 5 12:52:51 CET 2010


Revision: 26622
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26622
Author:   aligorith
Date:     2010-02-05 12:52:51 +0100 (Fri, 05 Feb 2010)

Log Message:
-----------
Bugfix for "Show Only Selected" option and Bones (in Animation Editors):

If you have some bones selected, and then hide their layer, they would stay selected + visible even when you make another selection. Now, they are hidden and are no longer visible when they aren't on visible layers. 

Currently, this is only done if the channels are being filtered by visibility, but this could easily be changed to do without this check. Will see how this goes after some production testing. :)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_filter.c

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c	2010-02-05 11:39:58 UTC (rev 26621)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c	2010-02-05 11:52:51 UTC (rev 26622)
@@ -775,7 +775,8 @@
  
 /* ----------------------------------------- */
 
-static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id)
+/* NOTE: when this function returns true, the F-Curve is to be skipped */
+static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id, int filter_mode)
 {
 	if (GS(owner_id->name) == ID_OB) {
 		Object *ob= (Object *)owner_id;
@@ -790,9 +791,21 @@
 			pchan= get_pose_channel(ob->pose, bone_name);
 			if (bone_name) MEM_freeN(bone_name);
 			
-			/* can only add this F-Curve if it is selected */
-			if ((pchan) && (pchan->bone) && (pchan->bone->flag & BONE_SELECTED)==0)
-				return 1;
+			/* check whether to continue or skip */
+			if ((pchan) && (pchan->bone)) {
+				/* if only visible channels, skip if bone not visible */
+				// TODO: should we just do this always?
+				if (filter_mode & ANIMFILTER_VISIBLE) {
+					bArmature *arm= (bArmature *)ob->data;
+					
+					if ((arm->layer & pchan->bone->layer) == 0)
+						return 1;
+				}
+				
+				/* can only add this F-Curve if it is selected */
+				if ((pchan->bone->flag & BONE_SELECTED) == 0)
+					return 1;
+			}
 		}
 	}
 	else if (GS(owner_id->name) == ID_SCE) {
@@ -853,15 +866,16 @@
 		 *	- this will also affect things like Drivers, and also works for Bone Constraints
 		 */
 		if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) && (owner_id) ) {
-			if (skip_fcurve_selected_data(fcu, owner_id))
+			if (skip_fcurve_selected_data(fcu, owner_id, filter_mode))
 				continue;
 		}
-				
+			
 		/* only include if visible (Graph Editor check, not channels check) */
 		if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
 			/* only work with this channel and its subchannels if it is editable */
 			if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
 				/* only include this curve if selected in a way consistent with the filtering requirements */
+				// FIXME: the first selection test is buggered, and works wrong for sel+curvesonly filtering
 				if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) {
 					/* only include if this curve is active */
 					if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) {





More information about the Bf-blender-cvs mailing list