[Bf-blender-cvs] [12d4db4] alembic_pointcache: Fix for constructing cache reader/writer based on RNA pointer.

Lukas Tönne noreply at git.blender.org
Mon Feb 16 19:13:57 CET 2015


Commit: 12d4db406d89a510346c303a27472f6564340097
Author: Lukas Tönne
Date:   Mon Feb 16 19:12:34 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB12d4db406d89a510346c303a27472f6564340097

Fix for constructing cache reader/writer based on RNA pointer.

Because of the awkward internal cloth modifier inside the particle
system, we have to look at the psys to determine if we actually want to
use the particle system cache or the internal cloth modifier cache.

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

M	source/blender/pointcache/PTC_api.cpp

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

diff --git a/source/blender/pointcache/PTC_api.cpp b/source/blender/pointcache/PTC_api.cpp
index 6d5c2b3..d470cf5 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -164,7 +164,15 @@ PTCWriter *PTC_writer_from_rna(Scene *scene, PointerRNA *ptr)
 	if (RNA_struct_is_a(ptr->type, &RNA_ParticleSystem)) {
 		Object *ob = (Object *)ptr->id.data;
 		ParticleSystem *psys = (ParticleSystem *)ptr->data;
-		return PTC_writer_particles(scene, ob, psys);
+		/* XXX particles are bad ...
+		 * this can be either the actual particle cache or the hair dynamics cache,
+		 * which is actually the cache of the internal cloth modifier
+		 */
+		bool use_cloth_cache = psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS);
+		if (use_cloth_cache && psys->clmd)
+			return PTC_writer_cloth(scene, ob, psys->clmd);
+		else
+			return PTC_writer_particles(scene, ob, psys);
 	}
 	if (RNA_struct_is_a(ptr->type, &RNA_ClothModifier)) {
 		Object *ob = (Object *)ptr->id.data;
@@ -206,7 +214,15 @@ PTCReader *PTC_reader_from_rna(Scene *scene, PointerRNA *ptr)
 	if (RNA_struct_is_a(ptr->type, &RNA_ParticleSystem)) {
 		Object *ob = (Object *)ptr->id.data;
 		ParticleSystem *psys = (ParticleSystem *)ptr->data;
-		return PTC_reader_particles(scene, ob, psys);
+		/* XXX particles are bad ...
+		 * this can be either the actual particle cache or the hair dynamics cache,
+		 * which is actually the cache of the internal cloth modifier
+		 */
+		bool use_cloth_cache = psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS);
+		if (use_cloth_cache && psys->clmd)
+			return PTC_reader_cloth(scene, ob, psys->clmd);
+		else
+			return PTC_reader_particles(scene, ob, psys);
 	}
 	if (RNA_struct_is_a(ptr->type, &RNA_ClothModifier)) {
 		Object *ob = (Object *)ptr->id.data;




More information about the Bf-blender-cvs mailing list