Commit: a0c54d71d8a432e85fbcd9b01d05a52dee2659c3
Author: Brecht Van Lommel
Date:   Mon Feb 10 18:33:27 2014 +0100
https://developer.blender.org/rBa0c54d71d8a432e85fbcd9b01d05a52dee2659c3

Fix part of T38304: cycles render problem with zero length curve segments.

Now these are removed from the curve.

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

M       intern/cycles/blender/blender_curves.cpp

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

diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index fb3e968..49728c5 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -174,8 +174,8 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, 
BL::Object *b_ob, Par
                                
CData->curvekey_time.reserve(CData->curvekey_time.size() + 
num_add*(ren_step+1));
 
                                for(; pa_no < totparts+totchild; pa_no++) {
+                                       int keynum = 0;
                                        CData->curve_firstkey.push_back(keyno);
-                                       
CData->curve_keynum.push_back(ren_step+1);
                                        
                                        float curve_length = 0.0f;
                                        float3 pcKey;
@@ -184,14 +184,20 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh 
*b_mesh, BL::Object *b_ob, Par
                                                b_psys.co_hair(*b_ob, pa_no, 
step_no, nco);
                                                float3 cKey = 
make_float3(nco[0], nco[1], nco[2]);
                                                cKey = transform_point(&itfm, 
cKey);
-                                               if(step_no > 0)
-                                                       curve_length += 
len(cKey - pcKey);
+                                               if(step_no > 0) {
+                                                       float step_length = 
len(cKey - pcKey);
+                                                       if(step_length == 0.0f)
+                                                               continue;
+                                                       curve_length += 
step_length;
+                                               }
                                                
CData->curvekey_co.push_back(cKey);
                                                
CData->curvekey_time.push_back(curve_length);
                                                pcKey = cKey;
                                                keyno++;
+                                               keynum++;
                                        }
 
+                                       CData->curve_keynum.push_back(keynum);
                                        
CData->curve_length.push_back(curve_length);
                                        curvenum++;
                                }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to