diff options
Diffstat (limited to 'source/blender/editors/animation/drivers.c')
-rw-r--r-- | source/blender/editors/animation/drivers.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 296a52e7f20..67ba82f1858 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -39,18 +39,12 @@ #include "BLI_utildefines.h" #include "DNA_anim_types.h" -#include "DNA_object_types.h" -#include "DNA_material_types.h" #include "DNA_texture_types.h" -#include "DNA_screen_types.h" -#include "DNA_space_types.h" #include "BKE_animsys.h" #include "BKE_fcurve.h" #include "BKE_context.h" #include "BKE_report.h" -#include "BKE_material.h" -#include "BKE_texture.h" #include "ED_keyframing.h" @@ -437,7 +431,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (all) index = -1; @@ -455,7 +449,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } @@ -492,7 +486,7 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to find driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (all) index = -1; @@ -500,13 +494,16 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) if (ptr.id.data && ptr.data && prop) { char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); - success = ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0); - MEM_freeN(path); + if (path) { + success = ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0); + + MEM_freeN(path); + } } if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } @@ -542,7 +539,7 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op) int index; /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); @@ -551,7 +548,7 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op) /* only copy the driver for the button that this was involved for */ success = ANIM_copy_driver(op->reports, ptr.id.data, path, index, 0); - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); MEM_freeN(path); } @@ -586,7 +583,7 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op) int index; /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); @@ -595,7 +592,7 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op) /* only copy the driver for the button that this was involved for */ success = ANIM_paste_driver(op->reports, ptr.id.data, path, index, 0); - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); MEM_freeN(path); } |