How do I automatically (programmatically?) select any particles created with the Particle Add tool?

Any time I’m in Particle Edit mode and use the Add tool to add particles…


…I want to have those newly-created particles automatically selected. (Blender’s default behavior is to NOT have the newly-created particles automatically selected, which makes it trickier to leave the old particles alone while selecting only the new particles.)

I’m thinking this maybe can be done programmatically via an add-on, but I’m not sure how to approach it. When I create new particles, Blender outputs commands like these:

bpy.ops.particle.brush_edit(stroke=[{"name":"", "location":(0, 0, 0), "mouse":(348, 147), "mouse_event":(0, 0), "pressure":0, "size":0, "pen_flip":False, "x_tilt":0, "y_tilt":0, "time":0, "is_start":False}, {"name":"", "location":(0, 0, 0), "mouse":(348, 148), "mouse_event":(0, 0), "pressure":0, "size":0, "pen_flip":False, "x_tilt":0, "y_tilt":0, "time":0, "is_start":False}])

However, I suspect these commands are not very useful for what I want to do.

Any ideas?

Without coding: you can first select all particles: press a or aa
Then add particles, and press Ctrl+i to invert the selection.

With coding, generally like this:
Select all the particles first and store them in a variable before adding new particles. (There is otherwise no way to select the last added particles as far as I see.)
Then you add new hair, restore the original selection, inverse the selection (and store that in a new variable if need for further coding).
To make a selection of all hairs: bpy.ops.particle.select_all(action=“SELECT”)
To invert: bpy.ops.particle.select_all(action=‘INVERT’)

That’s brilliant! I love that idea…it’s such a simple solution, but I hadn’t thought of it. Thanks, @Peetie!

1 Like