From 435229e3b3383af59fcafb23691fcb458b84e714 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 24 May 2011 12:24:05 +0000 Subject: Bugfix [#27453] Copy Paste fcurve modifers is broken Wrong poll was getting used --- source/blender/editors/space_graph/graph_edit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 962cadba1f3..0da03832d15 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2248,7 +2248,7 @@ void GRAPH_OT_fmodifier_paste (wmOperatorType *ot) /* api callbacks */ ot->exec= graph_fmodifier_paste_exec; - ot->poll= graphop_editable_keyframes_poll; + ot->poll= graphop_active_fcurve_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -- cgit v1.2.3 From 80e2f6c68ce3351f78c944a37557c969f9308a7a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 25 May 2011 13:10:07 +0000 Subject: Swapped hotkey for setting interpolation from Shift-T to TKEY, since this is more commonly used that the TimeSlide tool (which is DopeSheet only). Noticed that this does bring this out of line with the hotkey for setting extrapolation, but then again, extrapolation is a per-curve setting. --- source/blender/editors/space_graph/graph_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 03cc8bb9e80..544df2dab70 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -361,7 +361,7 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", VKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, 0, 0); /* destructive */ WM_keymap_add_item(keymap, "GRAPH_OT_clean", OKEY, KM_PRESS, 0, 0); -- cgit v1.2.3 From 23888be4238f992e5f57638b953b01b778975e8f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 1 Jun 2011 06:26:54 +0000 Subject: Usability Tweak [#27469] Adding/Rename markers (M/Ctrl-M) were restricted to only being available when the mouse was hovering just over the time scroller at the bottom of animation editors, as otherwise we'd get nasty keymap conflicts where markers keymap would block all the primary function keymaps. However, in the case of Adding/Renaming markers, there are no other keys which currently conflict with these in such cases. Hence, it is fine to let these ones be able to be run from anywhere within the animation editors, which should make it easier to add markers for lipsyncing purposes again for example. --- source/blender/editors/space_graph/graph_ops.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 544df2dab70..0d7cdf94bc7 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -46,6 +46,7 @@ #include "UI_view2d.h" #include "ED_anim_api.h" +#include "ED_markers.h" #include "ED_screen.h" #include "ED_transform.h" @@ -399,6 +400,9 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) /* transform system */ transform_keymap_for_space(keyconf, keymap, SPACE_IPO); + + /* special markers hotkeys for anim editors: see note in definition of this function */ + ED_marker_keymap_animedit_conflictfree(keymap); } /* --------------- */ -- cgit v1.2.3 From a4216cb1d4336bd2244f4519398db0b9f19833ad Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 13 Jun 2011 13:54:21 +0000 Subject: Transformation Channel Driver Variables - "Proper Localspace" By popular demand, the "Transformation Channel" driver variable type now has a "local space" transform space option which uses the same magic that constraints use for defining local-space. This is what many bug reporters and feature requesters have moaned about for a while now, so after reviewing several of the bug reports which lead to the current situation, here is what has been much-wanted for so long! In order to implement this, I've: - renamed the old "Local Space" option here to "Transformation Space", in order to prevent old rigs breaking. This has also been kept, as it is useful for #21384 (though perhaps with this new option it isn't needed anymore) - reviewed my fix for #20870 (IIRC, a Durian-era bug), which related to the non-uniqueness of matrix->euler decomposition --- source/blender/editors/space_graph/graph_buttons.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index fb1144b4fa8..e820fdbb642 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -493,7 +493,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar DriverTarget *dtar= &dvar->targets[0]; Object *ob = (Object *)dtar->id; PointerRNA dtar_ptr; - uiLayout *col, *row; + uiLayout *col, *subcol; /* initialise RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); @@ -509,9 +509,9 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - row= uiLayoutRow(layout, 1); - uiItemR(row, &dtar_ptr, "transform_type", 0, "", ICON_NONE); - uiItemR(row, &dtar_ptr, "use_local_space_transform", 0, NULL, ICON_NONE); + subcol= uiLayoutColumn(layout, 1); + uiItemR(subcol, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE); + uiItemR(subcol, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE); } /* driver settings for active F-Curve (only for 'Drivers' mode) */ -- cgit v1.2.3 From 7272bb643c379986c7332a994ce9e576d3b8a748 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 14 Jun 2011 11:01:36 +0000 Subject: Bugfix: Distance DVar doesn't work with new Local Space Fixed references in UI to the old property, and adapted the backend code to work for the new options too. --- source/blender/editors/space_graph/graph_buttons.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index e820fdbb642..3073ff13075 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -472,7 +472,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, ICON_NONE); + uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE); col= uiLayoutColumn(layout, 1); uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); @@ -484,7 +484,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - uiItemR(col, &dtar2_ptr, "use_local_space_transform", 0, NULL, ICON_NONE); + uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE); } /* settings for 'transform channel' driver variable type */ -- cgit v1.2.3 From 3cad2a72b5d7e0dc18c56222a77fdf2d747f460c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 21 Jun 2011 01:41:39 +0000 Subject: Animation Channel Filtering Refactor - Part 1 * Removed list-expanders for Materials, Textures, and Particles. So instead of: Object Materials Material 1 ... material 1 anim data ... we now have Object Material 1 ... material 1 anim data ... This makes it faster+easier to get to these items. If you don't want to see all of these, you can still use the data-block filters from the header to hide these. * Internal cleanup - removed "owner" and "ownertype" settings from bAnimListElem. The purpose of these was muddled, and more of a hassle to maintain than doing anything useful - it was only really used for the stuff above. * Removed need for "sa->spacedata.first" casts all over the show for animation editor tools which needed access to editor data. This can now be retrieved directly. --- source/blender/editors/space_graph/graph_edit.c | 10 +++++----- source/blender/editors/space_graph/graph_select.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 0da03832d15..71c937b87cb 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -279,7 +279,7 @@ void GRAPH_OT_view_selected (wmOperatorType *ot) /* Bake each F-Curve into a set of samples, and store as a ghost curve */ static void create_ghost_curves (bAnimContext *ac, int start, int end) { - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; @@ -399,7 +399,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - sipo= (SpaceIpo *)ac.sa->spacedata.first; + sipo= (SpaceIpo *)ac.sl; /* if no ghost curves, don't do anything */ if (sipo->ghostCurves.first == NULL) @@ -1725,7 +1725,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) /* set the new current frame and cursor values, based on the average time and value */ if (ked.i1) { - SpaceIpo *sipo= ac.sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac.sl; Scene *scene= ac.scene; /* take the average values, rounding to the nearest int for the current frame */ @@ -1792,7 +1792,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode) ked.list.last= (ac->markers) ? ac->markers->last : NULL; } else if (mode == GRAPHKEYS_SNAP_VALUE) { - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; ked.f1= (sipo) ? sipo->cursorVal : 0.0f; } @@ -1906,7 +1906,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) return; } else if (mode == GRAPHKEYS_MIRROR_VALUE) { - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; ked.f1= (sipo) ? sipo->cursorVal : 0.0f; } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index cb799b85d3a..507ee43c6aa 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -90,7 +90,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel) bAnimListElem *ale; int filter; - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; KeyframeEditData ked= {{NULL}}; KeyframeEditFunc test_cb, sel_cb; @@ -201,7 +201,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho bAnimListElem *ale; int filter; - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; KeyframeEditData ked; KeyframeEditFunc ok_cb, select_cb; View2D *v2d= &ac->ar->v2d; @@ -958,7 +958,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2], bAnimListElem *ale; int filter; - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; View2D *v2d= &ac->ar->v2d; /* get curves to search through @@ -1091,7 +1091,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, const int m /* option 1) select keyframe directly under mouse */ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_mode, short curves_only) { - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; tNearestVertInfo *nvi; BezTriple *bezt= NULL; @@ -1218,7 +1218,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short bAnimListElem *ale; int filter; - SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)ac->sl; KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked; tNearestVertInfo *nvi; -- cgit v1.2.3 From 24ca3eb4c42f3dfb4e2b775f53b35e4c4dcd8367 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 21 Jun 2011 04:01:51 +0000 Subject: AnimFiltering Code Cleanups - Part 2 * Changed all int's to size_t's, where the int's were used for size of channel list returned * Object vs Base is now passed to filtering functions - was relic from old owner/ownertype code which required access to bases * Found bug in NLA code where filter was being overwritten and then used again as input for some other function unintentionally * Found bug where trying to select a NLA strip would crash if lamp data was around --- source/blender/editors/space_graph/graph_draw.c | 3 ++- source/blender/editors/space_graph/graph_utils.c | 11 +++++++---- source/blender/editors/space_graph/space_graph.c | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 382bb71a592..73ecea8e31e 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -964,7 +964,8 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) View2D *v2d= &ar->v2d; float y= 0.0f, height; - int items, i=0; + size_t items; + int i=0; /* build list of channels to draw */ filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index e4509a29a91..e20b4593fa9 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -70,7 +70,7 @@ bAnimListElem *get_active_fcurve_channel (bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE | ANIMFILTER_CURVESONLY); - int items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* We take the first F-Curve only, since some other ones may have had 'active' flag set * if they were from linked data. @@ -99,7 +99,8 @@ int graphop_visible_keyframes_poll (bContext *C) bAnimListElem *ale; ListBase anim_data = {NULL, NULL}; ScrArea *sa= CTX_wm_area(C); - int filter, items; + size_t items; + int filter; short found = 0; /* firstly, check if in Graph Editor */ @@ -147,7 +148,8 @@ int graphop_editable_keyframes_poll (bContext *C) bAnimListElem *ale; ListBase anim_data = {NULL, NULL}; ScrArea *sa= CTX_wm_area(C); - int filter, items; + size_t items; + int filter; short found = 0; /* firstly, check if in Graph Editor */ @@ -230,7 +232,8 @@ int graphop_selected_fcurve_poll (bContext *C) bAnimContext ac; ListBase anim_data = {NULL, NULL}; ScrArea *sa= CTX_wm_area(C); - int filter, items; + size_t items; + int filter; /* firstly, check if in Graph Editor */ // TODO: also check for region? diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 883b476f372..24e196749a8 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -513,8 +513,9 @@ static void graph_refresh(const bContext *C, ScrArea *sa) if (ANIM_animdata_get_context(C, &ac)) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; + size_t items; int filter; - int items, i; + int i; /* build list of F-Curves which will be visible as channels in channel-region * - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a -- cgit v1.2.3 From ab2026bf4271ba316ffe621eb142091127ee1cf0 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 22 Jun 2011 11:41:26 +0000 Subject: Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split) * This (big) commit is aimed at cleaning up the filtering flags used by the animation channel filtering code. The list of filtering flags has been growing a bit "organically" since it's humble origins for use in the Action Editor some 3 years (IIRC) ago now during a weekend hackathon. Obviously, some things have ended up tacked on, while others have been the product of other flag options. Nevertheless, it was time for a bit of a spring clean! * Most notably, one area where the system outgrown its original design for the Action Editor was in terms of the "visibility" filtering flag it was using. While in the Action Editor the concept of what channels to include was strictly dictated by whether the channel hierarchy showed it, in the Graph Editor this is not always the case. In other words, there was a difference between the data the channels represented being visible and the channels for that data being visible in the hierarchy. Long story short: this lead to bug report [#27076] (and many like it), where if you selected an F-Curve, then collapsed the Group it was in, then even after selecting another F-Curve in another Group, the original F-Curve's properties would still be shown in the Properties Region. The good news is that this commit fixes this issue right away! * More good news will follow, as I start checking on the flag usage of other tools, but I'm committing this first so that we have a stable reference (of code similar to the old buggy stuff) on which we can fall back to later to find bugs (should they pop up). Anyways, back to the trenches! --- source/blender/editors/space_graph/graph_draw.c | 4 +-- source/blender/editors/space_graph/graph_edit.c | 44 +++++++++++------------ source/blender/editors/space_graph/graph_select.c | 22 ++++++------ source/blender/editors/space_graph/graph_utils.c | 16 +++++---- source/blender/editors/space_graph/space_graph.c | 2 +- 5 files changed, 46 insertions(+), 42 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 73ecea8e31e..b5c253fdbff 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -834,7 +834,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri int filter; /* build list of curves to draw */ - filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_CURVEVISIBLE); + filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_CURVE_VISIBLE); filter |= ((sel) ? (ANIMFILTER_SEL) : (ANIMFILTER_UNSEL)); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -968,7 +968,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) int i=0; /* build list of channels to draw */ - filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* Update max-extent of channels here (taking into account scrollers): diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 71c937b87cb..6ae6ecf88fc 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -88,7 +88,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo int filter; /* get data to filter, from Dopesheet */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ @@ -294,7 +294,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) } /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -453,7 +453,7 @@ static void insert_graph_keys(bAnimContext *ac, short mode) short flag = 0; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); if (mode == 2) filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -648,7 +648,7 @@ static short copy_graph_keys (bAnimContext *ac) free_anim_copybuf(); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* copy keyframes */ @@ -667,7 +667,7 @@ static short paste_graph_keys (bAnimContext *ac, int filter, ok=0; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ @@ -773,7 +773,7 @@ static void duplicate_graph_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -842,7 +842,7 @@ static void delete_graph_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -909,7 +909,7 @@ static void clean_graph_keys (bAnimContext *ac, float thresh) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and clean curves */ @@ -976,7 +976,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -1123,7 +1123,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op) end = CFRA + sbi.length - 1; /* filter anim channels */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop through all selected F-Curves, replacing its data with the sound samples */ @@ -1201,7 +1201,7 @@ static void sample_graph_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -1270,7 +1270,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -1339,7 +1339,7 @@ static void setipo_graph_keys(bAnimContext *ac, short mode) KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation @@ -1412,7 +1412,7 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode) KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting flags for handles @@ -1534,7 +1534,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op) */ /* step 1: extract only the rotation f-curves */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1700,7 +1700,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) memset(&ked, 0, sizeof(KeyframeEditData)); /* loop over action data, averaging values */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1779,7 +1779,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode) KeyframeEditFunc edit_cb; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing callbacks */ @@ -1911,7 +1911,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) } /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* mirror keyframes */ @@ -1995,7 +1995,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* smooth keyframes */ @@ -2086,11 +2086,11 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) type= RNA_enum_get(op->ptr, "type"); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); if (RNA_boolean_get(op->ptr, "only_active")) filter |= ANIMFILTER_ACTIVE; // FIXME: enforce in this case only a single channel to get handled? else - filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVEVISIBLE); + filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVE_VISIBLE); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* add f-modifier to each curve */ @@ -2209,7 +2209,7 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* paste modifiers */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 507ee43c6aa..b8c5d79df18 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -95,7 +95,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel) KeyframeEditFunc test_cb, sel_cb; /* determine type-based settings */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); /* filter data */ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -212,7 +212,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing/validation funcs */ @@ -402,7 +402,7 @@ static void markers_selectkeys_between (bAnimContext *ac) ked.f2= max; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys in-between */ @@ -442,7 +442,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode) /* build list of columns */ switch (mode) { case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) @@ -474,7 +474,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode) /* loop through all of the keys and select additional keyframes * based on the keys found to be selected above */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -558,7 +558,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* loop through all of the keys and select additional keyframes based on these */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -613,7 +613,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode) memset(&ked, 0, sizeof(KeyframeEditData)); /* loop through all of the keys and select additional keyframes based on these */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -753,7 +753,7 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short } /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys */ @@ -965,7 +965,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2], * - if the option to only show keyframes that belong to selected F-Curves is enabled, * include the 'only selected' flag... */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); 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); @@ -1200,7 +1200,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_ /* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */ /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) otherwise the active flag won't be set [#26452] */ if (nvi->fcu->flag & FCURVE_SELECTED) { - int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + int filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, ANIMTYPE_FCURVE); } @@ -1264,7 +1264,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short /* loop through all of the keys and select additional keyframes * based on the keys found to be selected above */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index e20b4593fa9..3f2993fd793 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -65,11 +65,13 @@ /* Find 'active' F-Curve. It must be editable, since that's the purpose of these buttons (subject to change). * We return the 'wrapper' since it contains valuable context info (about hierarchy), which will need to be freed * when the caller is done with it. + * + * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome */ bAnimListElem *get_active_fcurve_channel (bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; - int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE | ANIMFILTER_CURVESONLY); + int filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE); size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* We take the first F-Curve only, since some other ones may have had 'active' flag set @@ -115,7 +117,7 @@ int graphop_visible_keyframes_poll (bContext *C) /* loop over the visible (selection doesn't matter) F-Curves, and see if they're suitable * stopping on the first successful match */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE); items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); if (items == 0) return 0; @@ -164,7 +166,7 @@ int graphop_editable_keyframes_poll (bContext *C) /* loop over the editable F-Curves, and see if they're suitable * stopping on the first successful match */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); if (items == 0) return 0; @@ -215,7 +217,7 @@ int graphop_active_fcurve_poll (bContext *C) /* free temp data... */ has_fcurve= ((ale->data) && (ale->type == ANIMTYPE_FCURVE)); - if(has_fcurve) { + if (has_fcurve) { FCurve *fcu= (FCurve *)ale->data; has_fcurve= (fcu->flag & FCURVE_VISIBLE)!=0; } @@ -244,8 +246,10 @@ int graphop_selected_fcurve_poll (bContext *C) if (ANIM_animdata_get_context(C, &ac) == 0) return 0; - /* get the editable + selected F-Curves, and as long as we got some, we can return */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + /* get the editable + selected F-Curves, and as long as we got some, we can return + * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome + */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT); items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); if (items == 0) return 0; diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 24e196749a8..f58963d1d98 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -521,7 +521,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa) * - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a * mismatch between channel-colors and the drawn curves */ - filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_NODUPLIS); items= ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop over F-Curves, assigning colors */ -- cgit v1.2.3 From fd3c5bef7e55ca22a96a74ca011e4ffe425e5321 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 27 Jun 2011 04:24:59 +0000 Subject: Bugfix: Selecting nodes now updates animation editors Noticed while testing the material nodes commit --- source/blender/editors/space_graph/space_graph.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index f58963d1d98..6a548a58507 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -464,6 +464,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn) break; } break; + case NC_NODE: + if (wmn->action == NA_SELECTED) { + /* selection changed, so force refresh to flush (needs flag set to do syncing) */ + sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; + ED_area_tag_refresh(sa); + } + break; case NC_SPACE: if(wmn->data == ND_SPACE_GRAPH) ED_area_tag_redraw(sa); -- cgit v1.2.3 From c9d6989098e2defbaea36b767169f521c8a5d62a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 7 Jul 2011 13:59:28 +0000 Subject: Animation Goodie: Cyclic "Extrapolation" can be toggled from the "Set Extrapolation" tool again Added "Make Cyclic" and "Clear Cyclic" options to "Set Extrapolation" tool (found from Channels menu) in Animation Editors. These options simply add or remove (respectively) Cycles FModifiers from the selected F-Curves, making them have cyclic extrapolation with a single click, instead of having to go through the FModifiers UI (or Graph- Editor only "Add FModifier" operator), which should make it easier to do this apparently common chore. --- source/blender/editors/space_graph/graph_edit.c | 36 ++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 4abf00f82d3..d88a18ffcbc 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1269,10 +1269,17 @@ void GRAPH_OT_sample (wmOperatorType *ot) /* ******************** Set Extrapolation-Type Operator *********************** */ +/* defines for make/clear cyclic extrapolation tools */ +#define MAKE_CYCLIC_EXPO -1 +#define CLEAR_CYCLIC_EXPO -2 + /* defines for set extrapolation-type for selected keyframes tool */ static EnumPropertyItem prop_graphkeys_expo_types[] = { {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", ""}, {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", ""}, + + {MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"}, + {CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"}, {0, NULL, 0, NULL, NULL} }; @@ -1290,7 +1297,34 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) /* loop through setting mode per F-Curve */ for (ale= anim_data.first; ale; ale= ale->next) { FCurve *fcu= (FCurve *)ale->data; - fcu->extend= mode; + + if (mode >= 0) { + /* just set mode setting */ + fcu->extend= mode; + } + else { + /* shortcuts for managing Cycles F-Modifiers to make it easier to toggle cyclic animation + * without having to go through FModifier UI in Graph Editor to do so + */ + if (mode == MAKE_CYCLIC_EXPO) { + /* only add if one doesn't exist */ + if (list_has_suitable_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, -1) == 0) { + // TODO: add some more preset versions which set different extrapolation options? + add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES); + } + } + else if (mode == CLEAR_CYCLIC_EXPO) { + /* remove all the modifiers fitting this description */ + FModifier *fcm, *fcn=NULL; + + for (fcm = fcu->modifiers.first; fcm; fcm = fcn) { + fcn = fcm->next; + + if (fcm->type == FMODIFIER_TYPE_CYCLES) + remove_fmodifier(&fcu->modifiers, fcm); + } + } + } } /* cleanup */ -- cgit v1.2.3 From 77e906cbd43accb3de89d0ac922d72e1c154aee9 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 26 Jul 2011 12:49:43 +0000 Subject: Experimental drawing tweak: make active F-Curve get drawn with thicker line width This should help make it stand out better from the background, though it has the risk that values may not be so clearly picked up visually --- source/blender/editors/space_graph/graph_draw.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index b5c253fdbff..ac0455392cc 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -877,6 +877,11 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu)); } + /* draw active F-Curve thicker than the rest to make it stand out */ + if (fcu->flag & FCURVE_ACTIVE) { + glLineWidth(2.0); + } + /* anti-aliased lines for less jagged appearance */ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); @@ -898,6 +903,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* restore settings */ setlinestyle(0); + glLineWidth(1.0); if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); -- cgit v1.2.3 From 785e634c231542b5eb481946c93a3f8c65ad73a1 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 26 Jul 2011 13:09:10 +0000 Subject: F-Curve Drawing - Smoother curves Bezier curves are now drawn smoother (i.e. less segmented), especially for curve segments where there is a very large vertical displacement over a short period of time (i.e. 120 degrees rotation over 1 frame) and/or often when zoomed in a bit too. - Made the resolution calculation take the vertical distance into account too, instead of just the horizontal distance. - Segment multiplier changed from 3 to 5, as this seems to give better zoomed-in performance. --- source/blender/editors/space_graph/graph_draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index ac0455392cc..a1b8cf0df91 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -706,12 +706,11 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View * - resol determines number of points to sample in between keyframes */ - /* resol not depending on horizontal resolution anymore, drivers for example... */ - // TODO: would be nice to make this depend on the scale of the graph too... + /* resol depends on distance between points (not just horizontal) OR is a fixed high res */ if (fcu->driver) resol= 32; else - resol= (int)(3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0])); + resol= (int)(5.0*len_v2v2(bezt->vec[1], prevbezt->vec[1])); if (resol < 2) { /* only draw one */ @@ -721,6 +720,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View } else { /* clamp resolution to max of 32 */ + // NOTE: higher values will crash if (resol > 32) resol= 32; v1[0]= prevbezt->vec[1][0]; -- cgit v1.2.3 From c0373fb7ea2b6d36b57a7c43706626aa254c70b3 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 26 Jul 2011 13:49:39 +0000 Subject: startup.blend Theming/AnimEditor Defaults Tweaks - Default size of Graph Editor handle vertices is now 4 (up from 3). This "small" change seems to be enough to make a substantial difference when it comes to actually differentiating between these - "Only Selected" DopeSheet filter is enabled for new Graph Editor instances by default. It helps hone in on the F-Curves of the data most animators hope to just be refining the motion for (i.e. the selected stuff) - "Only Selected Keyframe Handles" is now enabled, to reduce clutter from handles of nearby keys getting in the way. --- source/blender/editors/space_graph/graph_draw.c | 2 ++ source/blender/editors/space_graph/space_graph.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index a1b8cf0df91..f668b4b4a5f 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -684,6 +684,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View } /* draw curve between first and last keyframe (if there are enough to do so) */ + // TODO: optimise this to not have to calc stuff out of view too? while (b--) { if (prevbezt->ipo==BEZT_IPO_CONST) { /* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */ @@ -707,6 +708,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View */ /* resol depends on distance between points (not just horizontal) OR is a fixed high res */ + // TODO: view scale should factor into this someday too... if (fcu->driver) resol= 32; else diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 6a548a58507..fea9e5d71e8 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -186,6 +186,10 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); sipo->ads->source= (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now... } + + /* settings for making it easier by default to just see what you're interested in tweaking */ + sipo->ads->filterflag |= ADS_FILTER_ONLYSEL; + sipo->flag |= SIPO_SELVHANDLESONLY; ED_area_tag_refresh(sa); } -- cgit v1.2.3 From e9fed9bd8c2f18ed56a1ccfa5a3a0da12827c881 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 30 Jul 2011 05:04:49 +0000 Subject: Bugfix: When only one handle was selected in Graph Editor, the line of the other handle were not drawn This only happened when the "only on selected keyframes" option was enabled --- source/blender/editors/space_graph/graph_draw.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index f668b4b4a5f..67543d37859 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -356,10 +356,6 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) float *fp; unsigned char col[4]; - /* if only selected keyframes have handles shown, skip the first round */ - if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY)) - continue; - for (b= 0; b < fcu->totvert; b++, prevbezt=bezt, bezt++) { /* if only selected keyframes can get their handles shown, * check that keyframe is selected @@ -372,7 +368,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) /* draw handle with appropriate set of colors if selection is ok */ if ((bezt->f2 & SELECT)==sel) { fp= bezt->vec[0]; - + /* only draw first handle if previous segment had handles */ if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { @@ -382,14 +378,14 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) glVertex2fv(fp); glVertex2fv(fp+3); } - + /* only draw second handle if this segment is bezier */ if (bezt->ipo == BEZT_IPO_BEZ) { UI_GetThemeColor3ubv(basecol + bezt->h2, col); col[3]= drawFCurveFade(fcu) * 255; glColor4ubv((GLubyte *)col); - + glVertex2fv(fp+3); glVertex2fv(fp+6); } } @@ -402,7 +398,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) UI_GetThemeColor3ubv(basecol + bezt->h1, col); col[3]= drawFCurveFade(fcu) * 255; glColor4ubv((GLubyte *)col); - + glVertex2fv(fp); glVertex2fv(fp+3); } -- cgit v1.2.3 From 2b446aa280af60aefd304aae904bc16b1b15f373 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 3 Aug 2011 01:22:31 +0000 Subject: Animation channels can now be renamed by Ctrl-Clicking on them, as in the Outliner Channels which can be renamed include: - Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks", or the dark and light blue channels) - Action Groups (green channels) - Action expanders (i.e. "CubeAction", "WorldAction", etc.) - Grease Pencil stuff Channels which CANNOT be renamed, as they mostly use hardcoded values or otherwise include: - Drivers expander - FCurves (they don't technically have a "name"; what is shown is just a user-friendly representation of their rna_paths) --- source/blender/editors/space_graph/graph_draw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 67543d37859..7e40f2e5159 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1006,6 +1006,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) } { /* second pass: widgets */ uiBlock *block= uiBeginBlock(C, ar, "graph channel buttons", UI_EMBOSS); + size_t channel_index = 0; y= (float)ACHANNEL_FIRST; @@ -1022,11 +1023,12 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) { /* draw all channels using standard channel-drawing API */ - ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc); + ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index); } /* adjust y-position for next one */ y -= ACHANNEL_STEP; + channel_index++; } uiEndBlock(C, block); -- cgit v1.2.3 From 2ed11158db7cfc157c26475a2dcb5f513043cd72 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 4 Aug 2011 14:06:30 +0000 Subject: Bugfix: Setting of new default settings for new Graph Editors was done in wrong place, leading to loss of settings everytime the view changed (i.e. after open/saving) --- source/blender/editors/space_graph/space_graph.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index fea9e5d71e8..3cc83b12124 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -110,6 +110,10 @@ static SpaceLink *graph_new(const bContext *C) sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); sipo->ads->source= (ID *)scene; + /* settings for making it easier by default to just see what you're interested in tweaking */ + sipo->ads->filterflag |= ADS_FILTER_ONLYSEL; + sipo->flag |= SIPO_SELVHANDLESONLY; + /* header */ ar= MEM_callocN(sizeof(ARegion), "header for graphedit"); @@ -187,10 +191,6 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) sipo->ads->source= (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now... } - /* settings for making it easier by default to just see what you're interested in tweaking */ - sipo->ads->filterflag |= ADS_FILTER_ONLYSEL; - sipo->flag |= SIPO_SELVHANDLESONLY; - ED_area_tag_refresh(sa); } -- cgit v1.2.3 From 900928f8bf47b8f1bbb1b2cd863d2d9649c940a0 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 4 Aug 2011 14:13:05 +0000 Subject: Bassam Feature Request: "Auto Clamped" handles can now be set per handle/key This used to be a weird per-curve setting which would happen to get applied/work correctly if handles were set to "auto", and was a source of constant confusion for both old and new animators. The main effect of this handle-type/option was really to just ensure that auto-handles stayed horizontal, instead of tilting as the keys were moved. This commit simply changes this from a per-curve to per keyframe/handle setting. --- source/blender/editors/space_graph/graph_edit.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index d88a18ffcbc..900aa6f6197 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1447,8 +1447,6 @@ void GRAPH_OT_interpolation_type (wmOperatorType *ot) /* ******************** Set Handle-Type Operator *********************** */ -/* ------------------- */ - /* this function is responsible for setting handle-type of selected keyframes */ static void sethandles_graph_keys(bAnimContext *ac, short mode) { @@ -1471,12 +1469,6 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode) /* any selected keyframes for editing? */ if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { - /* for auto/auto-clamped, toggle the auto-handles flag on the F-Curve */ - if (mode == HD_AUTO_ANIM) - fcu->flag |= FCURVE_AUTO_HANDLES; - else if (mode == HD_AUTO) - fcu->flag &= ~FCURVE_AUTO_HANDLES; - /* change type of selected handles */ ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve); } @@ -1513,15 +1505,6 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op) void GRAPH_OT_handle_type (wmOperatorType *ot) { - /* sync with editcurve_handle_type_items */ - static EnumPropertyItem graphkeys_handle_type_items[] = { - {HD_AUTO, "AUTO", 0, "Automatic", "Handles that are automatically adjusted upon moving the keyframe. Whole curve"}, - {HD_VECT, "VECTOR", 0, "Vector", ""}, - {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, - {HD_FREE, "FREE_ALIGN", 0, "Free", ""}, - {HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot. Whole curve"}, - {0, NULL, 0, NULL, NULL}}; - /* identifiers */ ot->name= "Set Keyframe Handle Type"; ot->idname= "GRAPH_OT_handle_type"; @@ -1536,7 +1519,7 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* id-props */ - ot->prop= RNA_def_enum(ot->srna, "type", graphkeys_handle_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", ""); } /* ************************************************************************** */ -- cgit v1.2.3 From e73cf35f4ad470d553540d6adbe89af5cc0c1f4f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 6 Aug 2011 07:01:07 +0000 Subject: Graph Editor "Active Keyframe" settings This commit makes some tweaks to the way that the "active keyframe" settings in the Properties region in the Graph Editor work (for the better, hopefully). Basically, the problem was that previously, these were clunky and non- intuitive to use, since they were just directly displaying the RNA properties for those keyframes for editing purposes. But due to limitations of RNA (i.e. from a RNA pointer to a keyframe, you couldn't see which F-Curve you came from), several things were impossible, notably: 1) Doing proper updates, including validating that the handles are in a valid state - that requires access to the F-Curve to provide to the F-Curve-based curve validity checking functions 2) Having the values of the keyframes display in whatever unit that the property the F-Curve affects displays as - for this, you once again need to know the F-Curve in order to resolve the property that it affects; also the fact that only a single unit could be set for RNA properties further limited things This commit basically gets around these problems by moving away from a layout-engine based approach to one where we attach custom update callbacks and also override the units of the y-co widgets when creating the widgets for these, thus allowing the buttons to work in the ways that animators expect. --- source/blender/editors/space_graph/graph_buttons.c | 87 +++++++++++++++++++--- 1 file changed, 77 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 3073ff13075..d8fd53b83d8 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -53,6 +53,7 @@ #include "BKE_fcurve.h" #include "BKE_main.h" #include "BKE_screen.h" +#include "BKE_unit.h" #include "WM_api.h" @@ -77,8 +78,7 @@ /* ******************* graph editor space & buttons ************** */ -#define B_NOP 1 -#define B_REDR 2 +#define B_REDR 1 /* -------------- */ @@ -244,6 +244,35 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT return 0; } +/* update callback for active keyframe properties - base updates stuff */ +static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, void *UNUSED(bezt_ptr)) +{ + FCurve *fcu = (FCurve *)fcu_ptr; + + /* make sure F-Curve and its handles are still valid after this editing */ + sort_time_fcurve(fcu); + testhandles_fcurve(fcu); +} + +/* update callback for active keyframe properties - handle-editing wrapper */ +static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr) +{ + FCurve *fcu = (FCurve *)fcu_ptr; + BezTriple *bezt = (BezTriple *)bezt_ptr; + + /* since editing the handles, make sure they're set to types which are receptive to editing + * see transform_conversions.c :: createTransGraphEditData(), last step in second loop + */ + if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { + /* by changing to aligned handles, these can now be moved... */ + bezt->h1= HD_ALIGN; + bezt->h2= HD_ALIGN; + } + + /* now call standard updates */ + graphedit_activekey_update_cb(C, fcu_ptr, bezt_ptr); +} + static void graph_panel_key_properties(const bContext *C, Panel *pa) { bAnimListElem *ale; @@ -262,27 +291,66 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) /* only show this info if there are keyframes to edit */ if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) { - PointerRNA bezt_ptr; + PointerRNA bezt_ptr, id_ptr, fcu_prop_ptr; + PropertyRNA *fcu_prop = NULL; + uiBut *but; + int unit = B_UNIT_NONE; /* RNA pointer to keyframe, to allow editing */ RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr); + /* get property that F-Curve affects, for some unit-conversion magic */ + RNA_id_pointer_create(ale->id, &id_ptr); + if (RNA_path_resolve(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop) && fcu_prop) { + /* determine the unit for this property */ + unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop)); + } + /* interpolation */ col= uiLayoutColumn(layout, 0); uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE); - /* numerical coordinate editing */ + /* numerical coordinate editing + * - we use the button-versions of the calls so that we can attach special update handlers + * and unit conversion magic that cannot be achieved using a purely RNA-approach + */ + // XXX: col= uiLayoutColumn(layout, 1); /* keyframe itself */ - uiItemR(col, &bezt_ptr, "co", 0, "Key", ICON_NONE); + { + uiItemL(col, "Key:", ICON_NONE); + + but = uiDefButR(block, NUM, B_REDR, "Frame", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt); + + but = uiDefButR(block, NUM, B_REDR, "Value", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt); + uiButSetUnitType(but, unit); + } /* previous handle - only if previous was Bezier interpolation */ - if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) - uiItemR(col, &bezt_ptr, "handle_left", 0, NULL, ICON_NONE); + if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) { + uiItemL(col, "Left Handle:", ICON_NONE); + + but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + + but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + uiButSetUnitType(but, unit); + } /* next handle - only if current is Bezier interpolation */ - if (bezt->ipo == BEZT_IPO_BEZ) - uiItemR(col, &bezt_ptr, "handle_right", 0, NULL, ICON_NONE); + if (bezt->ipo == BEZT_IPO_BEZ) { + uiItemL(col, "Right Handle:", ICON_NONE); + + but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + + but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + uiButSetUnitType(but, unit); + } } else { if ((fcu->bezt == NULL) && (fcu->modifiers.first)) { @@ -659,7 +727,6 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event) { switch (event) { - case B_REDR: case B_FMODIFIER_REDRAW: // XXX this should send depsgraph updates too WM_event_add_notifier(C, NC_ANIMATION, NULL); // XXX need a notifier specially for F-Modifiers break; -- cgit v1.2.3 From db72192c22787fdf99bc7b20c6864b37b8e871f4 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 12 Aug 2011 07:20:49 +0000 Subject: Bye bye vile relics of extinct version control systems, Causing a flurry of refresh file prompts post-commit, Confusing local diffs and causing merge conflicts, Stating the obvious; redundant and useless... We shall not miss thou, blasted expand $keywords$ --- source/blender/editors/space_graph/graph_draw.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 7e40f2e5159..d65297e068d 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or -- cgit v1.2.3 From ebbd232555d9671161539a6d758bc789546d5ffb Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 12 Aug 2011 07:21:44 +0000 Subject: Fixing compiler warning --- source/blender/editors/space_graph/graph_buttons.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index d8fd53b83d8..c713bc54d25 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -257,7 +257,6 @@ static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, vo /* update callback for active keyframe properties - handle-editing wrapper */ static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr) { - FCurve *fcu = (FCurve *)fcu_ptr; BezTriple *bezt = (BezTriple *)bezt_ptr; /* since editing the handles, make sure they're set to types which are receptive to editing -- cgit v1.2.3 From 059bbee2da03cd88cf8b28803e1917f9f065c1f9 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 12 Aug 2011 07:22:29 +0000 Subject: Drat... missed one --- source/blender/editors/space_graph/graph_buttons.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index c713bc54d25..f3a70c496ef 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or -- cgit v1.2.3 From 27ec8d5043f544685001aab3552b9b4b56bc1e1a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 30 Aug 2011 09:50:31 +0000 Subject: fix for some warnings with the recent merge, also tag unused args. --- source/blender/editors/space_graph/graph_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index d65297e068d..dc5e71f0406 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -706,7 +706,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View if (fcu->driver) resol= 32; else - resol= (int)(5.0*len_v2v2(bezt->vec[1], prevbezt->vec[1])); + resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1])); if (resol < 2) { /* only draw one */ -- cgit v1.2.3