[solved] Setting particle properties

(BorisTheBrave) #1

Many of the properties of individual particles are writable from Python. But I’m having difficulty getting them to do anything!

For example, running:

for p in C.object.particle_systems[0].particles: p.location = [1,0,0]

sets the location. I can read my value back out again. But the blender UI doesn’t update, and if I touch any particle settings (even irrelevant ones like display), it is reset back to the old value.

I’ve got it to do something once or twice, in janky unrepeatable circumstances, so I know it’s using those values in some way. Has anyone got an examples of this working?

(BorisTheBrave) #2

I got an answer from Diego Gangl that seemed definitive.

From what I could find particle
positions are read only through Python
so you can’t set them.

The particle system is one of the weakest/oldest parts of blender but
apparently they will get a full rewrite for 2.8.

The linked thread gives the trick of creating a object with vertices where you want the particles, then setting up a particle system on that object - that’ll work for my use case.