From 1e0b7903649f69295d1b842d05e015676098ac12 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 14 Jan 2020 16:48:01 +1100 Subject: Fix T70273: Auto-keyframe ignored by gizmos --- source/blender/windowmanager/gizmo/WM_gizmo_api.h | 4 ++++ .../windowmanager/gizmo/intern/wm_gizmo_target_props.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'source/blender/windowmanager/gizmo') diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index e66243009f1..7b07546f668 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -236,6 +236,10 @@ void WM_gizmo_target_property_subscribe_all(struct wmGizmo *gz, struct wmMsgBus *mbus, struct ARegion *ar); +void WM_gizmo_target_property_anim_autokey(struct bContext *C, + const struct wmGizmo *gz, + struct wmGizmoProperty *gz_prop); + /* -------------------------------------------------------------------- */ /* wmGizmoGroup */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c index 094fdf3f514..8acdf2de86f 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c @@ -33,6 +33,7 @@ #include "wm.h" +#include "ED_keyframing.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -357,4 +358,19 @@ void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, } } +/** + * Auto-key function if auto-key is enabled. + */ +void WM_gizmo_target_property_anim_autokey(bContext *C, + const wmGizmo *UNUSED(gz), + wmGizmoProperty *gz_prop) +{ + if (gz_prop->prop != NULL) { + Scene *scene = CTX_data_scene(C); + const float cfra = (float)CFRA; + const int index = gz_prop->index == -1 ? 0 : gz_prop->index; + ED_autokeyframe_property(C, scene, &gz_prop->ptr, gz_prop->prop, index, cfra); + } +} + /** \} */ -- cgit v1.2.3