Hidden hair particles size data not available

Hi!

I’m exporting particle transforms into a .csv file and use hair strand length to calculate the actual size of a particle (the particle.size parameter always returns 1.0 in case of hair PS). The PS has a mesh as the visualization object.

The problem arises when I disable some percentage of particles for viewport visibility (Particle tab -> Display panel -> Display slider). Blender randomly determines which hair is displayed and which not. In the case of “not displayed” hair, their data (strand segments) is collapsed into a single point, so that if you calculate the length of the strand it returns zero.

You can verify by running this script with a hair PS selected in veiwport:

import bpy
ob = bpy.context.active_object
psys = ob.particle_systems[0]
for p in psys.particles:
    h1 = p.hair_keys[0]
    h2 = p.hair_keys[-1]
    v = h2.co - h1.co
    print("size=%f len=%f is_visible=%s" % (p.size, v.length, p.is_visible))

The size parameter stays always the same (useless data in case of hair PS), but the actual size that is calculated from the length of the root-to-tip vector is zero, for each hair particle that is set to “not visible” for viewport. All the hair key segments have the same location, ie. the hair is collapsed into a point, thus made infinitesimally small.

I need to be able to export hair particle transforms for all hair, regardless of visibility. Is there any other way to know the actual size of a hair particle that is “hidden”? Or is this data not available through the python API?

Why not just do the obvious? When your exporter runs set the display to 100%. Then when it finishes restore the display to whatever it was before.

Well yeah, that’s what I’m doing now, but its not the right solution :slight_smile:

Cycles is able to render just fine all the “invisible” hair, so there must be a way to get the correct data. I just hope it’s possible with Python.

Anybody knows who from the developers could I bugger personally with this question? It’s a general problem I encountered while writing a particle exporter script, that the Python API around particles feels unfinished and a lot of stuff is not exposed through it, eg: its not possible (or I haven’t found a way) to know which particle uses a certain visualization object, if group is used as visualization method. Or how to apply the additional scale factor from the physics tab, in case of hair PS. On top of the problem described above.

Which are the official channels to get such help?

Here you go.

Ok, thanks for the help