[Bf-blender-cvs] [a959771] master: Revert "Fix T47902: Particle grid not using modifier stack."

Bastien Montagne noreply at git.blender.org
Tue Mar 29 17:47:14 CEST 2016


Commit: a95977162687863763e7a26a18e9d91c31227c1e
Author: Bastien Montagne
Date:   Tue Mar 29 17:33:08 2016 +0200
Branches: master
https://developer.blender.org/rBa95977162687863763e7a26a18e9d91c31227c1e

Revert "Fix T47902: Particle grid not using modifier stack."

This reverts commit 2bd3acf7cd27c0c3ee77b10d56b91c3b03226d39.

Commit is valid in theory - but in practice, it means nearly all edited hair systems
would need to be re-created from scratch... Not nice, so better revert and note in code
that particle distribution is ugly and does not respect 'use modifier stack' option in most cases.

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

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

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

diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index e581ac4..2527ff5 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -796,23 +796,13 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
 	}
 	
 	psys_thread_context_init(ctx, sim);
-
-	if (psys->part->use_modifier_stack)
-		dm = finaldm;
-	else
-		dm= CDDM_from_mesh((Mesh*)ob->data);
-
-	/* BMESH ONLY, for verts we don't care about tessfaces */
-	if (from != PART_FROM_VERT) {
-		DM_ensure_tessface(dm);
-	}
-
+	
 	/* First handle special cases */
 	if (from == PART_FROM_CHILD) {
 		/* Simple children */
 		if (part->childtype != PART_CHILD_FACES) {
 			BLI_srandom(31415926 + psys->seed + psys->child_seed);
-			distribute_simple_children(scene, ob, dm, sim->psmd->dm_deformed, psys);
+			distribute_simple_children(scene, ob, finaldm, sim->psmd->dm_deformed, psys);
 			return 0;
 		}
 	}
@@ -820,11 +810,10 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
 		/* Grid distribution */
 		if (part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
 			BLI_srandom(31415926 + psys->seed);
-
-			distribute_grid(dm, psys);
-
-			if (dm != finaldm) dm->release(dm);
-
+			dm= CDDM_from_mesh((Mesh*)ob->data);
+			DM_ensure_tessface(dm);
+			distribute_grid(dm,psys);
+			dm->release(dm);
 			return 0;
 		}
 	}
@@ -833,6 +822,10 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
 	if (from == PART_FROM_CHILD) {
 		distr=PART_DISTR_RAND;
 		BLI_srandom(31415926 + psys->seed + psys->child_seed);
+		dm= finaldm;
+
+		/* BMESH ONLY */
+		DM_ensure_tessface(dm);
 
 		children=1;
 
@@ -853,6 +846,16 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
 		distr = part->distr;
 		BLI_srandom(31415926 + psys->seed);
 		
+		if (psys->part->use_modifier_stack)
+			dm = finaldm;
+		else
+			dm= CDDM_from_mesh((Mesh*)ob->data);
+
+		/* BMESH ONLY, for verts we don't care about tessfaces */
+		if (from != PART_FROM_VERT) {
+			DM_ensure_tessface(dm);
+		}
+
 		/* we need orco for consistent distributions */
 		if (!CustomData_has_layer(&dm->vertData, CD_ORCO))
 			DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob));




More information about the Bf-blender-cvs mailing list