Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-01-23 02:51:31 +0300
committerJoshua Leung <aligorith@gmail.com>2010-01-23 02:51:31 +0300
commit8dd14e1eed6f65af3a19a5cae8202c8f701e94ed (patch)
treed620b36b75d131d66032a88b021ba9e76a021d99 /source/blender/editors/space_graph
parentf0d89a041f89084c278f46949ebc6eeb07f73e85 (diff)
Graph Editor: Bugfixes for option where only the keyframes of selected F-Curves are shown
* Selected keyframes in unselected F-Curves were still being modified, although not shown * Selection tools for keyframes were changing the selection status of F-Curves, making keyframes sometimes disappear after trying to select another keyframe * Warning fixes in a few other files
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_select.c90
1 files changed, 62 insertions, 28 deletions
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 468467e3421..5b4292c4c74 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -109,6 +109,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
bAnimListElem *ale;
int filter;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditData bed;
BeztEditFunc test_cb, sel_cb;
@@ -142,13 +143,18 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
/* Keyframes First */
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL);
- /* deactivate the F-Curve, and deselect if deselecting keyframes.
- * otherwise select the F-Curve too since we've selected all the keyframes
- */
- if (sel == SELECT_SUBTRACT)
- fcu->flag &= ~FCURVE_SELECTED;
- else
- fcu->flag |= FCURVE_SELECTED;
+ /* only change selection of channel when the visibility of keyframes doesn't depend on this */
+ if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+ /* deactivate the F-Curve, and deselect if deselecting keyframes.
+ * otherwise select the F-Curve too since we've selected all the keyframes
+ */
+ if (sel == SELECT_SUBTRACT)
+ fcu->flag &= ~FCURVE_SELECTED;
+ else
+ fcu->flag |= FCURVE_SELECTED;
+ }
+
+ /* always deactivate all F-Curves if we perform batch ops for selection */
fcu->flag &= ~FCURVE_ACTIVE;
}
@@ -214,6 +220,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
bAnimListElem *ale;
int filter;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditData bed;
BeztEditFunc ok_cb, select_cb;
View2D *v2d= &ac->ar->v2d;
@@ -264,9 +271,12 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
/* select keyframes that are in the appropriate places */
ANIM_fcurve_keys_bezier_loop(&bed, fcu, ok_cb, select_cb, NULL);
- /* select the curve too now that curve will be touched */
- if (selectmode == SELECT_ADD)
- fcu->flag |= FCURVE_SELECTED;
+ /* only change selection of channel when the visibility of keyframes doesn't depend on this */
+ if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+ /* select the curve too now that curve will be touched */
+ if (selectmode == SELECT_ADD)
+ fcu->flag |= FCURVE_SELECTED;
+ }
}
/* un-apply NLA mapping from all the keyframes */
@@ -290,7 +300,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- if(RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
+ if (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
selectmode= SELECT_ADD;
else
selectmode= SELECT_SUBTRACT;
@@ -584,7 +594,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc
* include the 'only selected' flag...
*/
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
- if (sipo->flag & SIPO_SELCUVERTSONLY)
+ if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -670,6 +680,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc
/* option 1) select keyframe directly under mouse */
static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, short curves_only)
{
+ SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
FCurve *fcu;
BezTriple *bezt;
short handle;
@@ -687,9 +698,15 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
/* reset selection mode */
select_mode= SELECT_ADD;
- /* deselect all other channels and keyframes */
- //ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ /* deselect all other keyframes */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+
+ /* deselect other channels too, but only only do this if
+ * selection of channel when the visibility of keyframes
+ * doesn't depend on this
+ */
+ if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
/* if points can be selected on this F-Curve */
@@ -746,16 +763,19 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL);
}
- /* select or deselect curve? */
- if (select_mode == SELECT_INVERT)
- fcu->flag ^= FCURVE_SELECTED;
- else if (select_mode == SELECT_ADD)
- fcu->flag |= FCURVE_SELECTED;
-
- /* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
- if (fcu->flag & FCURVE_SELECTED) {
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
- ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+ /* only change selection of channel when the visibility of keyframes doesn't depend on this */
+ if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+ /* select or deselect curve? */
+ if (select_mode == SELECT_INVERT)
+ fcu->flag ^= FCURVE_SELECTED;
+ else if (select_mode == SELECT_ADD)
+ fcu->flag |= FCURVE_SELECTED;
+
+ /* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
+ if (fcu->flag & FCURVE_SELECTED) {
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+ }
}
}
@@ -766,6 +786,7 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor
bAnimListElem *ale;
int filter;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditFunc ok_cb, select_cb;
BeztEditData bed;
Scene *scene= ac->scene;
@@ -775,9 +796,15 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor
/* reset selection mode to add to selection */
select_mode= SELECT_ADD;
- /* deselect all other channels and keyframes */
- ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ /* deselect all other keyframes */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+
+ /* deselect other channels too, but only only do this if
+ * selection of channel when the visibility of keyframes
+ * doesn't depend on this
+ */
+ if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
/* set callbacks and editing data */
@@ -822,6 +849,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec
bAnimListElem *ale;
int filter;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditFunc select_cb, ok_cb;
BeztEditData bed;
FCurve *fcu;
@@ -841,9 +869,15 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec
/* reset selection mode to add to selection */
select_mode= SELECT_ADD;
- /* deselect all other channels and keyframes */
- ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ /* deselect all other keyframes */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+
+ /* deselect other channels too, but only only do this if
+ * selection of channel when the visibility of keyframes
+ * doesn't depend on this
+ */
+ if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
/* initialise keyframe editing data */