forked from bartvdbraak/blender
Code Cleanup: Fix up various odds and ends
This commit is contained in:
parent
88c071fbb5
commit
bce4b7c868
@ -2642,10 +2642,10 @@ static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* successful or not? */
|
/* successful or not? */
|
||||||
if (ok == 0)
|
if (ok)
|
||||||
return OPERATOR_CANCELLED;
|
|
||||||
else
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
else
|
||||||
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
|
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);
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
|
||||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||||
|
|
||||||
/* paste modifiers */
|
/* paste variables */
|
||||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||||
FCurve *fcu = (FCurve *)ale->data;
|
FCurve *fcu = (FCurve *)ale->data;
|
||||||
bool paste_ok;
|
ok |= ANIM_driver_vars_paste(op->reports, fcu, replace);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: something causes a crash after adding the copies (to empty list), if we do an update immediately
|
/* cleanup */
|
||||||
if (ok) {
|
|
||||||
DAG_relations_tag_update(CTX_data_main(C));
|
|
||||||
//ANIM_animdata_update(&ac, &anim_data);
|
|
||||||
}
|
|
||||||
ANIM_animdata_freelist(&anim_data);
|
ANIM_animdata_freelist(&anim_data);
|
||||||
|
|
||||||
/* successful or not? */
|
/* successful or not? */
|
||||||
if (ok) {
|
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 */
|
/* set notifier that keyframes have changed */
|
||||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C));
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C));
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2732,9 +2723,8 @@ void GRAPH_OT_driver_variables_paste(wmOperatorType *ot)
|
|||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
|
|
||||||
/* properties */
|
/* 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",
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
Loading…
Reference in New Issue
Block a user