[Bf-blender-cvs] [5ce6ca05366] master: Fix T54078: Adding subsurf prior to particle system breaks simple children vgroups and textures

Sergey Sharybin noreply at git.blender.org
Thu Feb 15 12:27:58 CET 2018


Commit: 5ce6ca05366e653cc576ac6beaed72d07c0e2e6c
Author: Sergey Sharybin
Date:   Thu Feb 15 10:27:39 2018 +0100
Branches: master
https://developer.blender.org/rB5ce6ca05366e653cc576ac6beaed72d07c0e2e6c

Fix T54078: Adding subsurf prior to particle system breaks simple children vgroups and textures

cpa->num points to a face index on BASE mesh, but get_child_modifier_parameters()
expects index on a FINAL dm. So wrong index was used here.

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

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

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

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 723bb86cb47..87322b5fddc 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2306,7 +2306,19 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp
 
 		/* get the original coordinates (orco) for texture usage */
 		cpa_from = part->from;
-		cpa_num = pa->num;
+
+		/*
+		 * NOTE: Should in theory be the same as:
+		 cpa_num = psys_particle_dm_face_lookup(
+		        ctx->sim.psmd->dm_final,
+		        ctx->sim.psmd->dm_deformed,
+		        pa->num, pa->fuv,
+		        NULL);
+		*/
+		cpa_num = (ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND))
+		        ? pa->num
+		        : pa->num_dmcache;
+
 		/* XXX hack to avoid messed up particle num and subsequent crash (#40733) */
 		if (cpa_num > ctx->sim.psmd->dm_final->getNumTessFaces(ctx->sim.psmd->dm_final))
 			cpa_num = 0;



More information about the Bf-blender-cvs mailing list