[Bf-animsys] Graph editor - selecting things

Jess Balint jbalint at gmail.com
Fri May 29 05:32:07 CEST 2009


Hi,
I've attached a patch to get "Only display selected Objects" option
working in the graph editor. I think it makes sense, unless there's some
other global way to enforce this constraint.

However, the fact that border select (and some others), don't select the
associated channel when the control points are selected, means you can
still have some keys selected (and invisible) that would be translated
with a visible key selection. Would it make sense for all selection
operations to sync the channel selection to match that of the keys?
(and likewise for deselection, eg deselect a channel when none of its
keys are selected)

Jess
-------------- next part --------------
Index: source/blender/editors/space_graph/graph_select.c
===================================================================
--- source/blender/editors/space_graph/graph_select.c	(revision 20473)
+++ source/blender/editors/space_graph/graph_select.c	(working copy)
@@ -110,10 +110,13 @@
 	
 	BeztEditData bed;
 	BeztEditFunc test_cb, sel_cb;
-	
+	SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+
 	/* determine type-based settings */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
-	
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
+
 	/* filter data */
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
@@ -212,6 +215,7 @@
 	BeztEditFunc ok_cb, select_cb;
 	View2D *v2d= &ac->ar->v2d;
 	rctf rectf;
+	SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
 	
 	/* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
 	UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
@@ -219,6 +223,8 @@
 	
 	/* filter data */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
 	/* get beztriple editing/validation funcs  */
@@ -359,6 +365,7 @@
 	BeztEditFunc ok_cb, select_cb;
 	BeztEditData bed;
 	float min, max;
+	SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
 	
 	/* get extreme markers */
 	ED_markers_get_minmax(ac->markers, 1, &min, &max);
@@ -375,6 +382,8 @@
 	
 	/* filter data */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
 	/* select keys in-between */
@@ -407,7 +416,8 @@
 	CfraElem *ce;
 	BeztEditFunc select_cb, ok_cb;
 	BeztEditData bed;
-	
+	SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+
 	/* initialise keyframe editing data */
 	memset(&bed, 0, sizeof(BeztEditData));
 	
@@ -415,6 +425,8 @@
 	switch (mode) {
 		case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
 			filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+			if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+			  filter |= ANIMFILTER_SEL;
 			ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 			
 			for (ale= anim_data.first; ale; ale= ale->next)
@@ -447,6 +459,8 @@
 	 * based on the keys found to be selected above
 	 */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
 	for (ale= anim_data.first; ale; ale= ale->next) {
@@ -562,6 +576,8 @@
 	
 	/* get curves to search through */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
 	for (ale= anim_data.first; ale; ale= ale->next) {
@@ -736,6 +752,7 @@
 	BeztEditFunc ok_cb, select_cb;
 	BeztEditData bed;
 	Scene *scene= ac->scene;
+	SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
 	
 	/* if select mode is replace, deselect all keyframes (and channels) first */
 	if (select_mode==SELECT_REPLACE) {
@@ -763,6 +780,8 @@
 	
 	/* filter data */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 		
 	/* select keys on the side where most data occurs */
@@ -794,6 +813,7 @@
 	FCurve *fcu;
 	BezTriple *bezt;
 	float selx = (float)ac->scene->r.cfra;
+	SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
 	
 	/* find the beztriple that occurs on this frame, and use his as the frame number we're using */
 	findnearest_fcurve_vert(ac, mval, &fcu, &bezt);
@@ -824,6 +844,8 @@
 	 * based on the keys found to be selected above
 	 */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+	if (sipo->ads->filterflag & ADS_FILTER_ONLYSEL)
+	  filter |= ANIMFILTER_SEL;
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
 	for (ale= anim_data.first; ale; ale= ale->next) {


More information about the Bf-animsys mailing list