[Bf-blender-cvs] [7125b76] alembic: Take transformation of the duplicator object into accound for hair cutting.

Lukas Tönne noreply at git.blender.org
Fri May 22 17:53:37 CEST 2015


Commit: 7125b76c9a0a1cf126e44850e7c4802bc0e3e37a
Author: Lukas Tönne
Date:   Fri May 22 17:25:48 2015 +0200
Branches: alembic
https://developer.blender.org/rB7125b76c9a0a1cf126e44850e7c4802bc0e3e37a

Take transformation of the duplicator object into accound for hair
cutting.

When using a dupli object from the same group as a target it is
sufficient to calculate the relative transform in the shared duplicator
local space. When using an external object though we have to transform
into world space first.

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

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 411ed78..2188023 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -1960,12 +1960,19 @@ static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *ctx,
 		if (dob->ob != ob)
 			continue;
 		
-		/* instances are calculated relative to the strands object */
-		invert_m4_m4(mat, dob->mat);
-		
 		memset(&haircut, 0, sizeof(haircut));
 		haircut_data_get_bvhtree(&haircut, target_dm, true);
-		haircut_data_get_instances(&haircut, hmd->target, mat, dupli_target ? &data->dupcache->duplilist : NULL);
+		if (dupli_target) {
+			/* instances are calculated relative to the strands object */
+			invert_m4_m4(mat, dob->mat);
+			haircut_data_get_instances(&haircut, hmd->target, mat, &data->dupcache->duplilist);
+		}
+		else {
+			/* instances are calculated relative to the strands object */
+			mul_m4_m4m4(mat, data->mat, dob->mat);
+			invert_m4(mat);
+			haircut_data_get_instances(&haircut, hmd->target, mat, NULL);
+		}
 		
 		haircut_apply(hmd, ctx, eval_mode, &haircut, parents, strands);




More information about the Bf-blender-cvs mailing list