From bce4b7c868c5a30f1e888da7cc69e56330cd93ee Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 15 Apr 2016 22:08:13 +1200 Subject: Code Cleanup: Fix up various odds and ends --- source/blender/editors/space_graph/graph_edit.c | 32 +++++++++---------------- 1 file changed, 11 insertions(+), 21 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 a54b7e141f3..19325962adc 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2642,10 +2642,10 @@ static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op) } /* successful or not? */ - if (ok == 0) - return OPERATOR_CANCELLED; - else + if (ok) return OPERATOR_FINISHED; + else + return OPERATOR_CANCELLED; } void GRAPH_OT_driver_variables_copy(wmOperatorType *ot) @@ -2684,32 +2684,23 @@ static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op) filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - /* paste modifiers */ + /* paste variables */ for (ale = anim_data.first; ale; ale = ale->next) { FCurve *fcu = (FCurve *)ale->data; - bool paste_ok; - - printf("pasting vars to %p -> %p\n", fcu, fcu->driver); - paste_ok = ANIM_driver_vars_paste(op->reports, fcu, replace); - - if (paste_ok) { - //ale->update |= ANIM_UPDATE_DEPS; - printf("now we have: %d vars\n", BLI_listbase_count(&fcu->driver->variables)); - ok = true; - } + ok |= ANIM_driver_vars_paste(op->reports, fcu, replace); } - // XXX: something causes a crash after adding the copies (to empty list), if we do an update immediately - if (ok) { - DAG_relations_tag_update(CTX_data_main(C)); - //ANIM_animdata_update(&ac, &anim_data); - } + /* cleanup */ ANIM_animdata_freelist(&anim_data); /* successful or not? */ if (ok) { + /* rebuild depsgraph, now that there are extra deps here */ + DAG_relations_tag_update(CTX_data_main(C)); + /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C)); + return OPERATOR_FINISHED; } else { @@ -2732,9 +2723,8 @@ void GRAPH_OT_driver_variables_paste(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "only_active", true, "Only Active", "Only paste F-Modifiers on active F-Curve"); RNA_def_boolean(ot->srna, "replace", false, "Replace Existing", - "Replace existing F-Modifiers, instead of just appending to the end of the existing list"); + "Replace existing driver variables, instead of just appending to the end of the existing list"); } /* ************************************************************************** */ -- cgit v1.2.3