Merge branch 'master' into blender2.8
authorSybren A. Stüvel <sybren@stuvel.eu>
Wed, 17 Jan 2018 11:38:52 +0000 (12:38 +0100)
committerSybren A. Stüvel <sybren@stuvel.eu>
Wed, 17 Jan 2018 11:38:52 +0000 (12:38 +0100)
1  2 
source/blender/editors/space_graph/graph_edit.c

index 0a8e49fc671fbbe9d6f7bd31a85647fbae4e0ebf,69feae6ee24686fec44de17a524895cbcd922f89..be5be2f9d60048515e8b042a66bfaeabeab6cde2
@@@ -36,7 -36,7 +36,7 @@@
  #include <float.h>
  
  #ifdef WITH_AUDASPACE
 -#  include AUD_SPECIAL_H
 +#  include <AUD_Special.h>
  #endif
  
  #include "MEM_guardedalloc.h"
  
  #include "BLT_translation.h"
  
 -#include "BKE_depsgraph.h"
  #include "BKE_fcurve.h"
  #include "BKE_global.h"
  #include "BKE_nla.h"
  #include "BKE_context.h"
  #include "BKE_report.h"
  
 +#include "DEG_depsgraph_build.h"
 +
  #include "UI_view2d.h"
  
  #include "ED_anim_api.h"
@@@ -2715,7 -2714,7 +2715,7 @@@ static int graph_driver_vars_paste_exec
        /* successful or not? */
        if (ok) {
                /* rebuild depsgraph, now that there are extra deps here */
 -              DAG_relations_tag_update(CTX_data_main(C));
 +              DEG_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));
@@@ -2747,19 -2746,12 +2747,12 @@@ void GRAPH_OT_driver_variables_paste(wm
  }
  
  /* ************************************************************************** */
- typedef struct InvalidDriverInfo {
-       struct InvalidDriverInfo *next, *prev;
-       ID *id;
-       FCurve *fcu;
- } InvalidDriverInfo;
  
  static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op)
  {
        bAnimContext ac;
        ListBase anim_data = {NULL, NULL};
-       ListBase to_delete = {NULL, NULL};
        bAnimListElem *ale;
-       InvalidDriverInfo *idi;
        int filter;
        bool ok = false;
        unsigned int deleted = 0;
        /* NOTE: we might need a scene update to evaluate the driver flags */
  
        /* filter data */
-       filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
+       filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
  
        /* find invalid drivers */
                        continue;
                }
  
-               /* remember in a separate list so we don't iterate over the same collection we modify */
-               idi = MEM_callocN(sizeof(InvalidDriverInfo), "invalid driver info");
-               BLI_assert(idi != NULL);
-               idi->id = ale->id;
-               idi->fcu = fcu;
-               BLI_addtail(&to_delete, idi);
-       }
-       /* delete invalid drivers */
-       for (idi = to_delete.first; idi; idi = idi->next) {
-               ok |= ANIM_remove_driver(op->reports, idi->id, idi->fcu->rna_path, idi->fcu->array_index, 0);
+               ok |= ANIM_remove_driver(op->reports, ale->id, fcu->rna_path, fcu->array_index, 0);
                if (!ok) {
                        break;
                }
        }
  
        /* cleanup */
-       BLI_freelistN(&to_delete);
        ANIM_animdata_freelist(&anim_data);
  
        if (deleted > 0) {
                /* notify the world of any changes */
 -              DAG_relations_tag_update(CTX_data_main(C));
 +              DEG_relations_tag_update(CTX_data_main(C));
                WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
                WM_reportf(RPT_INFO, "Deleted %u drivers", deleted);
        } else {