Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2018-05-28 21:24:53 +0300
committerJoshua Leung <aligorith@gmail.com>2018-05-28 21:25:03 +0300
commitcf60939a597147eede02a944c9320efcde054801 (patch)
treef265387a91328440dff03673c51929375276967f /source/blender/editors/armature/pose_transform.c
parent69d3a08557d7fc3078c8fcb8caead1aedcdab791 (diff)
Ugly Hacky Fix: Clear Loc/Rot/Scale + Autokey now works for bones
This is a hacky fix so that animators can use this tool again with autokey enabled (which they do all the time). The issue here is that the tool writes the new (0) values to the original data, but insertkey now reads from evaluated data (so that keying interpolated values works). However, the cleared values do not get re-evaluated or flushed before insertkey gets to it (via auto keying), meaning that the wrong values get keyed. There may be better solutions for this, but for now, this is the simplest fix that I can get working.
Diffstat (limited to 'source/blender/editors/armature/pose_transform.c')
-rw-r--r--source/blender/editors/armature/pose_transform.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index af9d94c0bac..1657fe4eaea 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -780,6 +780,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
ViewLayer *view_layer = CTX_data_view_layer(C);
FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, OB_MODE_POSE, ob_iter)
{
+ Object *ob_eval = DEG_get_evaluated_object(CTX_data_depsgraph(C), ob_iter); // XXX: UGLY HACK (for autokey + clear transforms)
ListBase dsources = {NULL, NULL};
bool changed = false;
@@ -797,6 +798,11 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
}
/* tag for autokeying later */
ANIM_relative_keyingset_add_source(&dsources, &ob_iter->id, &RNA_PoseBone, pchan);
+
+#if 1 /* XXX: Ugly Hack - Run clearing function on evaluated copy of pchan */
+ bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name);
+ clear_func(pchan_eval);
+#endif
}
else {
/* add unkeyed tags */