[Bf-blender-cvs] [917407438c7] temp-sybren-particles: Some fixups

Sybren A. Stüvel noreply at git.blender.org
Wed May 16 14:35:35 CEST 2018


Commit: 917407438c75cf9ff91dc261ffad6c34506f1f42
Author: Sybren A. Stüvel
Date:   Wed May 16 14:33:38 2018 +0200
Branches: temp-sybren-particles
https://developer.blender.org/rB917407438c75cf9ff91dc261ffad6c34506f1f42

Some fixups

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

M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/draw/intern/draw_cache_impl_particles.c
M	source/blender/modifiers/intern/MOD_particlesystem.c

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

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 11aa45ad234..8bcac605b44 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1238,7 +1238,7 @@ static float psys_interpolate_value_from_verts(Mesh *mesh, short from, int index
 		case PART_FROM_FACE:
 		case PART_FROM_VOLUME:
 		{
-			MFace *mf = CustomData_get(&mesh->fdata, index, CD_MFACE); /* TODO(sybren): is this the same as mesh->mface[index]? */
+			MFace *mf = &mesh->mface[index];
 			return interpolate_particle_value(values[mf->v1], values[mf->v2], values[mf->v3], values[mf->v4], fw, mf->v4);
 		}
 			
@@ -2483,7 +2483,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
 		pind.cache = baked ? psys->pointcache : NULL;
 		pind.epoint = NULL;
 		pind.bspline = (psys->part->flag & PART_HAIR_BSPLINE);
-		pind.mesh = hair_mesh; /* XXX Sybren: eek! */
+		pind.mesh = hair_mesh;
 
 		memset(cache[p], 0, sizeof(*cache[p]) * (segments + 1));
 
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 9edbf9c7009..ff61faf9cd2 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3214,8 +3214,8 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 	            LIB_ID_COPY_NO_PREVIEW,
 	            false);
 	deformedVerts = BKE_mesh_vertexCos_get(psys->hair_out_mesh, NULL);
-	
-	/* TODO: after porting Cloth modifier, remove this conversion */
+
+	/* TODO(Sybren): after porting Cloth modifier, remove this conversion */
 	DerivedMesh *hair_in_dm = CDDM_from_mesh(psys->hair_in_mesh);
 	clothModifier_do(psys->clmd, sim->depsgraph, sim->scene, sim->ob, hair_in_dm, deformedVerts);
 	hair_in_dm->needsFree = 1;
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 05eafc7b3b0..6b57d7e5615 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -260,7 +260,7 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
 		}
 	}
 	if (num != DMCACHE_NOTFOUND) {
-		MFace *mface = CustomData_get(&psmd->mesh_final->fdata, num, CD_MFACE);
+		MFace *mface = &psmd->mesh_final->mface[num];
 		for (int j = 0; j < num_uv_layers; j++) {
 			psys_interpolate_uvs(mtfaces[j] + num,
 			                     mface->v4,
@@ -288,7 +288,7 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys,
 	ChildParticle *particle = &psys->child[child_index];
 	int num = particle->num;
 	if (num != DMCACHE_NOTFOUND) {
-		MFace *mface = CustomData_get(&psmd->mesh_final->fdata, num, CD_MFACE);
+		MFace *mface = &psmd->mesh_final->mface[num];
 		for (int j = 0; j < num_uv_layers; j++) {
 			psys_interpolate_uvs(
 			        mtfaces[j] + num, mface->v4, particle->fuv, r_uv[j]);
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index b2e76cf969c..c2493e6d8f3 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -144,7 +144,6 @@ static void deformVerts(
 	}
 
 	/* make new mesh */
-	/* TODO(sybren): this probably creates a copy too many. */
 	BKE_id_copy_ex(NULL, &mesh_src->id, (ID **)&psmd->mesh_final,
 	               LIB_ID_CREATE_NO_MAIN |
 	               LIB_ID_CREATE_NO_USER_REFCOUNT |
@@ -154,9 +153,6 @@ static void deformVerts(
 	BKE_mesh_apply_vert_coords(psmd->mesh_final, vertexCos);
 	BKE_mesh_calc_normals(psmd->mesh_final);
 
-	/* protect dm */
-	// TODO(sybren): how to port psmd->mesh_final->needsFree = false;
-	BLI_assert(psmd->mesh_final);
 	BKE_mesh_tessface_ensure(psmd->mesh_final);
 
 	if (!psmd->mesh_final->runtime.deformed_only) {



More information about the Bf-blender-cvs mailing list