Fastest way to write data out of node?

   2968   2   1
User Avatar
Member
1 posts
Joined: 10月 2019
Offline
Hi

Sorry if this is known thing but I couldn't find anything so far.

So I'm writing out hair data from a groom. I want the @P 3 vec and the @width data. I was using a python script to write it out with numpy arrays to do the writing of the float data to a binary file. I am preallocating the array and writing into indices but the for loops themselves I'm using to access the data in houdini are very slow for larger grooms. At first I was using a nested for loop like:

for curve in curves.prims():
for point in curve.points():

then switched to a single loop over all points like:

for point in curves.points():

and kept track of the indices myself but it's still pretty slow.

Is there a faster way to do this? I've tried regular python lists and looked at the csv exporter in the game dev shelf. That's all still slow.

Thanks!
User Avatar
Member
897 posts
Joined: 7月 2018
Offline
Json dumps? Thinking you probably want to avoid looping over curves with file open and just build the a dict for json before writing.
B.Henriksson, DICE
User Avatar
Member
178 posts
Joined: 1月 2013
Offline
I assume you need the individual curves to be known… otherwise you can grab an entire attribute efficiently using functions like this one:

http://www.sidefx.com/docs/houdini/hom/hou/Geometry.html#pointFloatAttribValuesAsString [www.sidefx.com]
  • Quick Links