[Bf-blender-cvs] [cf60939a597] blender2.8: Ugly Hacky Fix: Clear Loc/Rot/Scale + Autokey now works for bones

Joshua Leung noreply at git.blender.org
Mon May 28 20:25:50 CEST 2018


Commit: cf60939a597147eede02a944c9320efcde054801
Author: Joshua Leung
Date:   Mon May 28 20:24:53 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcf60939a597147eede02a944c9320efcde054801

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.

===================================================================

M	source/blender/editors/armature/pose_transform.c

===================================================================

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



More information about the Bf-blender-cvs mailing list