diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-04-15 13:08:13 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-04-15 16:12:50 +0300 |
commit | bce4b7c868c5a30f1e888da7cc69e56330cd93ee (patch) | |
tree | 592406dd8347fea67b9f2ce371f591903962b926 /source | |
parent | 88c071fbb5e454ad480344642d5ddfb852a2f98b (diff) |
Code Cleanup: Fix up various odds and ends
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 32 |
1 files changed, 11 insertions, 21 deletions
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"); } /* ************************************************************************** */ |