[Bf-blender-cvs] [6797d4f7768] hair_guides: Revert "Add a hair system to particles to eventually replace the current pathcaches."

Lukas Tönne noreply at git.blender.org
Sat May 19 17:00:17 CEST 2018


Commit: 6797d4f7768feb6b7fa96e38b119e73ab395cc55
Author: Lukas Tönne
Date:   Sat May 19 15:59:54 2018 +0100
Branches: hair_guides
https://developer.blender.org/rB6797d4f7768feb6b7fa96e38b119e73ab395cc55

Revert "Add a hair system to particles to eventually replace the current pathcaches."

This reverts commit 3ba96b7c4da8aa3461db5985b8d5c762695d49e2.

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

M	source/blender/blenkernel/BKE_hair.h
M	source/blender/blenkernel/intern/hair.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/makesdna/DNA_particle_types.h

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

diff --git a/source/blender/blenkernel/BKE_hair.h b/source/blender/blenkernel/BKE_hair.h
index 4d3f9e189ef..9b2cbebf544 100644
--- a/source/blender/blenkernel/BKE_hair.h
+++ b/source/blender/blenkernel/BKE_hair.h
@@ -81,10 +81,6 @@ void BKE_hair_set_guide_vertex(struct HairSystem *hsys, int index, int flag, con
  */
 void BKE_hair_set_hair_guides(struct HairSystem *hsys, struct HairGuideData *guides);
 
-/* Remove all guide curves.
- */
-void BKE_hair_clear_guides(struct HairSystem *hsys);
-
 /* === Follicles === */
 
 /* Calculate surface area of a scalp mesh */
diff --git a/source/blender/blenkernel/intern/hair.c b/source/blender/blenkernel/intern/hair.c
index 999c305e426..87fd60cb516 100644
--- a/source/blender/blenkernel/intern/hair.c
+++ b/source/blender/blenkernel/intern/hair.c
@@ -285,35 +285,13 @@ void BKE_hair_set_hair_guides(HairSystem *hsys, HairGuideData *guides)
 	hsys->guides.verts = MEM_dupallocN(hsys->guides.verts);
 	hsys->guides.totverts = guides->totverts;
 
-#ifndef NDEBUG
 	const int vertcount = hair_guide_calc_vertstart(hsys);
 	BLI_assert(vertcount <= hsys->guides.totverts);
-#endif
 
 	hsys->flag |= HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING;
 	BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
 }
 
-void BKE_hair_clear_guides(HairSystem *hsys)
-{
-	if (hsys->guides.curves)
-	{
-		MEM_freeN(hsys->guides.curves);
-		hsys->guides.curves = NULL;
-	}
-	hsys->guides.totcurves = 0;
-
-	if (hsys->guides.verts)
-	{
-		MEM_freeN(hsys->guides.verts);
-		hsys->guides.verts = NULL;
-	}
-	hsys->guides.totverts = 0;
-
-	hsys->flag &= ~HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING;
-	BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
-}
-
 /* ================================= */
 
 BLI_INLINE void hair_fiber_verify_weights(HairFollicle *follicle)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 63c7524ff2b..3e4b646bcbb 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -75,7 +75,6 @@
 #include "BKE_main.h"
 #include "BKE_global.h"
 #include "BKE_groom.h"
-#include "BKE_hair.h"
 #include "BKE_idprop.h"
 #include "BKE_armature.h"
 #include "BKE_action.h"
@@ -868,10 +867,6 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f
 		for (p = 0, pa = psysn->particles; p < psysn->totpart; p++, pa++)
 			pa->hair = MEM_dupallocN(pa->hair);
 	}
-	if (psys->hair_system)
-	{
-		psys->hair_system = BKE_hair_copy(psys->hair_system);
-	}
 
 	if (psysn->particles && (psysn->particles->keys || psysn->particles->boid)) {
 		ParticleKey *key = psysn->particles->keys;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 874fe56f613..c8e96285923 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -68,7 +68,6 @@
 #include "BKE_effect.h"
 #include "BKE_global.h"
 #include "BKE_group.h"
-#include "BKE_hair.h"
 #include "BKE_main.h"
 #include "BKE_lattice.h"
 
@@ -441,11 +440,6 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
 		pa->hair = NULL;
 		pa->totkey = 0;
 	}
-	if (psys->hair_system)
-	{
-		BKE_hair_free(psys->hair_system);
-	}
-	psys->hair_system = NULL;
 
 	psys->flag &= ~PSYS_HAIR_DONE;
 
@@ -545,11 +539,6 @@ void psys_free_particles(ParticleSystem *psys)
 		psys->particles = NULL;
 		psys->totpart = 0;
 	}
-
-	if (psys->hair_system)
-	{
-		BKE_hair_clear_guides(psys->hair_system);
-	}
 }
 void psys_free_pdd(ParticleSystem *psys)
 {
@@ -2578,8 +2567,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
 
 	psys->totcached = totpart;
 
-	// TODO update hair export cache
-
 	if (psys->lattice_deform_data) {
 		end_latt_deform(psys->lattice_deform_data);
 		psys->lattice_deform_data = NULL;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 7265fb81026..bc3218723ac 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -74,7 +74,6 @@
 #include "BKE_collision.h"
 #include "BKE_colortools.h"
 #include "BKE_effect.h"
-#include "BKE_hair.h"
 #include "BKE_library_query.h"
 #include "BKE_particle.h"
 
@@ -4110,11 +4109,6 @@ void psys_changed_type(Object *ob, ParticleSystem *psys)
 		CLAMP(part->path_end, 0.0f, 100.0f);
 
 		BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
-
-		if (!psys->hair_system)
-		{
-			psys->hair_system = BKE_hair_new();
-		}
 	}
 	else {
 		free_hair(ob, psys, 1);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 33143bf5a49..140e66a4572 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4197,25 +4197,6 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
 	}
 }
 
-static void direct_link_hair(FileData *fd, HairSystem* hsys)
-{
-	if (!hsys) {
-		return;
-	}
-	
-	hsys->pattern = newdataadr(fd, hsys->pattern);
-	if ( hsys->pattern )
-	{
-		hsys->pattern->follicles = newdataadr(fd, hsys->pattern->follicles);
-	}
-	
-	hsys->guides.curves = newdataadr(fd, hsys->guides.curves);
-	hsys->guides.verts = newdataadr(fd, hsys->guides.verts);
-	
-	hsys->draw_batch_cache = NULL;
-	hsys->draw_texture_cache = NULL;
-}
-
 static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
 {
 	if (pd && pd->tex)
@@ -4432,10 +4413,6 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 			for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
 				pa->hair=newdataadr(fd, pa->hair);
 		}
-		if (psys->hair_system)
-		{
-			direct_link_hair(fd, psys->hair_system);
-		}
 		
 		if (psys->particles && psys->particles->keys) {
 			for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) {
@@ -5033,6 +5010,25 @@ static void direct_link_pose(FileData *fd, bPose *pose)
 	}
 }
 
+static void direct_link_hair(FileData *fd, HairSystem* hsys)
+{
+	if (!hsys) {
+		return;
+	}
+	
+	hsys->pattern = newdataadr(fd, hsys->pattern);
+	if ( hsys->pattern )
+	{
+		hsys->pattern->follicles = newdataadr(fd, hsys->pattern->follicles);
+	}
+	
+	hsys->guides.curves = newdataadr(fd, hsys->guides.curves);
+	hsys->guides.verts = newdataadr(fd, hsys->guides.verts);
+	
+	hsys->draw_batch_cache = NULL;
+	hsys->draw_texture_cache = NULL;
+}
+
 static void direct_link_modifiers(FileData *fd, ListBase *lb)
 {
 	ModifierData *md;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 56be0178db6..d61f9996408 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1353,18 +1353,6 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
 	}
 }
 
-static void write_hair(WriteData *wd, HairSystem *hsys)
-{
-	if ( hsys->pattern )
-	{
-		writestruct(wd, DATA, HairPattern, 1, hsys->pattern);
-		writestruct(wd, DATA, HairFollicle, hsys->pattern->num_follicles, hsys->pattern->follicles);
-	}
-	
-	writestruct(wd, DATA, HairGuideCurve, hsys->guides.totcurves, hsys->guides.curves);
-	writestruct(wd, DATA, HairGuideVertex, hsys->guides.totverts, hsys->guides.verts);
-}
-
 static void write_particlesettings(WriteData *wd, ParticleSettings *part)
 {
 	if (part->id.us > 0 || wd->use_memfile) {
@@ -1444,10 +1432,6 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
 					writestruct(wd, DATA, HairKey, pa->totkey, pa->hair);
 				}
 			}
-			if (psys->hair_system)
-			{
-				write_hair(wd, psys->hair_system);
-			}
 
 			if (psys->particles->boid &&
 			    (psys->part->phystype == PART_PHYS_BOIDS))
@@ -1606,6 +1590,18 @@ static void write_fmaps(WriteData *wd, ListBase *fbase)
 	}
 }
 
+static void write_hair(WriteData *wd, HairSystem *hsys)
+{
+	if ( hsys->pattern )
+	{
+		writestruct(wd, DATA, HairPattern, 1, hsys->pattern);
+		writestruct(wd, DATA, HairFollicle, hsys->pattern->num_follicles, hsys->pattern->follicles);
+	}
+	
+	writestruct(wd, DATA, HairGuideCurve, hsys->guides.totcurves, hsys->guides.curves);
+	writestruct(wd, DATA, HairGuideVertex, hsys->guides.totverts, hsys->guides.verts);
+}
+
 static void write_modifiers(WriteData *wd, ListBase *modbase)
 {
 	ModifierData *md;
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 02aefb7cd9b..2c330501820 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -282,8 +282,6 @@ typedef struct ParticleSystem {
 	struct ParticleCacheKey **pathcache;	/* path cache (runtime) */
 	struct ParticleCacheKey **childcache;	/* child cache (runtime) */
 	ListBase pathcachebufs, childcachebufs;	/* buffers for the above */
-	struct HairSystem *hair_system;			/* Hair data */
-	struct HairExportCache *hair_cache;		/* Hair cache for drawing and rendering */
 
 	struct ClothModifierData *clmd;					/* cloth simulation for hair */
 	struct DerivedMesh *hair_in_dm, *hair_out_dm;	/* input/output for cloth simulation */



More information about the Bf-blender-cvs mailing list