Merge branch 'blender-v2.82-release'

This commit is contained in:
Campbell Barton 2020-01-14 17:12:27 +11:00
commit 1bcb2bfd57
5 changed files with 46 additions and 6 deletions

View File

@ -408,7 +408,14 @@ static void gizmo_arrow_exit(bContext *C, wmGizmo *gz, const bool cancel)
wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
const bool is_prop_valid = WM_gizmo_target_property_is_valid(gz_prop);
if (!cancel) {
if (cancel) {
GizmoInteraction *inter = gz->interaction_data;
if (is_prop_valid) {
gizmo_property_value_reset(C, gz, inter, gz_prop);
}
data->offset = inter->init_offset;
}
else {
/* Assign in case applying the operation needs an updated offset
* edit-mesh bisect needs this. */
if (is_prop_valid) {
@ -418,14 +425,13 @@ static void gizmo_arrow_exit(bContext *C, wmGizmo *gz, const bool cancel)
const float value = WM_gizmo_target_property_float_get(gz, gz_prop);
data->offset = gizmo_offset_from_value(data, value, constrained, inverted);
}
return;
}
GizmoInteraction *inter = gz->interaction_data;
if (is_prop_valid) {
gizmo_property_value_reset(C, gz, inter, gz_prop);
if (!cancel) {
if (is_prop_valid) {
WM_gizmo_target_property_anim_autokey(C, gz, gz_prop);
}
}
data->offset = inter->init_offset;
}
/* -------------------------------------------------------------------- */

View File

@ -537,6 +537,13 @@ static void gizmo_dial_exit(bContext *C, wmGizmo *gz, const bool cancel)
WM_gizmo_target_property_float_set(C, gz, gz_prop, reset_value);
}
}
if (!cancel) {
wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
if (WM_gizmo_target_property_is_valid(gz_prop)) {
WM_gizmo_target_property_anim_autokey(C, gz, gz_prop);
}
}
}
static void gizmo_dial_setup(wmGizmo *gz)

View File

@ -335,6 +335,13 @@ static void gizmo_move_exit(bContext *C, wmGizmo *gz, const bool cancel)
ED_transform_snap_object_context_destroy(inter->snap_context_v3d);
inter->snap_context_v3d = NULL;
}
if (!cancel) {
wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
if (WM_gizmo_target_property_is_valid(gz_prop)) {
WM_gizmo_target_property_anim_autokey(C, gz, gz_prop);
}
}
}
static int gizmo_move_invoke(bContext *C, wmGizmo *gz, const wmEvent *event)

View File

@ -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 */

View File

@ -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);
}
}
/** \} */