Commit: 41447d212b7d6fcd7f3611505d4541160c7d257b
Author: Lukas Tönne
Date:   Tue Apr 7 17:45:09 2015 +0200
Branches: alembic
https://developer.blender.org/rB41447d212b7d6fcd7f3611505d4541160c7d257b

Use the dupli object's obmat for world space simulation.

The overall world space matrix for dupli sims has to be the combined
obmat of the cached object as well as the duplicator for the dupligroup
instance. The cached strand data is generally in object space, so the
matrix has to be applied to get all the forces and interactions right.

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

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 0d772d6..fe47bee 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -35,6 +35,7 @@
 #include "BLI_fileops.h"
 #include "BLI_ghash.h"
 #include "BLI_listbase.h"
+#include "BLI_math.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
@@ -605,6 +606,12 @@ static void hairsim_process(HairSimCacheModifier *hsmd, 
CacheProcessContext *ctx
        for (; BKE_dupli_cache_iter_valid(iter); 
BKE_dupli_cache_iter_next(iter)) {
                DupliObjectData *dobdata = BKE_dupli_cache_iter_get(iter);
                DupliObjectDataStrands *link;
+               float mat[4][4];
+               
+               if (dobdata->ob)
+                       mul_m4_m4m4(mat, data->mat, dobdata->ob->obmat);
+               else
+                       copy_m4_m4(mat, data->mat);
                
                for (link = dobdata->strands.first; link; link = link->next) {
                        Strands *strands = link->strands;
@@ -615,7 +622,7 @@ static void hairsim_process(HairSimCacheModifier *hsmd, 
CacheProcessContext *ctx
                        
                        solver_data = BPH_strands_solver_create(strands, 
&hsmd->sim_params);
                        
-                       BPH_strands_solve(strands, data->mat, solver_data, 
&hsmd->sim_params, (float)frame, (float)frame_prev, ctx->scene, NULL);
+                       BPH_strands_solve(strands, mat, solver_data, 
&hsmd->sim_params, (float)frame, (float)frame_prev, ctx->scene, NULL);
                        
                        BPH_mass_spring_solver_free(solver_data);
                }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to