Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-09-12 18:40:48 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-09-12 18:48:02 +0300
commit2e07af36fd35c97d382300962bcb9695584a23f4 (patch)
treee213b0321e17b9e5acd11a2b9b0a594b2798423d /source/blender/editors/space_graph
parent6a20e2653effd3485505f8fb059aef3941212074 (diff)
Fix T56763: Removing driver variable crashes Blender.
Rebuilding depsgraph is not enough, with COW we also need to ensure COW copies get updated accordingly. Had to tweak the generic update system here, since it was always passed a NULL pointer for the callback arg, this should not change existing behavior (besides crash fixing ;) )...
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 4162e6dec92..642e8e074fa 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -46,6 +46,7 @@
#include "BLT_translation.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
@@ -54,6 +55,7 @@
#include "BKE_screen.h"
#include "BKE_unit.h"
+#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "WM_api.h"
@@ -467,7 +469,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
#define B_IPO_DEPCHANGE 10
-static void do_graph_region_driver_buttons(bContext *C, void *fcu_v, int event)
+static void do_graph_region_driver_buttons(bContext *C, void *id_v, int event)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -475,6 +477,9 @@ static void do_graph_region_driver_buttons(bContext *C, void *fcu_v, int event)
switch (event) {
case B_IPO_DEPCHANGE:
{
+ /* Was not actually run ever (NULL always passed as arg to this callback).
+ * If needed again, will need to check how to pass both fcurve and ID... :/ */
+#if 0
/* force F-Curve & Driver to get re-evaluated (same as the old Update Dependencies) */
FCurve *fcu = (FCurve *)fcu_v;
ChannelDriver *driver = (fcu) ? fcu->driver : NULL;
@@ -484,9 +489,22 @@ static void do_graph_region_driver_buttons(bContext *C, void *fcu_v, int event)
fcu->flag &= ~FCURVE_DISABLED;
driver->flag &= ~DRIVER_FLAG_INVALID;
}
+#endif
+ ID *id = id_v;
+ AnimData *adt = BKE_animdata_from_id(id);
- /* rebuild depsgraph for the new deps */
+ /* rebuild depsgraph for the new deps, and ensure COW copies get flushed. */
DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, id, DEG_TAG_COPY_ON_WRITE);
+ if (adt != NULL) {
+ if (adt->action != NULL) {
+ DEG_id_tag_update_ex(bmain, &adt->action->id, DEG_TAG_COPY_ON_WRITE);
+ }
+ if (adt->tmpact != NULL) {
+ DEG_id_tag_update_ex(bmain, &adt->tmpact->id, DEG_TAG_COPY_ON_WRITE);
+ }
+ }
+
break;
}
}
@@ -759,7 +777,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
/* set event handler for panel */
block = uiLayoutGetBlock(layout);
- UI_block_func_handle_set(block, do_graph_region_driver_buttons, NULL);
+ UI_block_func_handle_set(block, do_graph_region_driver_buttons, id);
/* driver-level settings - type, expressions, and errors */
RNA_pointer_create(id, &RNA_Driver, driver, &driver_ptr);