@@ -120,8 +120,8 @@ def convert_hair(exporter, obj, obj_key, psys, depsgraph, luxcore_scene, scene_p
120120 start = 0
121121 else :
122122 # Number of virtual parents reduces the number of exported children
123- num_virtual_parents = math .trunc (0.3 * psys . settings . virtual_parents
124- * psys .settings .child_percent * num_parents )
123+ num_virtual_parents = math .trunc (
124+ 0.3 * psys .settings .virtual_parents * len ( psys . child_particles ) * num_parents )
125125 start = num_parents + num_virtual_parents
126126
127127 # Collect point/color/uv information from Blender
@@ -257,16 +257,13 @@ def convert_hair_curves(exporter, depsgraph, obj, obj_key, luxcore_scene, is_for
257257
258258 strands = obj .data .curves
259259
260- max_strand_length = 0
261- for strand in strands :
262- if strand .points_length > max_strand_length :
263- max_strand_length = strand .points_length
260+ points_per_strand = np .fromiter ((strand .points_length
261+ for strand in strands ), dtype = np .int32 )
264262
265263 points = np .fromiter ((elem
266264 for strand in strands
267- for idx in range (0 , max_strand_length )
268- for elem in get_strand_seg (idx , strand )),
269- dtype = np .float32 )
265+ for idx in range (strand .points_length )
266+ for elem in strand .points [idx ].position ), dtype = np .float32 )
270267
271268 colors = np .empty (shape = 0 , dtype = np .float32 )
272269 uvs = np .empty (shape = 0 , dtype = np .float32 )
@@ -283,8 +280,6 @@ def convert_hair_curves(exporter, depsgraph, obj, obj_key, luxcore_scene, is_for
283280 uvs_needed = settings .copy_uv_coords
284281 copy_uvs = settings .copy_uv_coords
285282
286- uvs_needed = False
287-
288283 if export_color != "none" or uvs_needed :
289284 emitter_mesh = obj .parent .to_mesh (depsgraph = depsgraph )
290285 vertex_colors = emitter_mesh .vertex_colors
@@ -306,13 +301,11 @@ def convert_hair_curves(exporter, depsgraph, obj, obj_key, luxcore_scene, is_for
306301 for elem in uv_coord .vector ),
307302 dtype = np .float32 )
308303
309-
310304 if len (uvs ) == 0 :
311305 copy_uvs = False
312306
313307 transformation = None
314-
315- success = luxcore_scene .DefineBlenderStrands (lux_shape_name , max_strand_length ,
308+ success = luxcore_scene .DefineBlenderCurveStrands (lux_shape_name , points_per_strand ,
316309 points , colors , uvs , image_filename , settings .gamma ,
317310 copy_uvs , transformation , strand_diameter ,
318311 root_width , tip_width , width_offset ,
0 commit comments