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:
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c31
-rw-r--r--source/blender/editors/space_graph/graph_draw.c71
-rw-r--r--source/blender/editors/space_graph/graph_edit.c82
-rw-r--r--source/blender/editors/space_graph/graph_header.c24
-rw-r--r--source/blender/editors/space_graph/graph_intern.h1
-rw-r--r--source/blender/editors/space_graph/graph_ops.c10
-rw-r--r--source/blender/editors/space_graph/graph_select.c9
-rw-r--r--source/blender/editors/space_graph/graph_utils.c29
-rw-r--r--source/blender/editors/space_graph/space_graph.c17
9 files changed, 174 insertions, 100 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index fb995285ab7..09008f8d2d1 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -46,15 +46,16 @@
#include "BLI_editVert.h"
#include "BLI_rand.h"
-#include "BKE_animsys.h"
#include "BKE_action.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
#include "BKE_object.h"
-#include "BKE_global.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -250,6 +251,22 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *pt)
return graph_panel_context(C, NULL, NULL);
}
+static void test_obpoin_but(struct bContext *C, char *name, ID **idpp)
+{
+ ID *id;
+
+ id= CTX_data_main(C)->object.first;
+ while(id) {
+ if( strcmp(name, id->name+2)==0 ) {
+ *idpp= id;
+ id_lib_extern(id); /* checks lib data, sets correct flag for saving then */
+ return;
+ }
+ id= id->next;
+ }
+ *idpp= NULL;
+}
+
/* driver settings for active F-Curve (only for 'Drivers' mode) */
static void graph_panel_drivers(const bContext *C, Panel *pa)
{
@@ -427,13 +444,9 @@ static int graph_properties(bContext *C, wmOperator *op)
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= graph_has_buttons_region(sa);
- if(ar) {
- ar->flag ^= RGN_FLAG_HIDDEN;
- ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */
-
- ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
- ED_area_tag_redraw(sa);
- }
+ if(ar)
+ ED_region_toggle_hidden(C, ar);
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 9ae7e8263ee..57e2208f089 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -91,6 +91,26 @@
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
/* *************************** */
+/* Utility Drawing Defines */
+
+/* determine the alpha value that should be used when
+ * drawing components for some F-Curve (fcu)
+ * - selected F-Curves should be more visible than partially visible ones
+ */
+#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : 0.5f )
+
+/* set the colour for some point from some value given packed into an int
+ * - intV: integer value containing color info packed into an int
+ * - alpha: float value describing the
+ */
+#define cpackA(intVC, alpha) \
+ { \
+ float _cpackCol[3]; \
+ cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \
+ glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \
+ }
+
+/* *************************** */
/* F-Curve Modifier Drawing */
/* Envelope -------------- */
@@ -258,22 +278,20 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel)
/* helper func - set color to draw F-Curve data with */
static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
{
-#if 0
- if (sipo->showkey) {
- if (sel) UI_ThemeColor(TH_TEXT_HI);
- else UI_ThemeColor(TH_TEXT);
- }
-#endif
- if ((fcu->flag & FCURVE_PROTECTED)==0) {
- /* Curve's points are being edited */
- if (sel) UI_ThemeColor(TH_VERTEX_SELECT);
- else UI_ThemeColor(TH_VERTEX);
- }
- else {
- /* Curve's points cannot be edited */
- if (sel) UI_ThemeColor(TH_TEXT_HI);
- else UI_ThemeColor(TH_TEXT);
- }
+ /* Fade the 'intensity' of the vertices based on the selection of the curves too */
+ int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255);
+
+ /* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */
+ if ((fcu->flag & FCURVE_PROTECTED)==0) {
+ /* Curve's points ARE BEING edited */
+ if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset);
+ else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset);
+ }
+ else {
+ /* Curve's points CANNOT BE edited */
+ if (sel) UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, alphaOffset);
+ else UI_ThemeColorShadeAlpha(TH_TEXT, 0, alphaOffset);
+ }
}
@@ -322,7 +340,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
if ((sipo->flag & SIPO_NOHANDLES) || (fcu->flag & FCURVE_PROTECTED) || (fcu->flag & FCURVE_INT_VALUES))
return;
- /* slightly hacky, but we want to draw unselected points before selected ones*/
+ /* slightly hacky, but we want to draw unselected points before selected ones */
for (sel= 0; sel < 2; sel++) {
BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
float *fp;
@@ -337,7 +355,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* only draw first handle if previous segment had handles */
if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
{
- cpack(col[(unsigned char)bezt->h1]);
+ cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu));
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
glEnd();
@@ -347,7 +365,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* only draw second handle if this segment is bezier */
if (bezt->ipo == BEZT_IPO_BEZ)
{
- cpack(col[(unsigned char)bezt->h2]);
+ cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu));
glBegin(GL_LINE_STRIP);
glVertex2fv(fp+3); glVertex2fv(fp+6);
glEnd();
@@ -359,7 +377,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) )
{
fp= bezt->vec[0];
- cpack(col[(unsigned char)bezt->h1]);
+ cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu));
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
@@ -371,7 +389,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
(bezt->ipo == BEZT_IPO_BEZ) )
{
fp= bezt->vec[1];
- cpack(col[(unsigned char)bezt->h2]);
+ cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu));
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
@@ -410,7 +428,6 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys
glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f);
/* anti-aliased lines for more consistent appearance */
- // XXX needed here?
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
@@ -506,7 +523,6 @@ static void draw_fcurve_curve (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DG
}
/* helper func - draw a samples-based F-Curve */
-// TODO: add offset stuff...
static void draw_fcurve_curve_samples (FCurve *fcu, View2D *v2d)
{
FPoint *prevfpt= fcu->fpt;
@@ -647,7 +663,7 @@ static void draw_fcurve_curve_bezts (FCurve *fcu, View2D *v2d, View2DGrid *grid)
*/
/* resol not depending on horizontal resolution anymore, drivers for example... */
- // XXX need to take into account the scale
+ // TODO: would be nice to make this depend on the scale of the graph too...
if (fcu->driver)
resol= 32;
else
@@ -809,7 +825,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* set whatever color the curve has set
* - unselected curves draw less opaque to help distinguish the selected ones
*/
- glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], ((sel) ? 1.0f : 0.5f));
+ glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu));
}
/* anti-aliased lines for less jagged appearance */
@@ -855,7 +871,10 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) {
if (fcu->bezt) {
/* only draw handles/vertices on keyframes */
- draw_fcurve_handles(sipo, ar, fcu);
+ glEnable(GL_BLEND);
+ draw_fcurve_handles(sipo, ar, fcu);
+ glDisable(GL_BLEND);
+
draw_fcurve_vertices(sipo, ar, fcu);
}
else {
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index d718ef28e99..3e0f9760773 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1296,8 +1296,7 @@ void GRAPH_OT_handle_type (wmOperatorType *ot)
/* set of three euler-rotation F-Curves */
typedef struct tEulerFilter {
ID *id; /* ID-block which owns the channels */
- FCurve *fcu1, *fcu2, *fcu3; /* x,y,z rotation curves */
- int i1, i2, i3; /* current index for each curve */
+ FCurve (*fcurves)[3]; /* 3 Pointers to F-Curves */
} tEulerFilter;
static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
@@ -1336,7 +1335,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
if (ELEM(0, fcu->rna_path, strstr(fcu->rna_path, "rotation")))
continue;
if (strstr(fcu->rna_path, "pose.pose_channels")) {
- if (strstr(fcu->rna_path, "euler_rotation") == 0)
+ if (strstr(fcu->rna_path, "rotation_euler") == 0)
continue;
}
@@ -1345,12 +1344,30 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
* - first check if id-blocks are compatible
*/
if ((euf) && (ale->id != euf->id)) {
+ /* if the paths match, add this curve to the set of curves */
+ // NOTE: simple string compare for now... could be a bit more fancy...
}
+ else {
+ /* just add to a new block */
+ euf= MEM_callocN(sizeof(tEulerFilter), "tEulerFilter");
+ BLI_addtail(&eulers, euf);
+
+ euf->id= ale->id;
+ euf->fcurves[fcu->array_index]= fcu;
+ }
}
+ BLI_freelistN(&anim_data);
- // XXX for now
- return OPERATOR_CANCELLED;
+ /* step 2: go through each set of curves, processing the values at each keyframe
+ * - it is assumed that there must be a full set of keyframes at each keyframe position
+ */
+ for (euf= eulers.first; euf; euf= euf->next) {
+
+ }
+ BLI_freelistN(&eulers);
+
+ return OPERATOR_FINISHED;
}
void GRAPH_OT_euler_filter (wmOperatorType *ot)
@@ -1710,13 +1727,18 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *eve
/* start from 1 to skip the 'Invalid' modifier type */
for (i = 1; i < FMODIFIER_NUM_TYPES; i++) {
FModifierTypeInfo *fmi= get_fmodifier_typeinfo(i);
+ PointerRNA props_ptr;
/* check if modifier is valid for this context */
if (fmi == NULL)
continue;
- /* add entry to add this type of modifier */
- uiItemEnumO(layout, fmi->name, 0, "GRAPH_OT_fmodifier_add", "type", i);
+ /* create operator menu item with relevant properties filled in */
+ props_ptr= uiItemFullO(layout, fmi->name, 0, "GRAPH_OT_fmodifier_add", NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
+ /* the only thing that gets set from the menu is the type of F-Modifier to add */
+ RNA_enum_set(&props_ptr, "type", i);
+ /* the following properties are just repeats of existing ones... */
+ RNA_boolean_set(&props_ptr, "only_active", RNA_boolean_get(op->ptr, "only_active"));
}
uiItemS(layout);
@@ -1728,36 +1750,41 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *eve
static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- FCurve *fcu;
- FModifier *fcm;
+ int filter;
short type;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
- // xxx call the raw methods here instead?
- ale= get_active_fcurve_channel(&ac);
- if (ale == NULL)
- return OPERATOR_CANCELLED;
- fcu= (FCurve *)ale->data;
- MEM_freeN(ale);
- if (fcu == NULL)
- return OPERATOR_CANCELLED;
-
/* get type of modifier to add */
type= RNA_enum_get(op->ptr, "type");
- /* add F-Modifier of specified type to active F-Curve, and make it the active one */
- fcm= add_fmodifier(&fcu->modifiers, type);
- if (fcm)
- set_active_fmodifier(&fcu->modifiers, fcm);
- else {
- BKE_report(op->reports, RPT_ERROR, "Modifier couldn't be added. See console for details.");
- return OPERATOR_CANCELLED;
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ if (RNA_boolean_get(op->ptr, "only_active"))
+ filter |= ANIMFILTER_ACTIVE;
+ else
+ filter |= ANIMFILTER_SEL;
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* smooth keyframes */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->data;
+ FModifier *fcm;
+
+ /* add F-Modifier of specified type to active F-Curve, and make it the active one */
+ fcm= add_fmodifier(&fcu->modifiers, type);
+ if (fcm)
+ set_active_fmodifier(&fcu->modifiers, fcm);
+ else { // TODO: stop when this happens?
+ BKE_report(op->reports, RPT_ERROR, "Modifier couldn't be added. See console for details.");
+ break;
+ }
}
+ BLI_freelistN(&anim_data);
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
@@ -1779,13 +1806,14 @@ void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
/* api callbacks */
ot->invoke= graph_fmodifier_add_invoke;
ot->exec= graph_fmodifier_add_exec;
- ot->poll= graphop_active_fcurve_poll;
+ ot->poll= graphop_selected_fcurve_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+ RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve.");
}
/* ************************************************************************** */
diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c
index dd304cd8cf3..98d58c92da4 100644
--- a/source/blender/editors/space_graph/graph_header.c
+++ b/source/blender/editors/space_graph/graph_header.c
@@ -298,29 +298,7 @@ void graph_header_buttons(const bContext *C, ARegion *ar)
xco+= 120;
/* filtering buttons */
- if (sipo->ads) {
- //uiBlockBeginAlign(block);
- uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
- //uiBlockEndAlign(block);
- xco += 5;
-
- uiBlockBeginAlign(block);
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display World Animation");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Materials");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Lamps");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Cameras");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Curves");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display MetaBalls");
- uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Particles");
- uiBlockEndAlign(block);
- xco += 30;
- }
- else {
- // XXX this case shouldn't happen at all... for now, just pad out same amount of space
- xco += 10*XIC + 30;
- }
+ xco= ANIM_headerUI_standard_buttons(C, sipo->ads, block, xco, yco);
/* auto-snap selector */
if (sipo->flag & SIPO_DRAWTIME) {
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 2e8d0655d2d..83a565e485f 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -155,6 +155,7 @@ short fcurve_needs_draw_fmodifier_controls(struct FCurve *fcu, struct FModifier
int graphop_visible_keyframes_poll(struct bContext *C);
int graphop_editable_keyframes_poll(struct bContext *C);
int graphop_active_fcurve_poll(struct bContext *C);
+int graphop_selected_fcurve_poll(struct bContext *C);
/* ***************************************** */
/* graph_ops.c */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index fc4c05915c9..b82055064f8 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -141,7 +141,7 @@ void graphedit_operatortypes(void)
/* ************************** registration - keymaps **********************************/
-static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
+static void graphedit_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
{
wmKeymapItem *kmi;
@@ -221,7 +221,7 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
WM_keymap_add_item(keymap, "GRAPH_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
/* F-Modifiers */
- WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "only_active", 0);
/* transform system */
@@ -232,10 +232,10 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
void graphedit_keymap(wmWindowManager *wm)
{
- ListBase *keymap;
+ wmKeyMap *keymap;
/* keymap for all regions */
- keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
/* channels */
@@ -245,7 +245,7 @@ void graphedit_keymap(wmWindowManager *wm)
*/
/* keyframes */
- keymap= WM_keymap_listbase(wm, "GraphEdit Keys", SPACE_IPO, 0);
+ keymap= WM_keymap_find(wm, "GraphEdit Keys", SPACE_IPO, 0);
graphedit_keymap_keyframes(wm, keymap);
}
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 728c9310a47..7eec9f31d86 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -142,9 +142,13 @@ 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 */
+ /* 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;
fcu->flag &= ~FCURVE_ACTIVE;
}
@@ -259,8 +263,9 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
/* select the curve too
* NOTE: this should really only happen if the curve got touched...
*/
- if (selectmode == SELECT_ADD)
+ if (selectmode == SELECT_ADD) {
fcu->flag |= FCURVE_SELECTED;
+ }
}
/* cleanup */
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index f00e7845549..25087441b6a 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -285,4 +285,33 @@ int graphop_active_fcurve_poll (bContext *C)
return has_fcurve;
}
+/* has selected F-Curve that's editable */
+int graphop_selected_fcurve_poll (bContext *C)
+{
+ bAnimContext ac;
+ ListBase anim_data = {NULL, NULL};
+ ScrArea *sa= CTX_wm_area(C);
+ int filter, items;
+ short found = 0;
+
+ /* firstly, check if in Graph Editor */
+ // TODO: also check for region?
+ if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ return 0;
+
+ /* try to init Anim-Context stuff ourselves and check */
+ 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);
+ items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ if (items == 0)
+ return 0;
+
+ /* cleanup and return findings */
+ BLI_freelistN(&anim_data);
+ return found;
+}
+
/* ************************************************************** */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 8887d464f30..a7ea2294ed4 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -203,14 +203,14 @@ static SpaceLink *graph_duplicate(SpaceLink *sl)
/* add handlers, stuff you only do once or on area/region changes */
static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
{
- ListBase *keymap;
+ wmKeyMap *keymap;
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_listbase(wm, "GraphEdit Keys", SPACE_IPO, 0); /* XXX weak? */
+ keymap= WM_keymap_find(wm, "GraphEdit Keys", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -281,14 +281,14 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
{
- ListBase *keymap;
+ wmKeyMap *keymap;
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_listbase(wm, "Animation_Channels", 0, 0); /* XXX weak? */
+ keymap= WM_keymap_find(wm, "Animation_Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -352,11 +352,11 @@ static void graph_header_area_draw(const bContext *C, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */
static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
{
- ListBase *keymap;
+ wmKeyMap *keymap;
ED_region_panels_init(wm, ar);
- keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -374,6 +374,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_SCENE:
switch(wmn->data) {
+ case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
case ND_MARKERS: