diff options
Diffstat (limited to 'source/blender/editors/interface/interface_eyedropper_driver.c')
-rw-r--r-- | source/blender/editors/interface/interface_eyedropper_driver.c | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c index 276cc70f2b5..0162e205c29 100644 --- a/source/blender/editors/interface/interface_eyedropper_driver.c +++ b/source/blender/editors/interface/interface_eyedropper_driver.c @@ -102,46 +102,44 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve if (but == NULL) { return; } - else { - /* Get paths for src... */ - PointerRNA *target_ptr = &but->rnapoin; - PropertyRNA *target_prop = but->rnaprop; - int target_index = but->rnaindex; - - char *target_path = RNA_path_from_ID_to_property(target_ptr, target_prop); - - /* ... and destination */ - char *dst_path = BKE_animdata_driver_path_hack(C, &ddr->ptr, ddr->prop, NULL); - - /* Now create driver(s) */ - if (target_path && dst_path) { - int success = ANIM_add_driver_with_target(op->reports, - ddr->ptr.owner_id, - dst_path, - ddr->index, - target_ptr->owner_id, - target_path, - target_index, - flag, - DRIVER_TYPE_PYTHON, - mapping_type); - - if (success) { - /* send updates */ - UI_context_update_anim_flag(C); - DEG_relations_tag_update(CTX_data_main(C)); - DEG_id_tag_update(ddr->ptr.owner_id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); - WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX - } + /* Get paths for src... */ + PointerRNA *target_ptr = &but->rnapoin; + PropertyRNA *target_prop = but->rnaprop; + int target_index = but->rnaindex; + + char *target_path = RNA_path_from_ID_to_property(target_ptr, target_prop); + + /* ... and destination */ + char *dst_path = BKE_animdata_driver_path_hack(C, &ddr->ptr, ddr->prop, NULL); + + /* Now create driver(s) */ + if (target_path && dst_path) { + int success = ANIM_add_driver_with_target(op->reports, + ddr->ptr.owner_id, + dst_path, + ddr->index, + target_ptr->owner_id, + target_path, + target_index, + flag, + DRIVER_TYPE_PYTHON, + mapping_type); + + if (success) { + /* send updates */ + UI_context_update_anim_flag(C); + DEG_relations_tag_update(CTX_data_main(C)); + DEG_id_tag_update(ddr->ptr.owner_id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } + } - /* cleanup */ - if (target_path) { - MEM_freeN(target_path); - } - if (dst_path) { - MEM_freeN(dst_path); - } + /* cleanup */ + if (target_path) { + MEM_freeN(target_path); + } + if (dst_path) { + MEM_freeN(dst_path); } } @@ -190,9 +188,7 @@ static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS return OPERATOR_RUNNING_MODAL; } - else { - return OPERATOR_CANCELLED; - } + return OPERATOR_CANCELLED; } /* Repeat operator */ @@ -205,9 +201,7 @@ static int driverdropper_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + return OPERATOR_CANCELLED; } static bool driverdropper_poll(bContext *C) @@ -215,9 +209,7 @@ static bool driverdropper_poll(bContext *C) if (!CTX_wm_window(C)) { return 0; } - else { - return 1; - } + return 1; } void UI_OT_eyedropper_driver(wmOperatorType *ot) |