[Bf-blender-cvs] [2496259] alembic: Apply strand shape keys to both the base strand coordinates and the motion state.

Lukas Tönne noreply at git.blender.org
Tue May 19 18:37:08 CEST 2015


Commit: 249625971432f5ee48f93dc627af3cdedb9c9f23
Author: Lukas Tönne
Date:   Tue May 19 17:31:31 2015 +0200
Branches: alembic
https://developer.blender.org/rB249625971432f5ee48f93dc627af3cdedb9c9f23

Apply strand shape keys to both the base strand coordinates and the
motion state.

This means shape keys work on the goal positions for hair as well as
the simulation results (hair motion).

If the simulation is created before shape keys are applied, the
resulting sim will be mixed with the shape keys, becoming more rigid
with increased shape weights.

OTOH the shape keys can also be applied to the animation result, before
doing hair simulation. In that case the shape will only affect the goal
positions and the bending shape of the hair, but the hair is otherwise
free to move.

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

M	source/blender/blenkernel/intern/cache_library.c

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

diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index c0340f1..2caa0d4 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -1530,15 +1530,21 @@ static void strandskey_process(StrandsKeyCacheModifier *skmd, CacheProcessContex
 	shape = BKE_key_evaluate_strands(strands, skmd->key, actkb, skmd->flag & eStrandsKeyCacheModifier_Flag_ShapeLock, NULL);
 	if (shape) {
 		StrandsVertex *vert = strands->verts;
+		StrandsMotionState *state = strands->state;
 		int totvert = strands->totverts;
 		int i;
 		
 		float *fp = shape;
 		for (i = 0; i < totvert; ++i) {
 			copy_v3_v3(vert->co, fp);
+			++vert;
+			
+			if (state) {
+				copy_v3_v3(state->co, fp);
+				++state;
+			}
 			
 			fp += 3;
-			++vert;
 		}
 		
 		MEM_freeN(shape);




More information about the Bf-blender-cvs mailing list