[Bf-blender-cvs] [23d0af5] gooseberry: Particles: Avoid bad memory access when calculating child weight

Sergey Sharybin noreply at git.blender.org
Tue Jun 9 14:50:44 CEST 2015


Commit: 23d0af50319a0c658853beaf7e19f7fda302136a
Author: Sergey Sharybin
Date:   Tue Jun 9 14:48:50 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB23d0af50319a0c658853beaf7e19f7fda302136a

Particles: Avoid bad memory access when calculating child weight

Not sure it's totally correct solution, but it's better than giving
unpredictable results.

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

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

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

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c22eb16..a928ed6 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1768,9 +1768,9 @@ static void psys_calc_child_parent_weights(ParticleTask *task, struct ChildParti
 		}
 
 		/* modify weights to create parting */
-		if (p_fac > 0.f) {
+		if (p_fac > 0.f && key[0]->segments != -1) {
 			for (w = 0; w < 4; w++) {
-				if (w && weight[w] > 0.f) {
+				if (w && weight[w] > 0.f && key[w]->segments != -1) {
 					float d;
 					if (part->flag & PART_CHILD_LONG_HAIR) {
 						/* For long hair use tip distance/root distance as parting factor instead of root to tip angle. */




More information about the Bf-blender-cvs mailing list