diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-05-08 09:57:11 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-05-08 09:57:11 +0400 |
commit | 49cde5d8c10726907eaa6790e70b04f4158c4fe5 (patch) | |
tree | eb691d4cba378f88b5b697090d7c9cc46a7720b4 | |
parent | d20c9e491c4f158330029c6cccfc50216843fbb5 (diff) |
Drivers: When editing expressions from UI buttons, "invalid" flags now get cleared from the drivers
With this change, there should hopefully be less need to hit "Update Dependencies"
on drivers so often.
-rw-r--r-- | source/blender/editors/interface/interface_anim.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index d44802803da..167c6ac51c3 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -117,10 +117,19 @@ bool ui_but_anim_expression_set(uiBut *but, const char *str) if (fcu && driven) { driver = fcu->driver; - if (driver && driver->type == DRIVER_TYPE_PYTHON) { + if (driver && (driver->type == DRIVER_TYPE_PYTHON)) { BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); + + /* tag driver as needing to be recompiled */ driver->flag |= DRIVER_FLAG_RECOMPILE; + + /* clear invalid flags which may prevent this from working */ + driver->flag &= ~DRIVER_FLAG_INVALID; + fcu->flag & ~FCURVE_DISABLED; + + /* this notifier should update the Graph Editor and trigger depsgraph refresh? */ WM_event_add_notifier(but->block->evil_C, NC_ANIMATION | ND_KEYFRAME, NULL); + return true; } } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 0c5c68e4588..266bc1bf0a5 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -144,7 +144,11 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA static void rna_ChannelDriver_update_expr(Main *bmain, Scene *scene, PointerRNA *ptr) { ChannelDriver *driver = ptr->data; + + /* tag driver as needing to be recompiled */ driver->flag |= DRIVER_FLAG_RECOMPILE; + + /* update_data() clears invalid flag and schedules for updates */ rna_ChannelDriver_update_data(bmain, scene, ptr); } |