[Bf-blender-cvs] [8264b772f5a] master: Fix T54766: "Record With"-NLA "Push Down" discards Blend Mode, Extrapolation, and Influence

Joshua Leung noreply at git.blender.org
Mon Apr 23 12:35:40 CEST 2018


Commit: 8264b772f5a506b5cb6ce761b7282c23d57834b8
Author: Joshua Leung
Date:   Mon Apr 23 12:35:37 2018 +0200
Branches: master
https://developer.blender.org/rB8264b772f5a506b5cb6ce761b7282c23d57834b8

Fix T54766: "Record With"-NLA "Push Down" discards Blend Mode, Extrapolation, and Influence

Applied similar fix to T54233 to get the "Record with NLA" feature working with
active action blending + influence settings. Extrapolation is explicitly ignored
though, as it shouldn't be used with this feature (i.e. it is already disabled
with the new strips and also on the animdata by default)

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

M	source/blender/editors/transform/transform_generics.c

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

diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 8b35b2e598d..1ff602e075e 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -266,6 +266,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
 		/* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
 		if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
 			AnimData *adt = BKE_animdata_from_id(id);
+			const bool is_first = (adt) && (adt->nla_tracks.first == NULL);
 			
 			/* perform push-down manually with some differences 
 			 * NOTE: BKE_nla_action_pushdown() sync warning...
@@ -286,6 +287,29 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
 					strip->extendmode = NLASTRIP_EXTEND_NOTHING;
 					strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE);
 					
+					/* copy current "action blending" settings from adt to the strip,
+					 * as it was keyframed with these settings, so omitting them will
+					 * change the effect  [T54766]
+					 */
+					if (is_first == false) {
+						strip->blendmode = adt->act_blendmode;
+						strip->influence = adt->act_influence;
+						
+						if (adt->act_influence < 1.0f) {
+							/* enable "user-controlled" influence (which will insert a default keyframe)
+							 * so that the influence doesn't get lost on the new update
+							 *
+							 * NOTE: An alternative way would have been to instead hack the influence
+							 * to not get always get reset to full strength if NLASTRIP_FLAG_USR_INFLUENCE
+							 * is disabled but auto-blending isn't being used. However, that approach
+							 * is a bit hacky/hard to discover, and may cause backwards compatability issues,
+							 * so it's better to just do it this way.
+							 */
+							strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
+							BKE_nlastrip_validate_fcurves(strip);
+						}
+					}
+					
 					/* also, adjust the AnimData's action extend mode to be on 
 					 * 'nothing' so that previous result still play 
 					 */



More information about the Bf-blender-cvs mailing list