[Bf-blender-cvs] [a7880dd] alembic: Fix 'Children' draw option showing nothing when no children in hairsim/cache

Bastien Montagne noreply at git.blender.org
Mon Apr 20 17:57:53 CEST 2015


Commit: a7880dd5c8df6890e572aadd160949e81f6f1b51
Author: Bastien Montagne
Date:   Mon Apr 20 17:56:35 2015 +0200
Branches: alembic
https://developer.blender.org/rBa7880dd5c8df6890e572aadd160949e81f6f1b51

Fix 'Children' draw option showing nothing when no children in hairsim/cache

If number of children is zero, even if we do have "valid" children cache, do
not generate children strands from cache...

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

M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/pointcache/alembic/abc_particles.cpp

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

diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index ff919e8..af3b02d 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1457,7 +1457,7 @@ void BKE_dupli_object_data_add_strands_children(DupliObjectData *data, const cha
 			BKE_strands_children_free(link->strands_children);
 		link->strands_children = children;
 	}
-	
+
 	dupli_cache_calc_boundbox(data);
 }
 
diff --git a/source/blender/pointcache/alembic/abc_particles.cpp b/source/blender/pointcache/alembic/abc_particles.cpp
index 648264b..89ab4e6 100644
--- a/source/blender/pointcache/alembic/abc_particles.cpp
+++ b/source/blender/pointcache/alembic/abc_particles.cpp
@@ -698,12 +698,14 @@ PTCReadSampleResult AbcStrandsChildrenReader::read_sample(float frame)
 {
 	ISampleSelector ss = abc_archive()->get_frame_sample_selector(frame);
 	
-	if (!m_curves.valid())
+	if (!m_curves.valid()) {
 		return PTC_READ_SAMPLE_INVALID;
+	}
 	
 	ICurvesSchema &schema = m_curves.getSchema();
-	if (schema.getNumSamples() == 0)
+	if (schema.getNumSamples() == 0) {
 		return PTC_READ_SAMPLE_INVALID;
+	}
 	
 	ICurvesSchema::Sample sample;
 	schema.get(sample, ss);
@@ -716,12 +718,17 @@ PTCReadSampleResult AbcStrandsChildrenReader::read_sample(float frame)
 	Int32ArraySamplePtr sample_parents = m_prop_parents.getValue(ss);
 	FloatArraySamplePtr sample_parent_weights = m_prop_parent_weights.getValue(ss);
 	
-	if (!sample_co || !sample_numvert)
+	if (!sample_co || !sample_numvert) {
 		return PTC_READ_SAMPLE_INVALID;
+	}
 	
 	int totcurves = sample_numvert->size();
 	int totverts = sample_co->size();
-	
+
+	if (!totcurves) {
+		return PTC_READ_SAMPLE_INVALID;
+	}
+
 	if (sample_root_matrix->size() != totcurves ||
 	    sample_root_positions->size() != totcurves ||
 	    sample_parents->size() != 4 * totcurves ||




More information about the Bf-blender-cvs mailing list