How to refresh hair particle position with python?

in blender, the position of the hair particle can be inaccurate when there’s modifiers influencing some particles vgroups, and when there’s texture slots influencing the density and length. (bug?)

within my addon i use this function to refresh the position of the particles constantly (basically toggle the hidding button twice is working fine)


def refresh_particles_show_hide():
    C_Slots = bpy.context.scene.C_Slots_settings
    Terrain = C_Slots.Terrain_pointer

    if Terrain:
        for m in Terrain.modifiers:
            if m.name[:7] == 'SCATTER':
                m.show_viewport = not m.show_viewport #inverse
                m.show_viewport = not m.show_viewport #inverse
                break

is there a better updating method that can also refresh the particle position ? so far i tried a lot of things and it never work out

dg = bpy.context.evaluated_depsgraph_get()
dg.update() 

is not working

there’s also

particle_system.settings.update_tag()

but doesn’t seem to work either
resetting the frame position is not working too.

i’m kind of stuck here, because the hide trick is a bit slow on constant use

I think if the particle position isn’t updating automatically, there’s a bug.

1 Like

yeah i think is (an oversight, a dev forgot to send an refresh when X forgotter action is done), but in the meanwhile working with heavy particles in blender is difficult :frowning: