diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-01-17 19:47:38 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-01-17 19:47:38 +0300 |
commit | 10e6da1f2d61b9db7c47257310eb4580aa096c50 (patch) | |
tree | 42fd298e750593b5ce99a5cf520605eba2200fb0 /source/blender/editors/space_graph/graph_edit.c | |
parent | 8e35a9e4c7fdeb09c31b7cc52955974748fb22c3 (diff) | |
parent | 5d4ffb42a327b08542e3556e7a98f1bc14d21c70 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/space_graph/graph_edit.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index be5be2f9d60..0e5c5ddc0c7 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2804,6 +2804,20 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static int graph_driver_delete_invalid_poll(bContext *C) +{ + bAnimContext ac; + ScrArea *sa = CTX_wm_area(C); + + /* firstly, check if in Graph Editor */ + if ((sa == NULL) || (sa->spacetype != SPACE_IPO)) + return 0; + + /* try to init Anim-Context stuff ourselves and check */ + return ANIM_animdata_get_context(C, &ac) != 0; +} + + void GRAPH_OT_driver_delete_invalid(wmOperatorType *ot) { /* identifiers */ @@ -2813,7 +2827,7 @@ void GRAPH_OT_driver_delete_invalid(wmOperatorType *ot) /* api callbacks */ ot->exec = graph_driver_delete_invalid_exec; - ot->poll = graphop_visible_keyframes_poll; + ot->poll = graph_driver_delete_invalid_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |