[Bf-python] Positioning Particles with Python

Kevin Healy loudgreenideas at gmail.com
Mon Feb 29 18:54:47 CET 2016


I am working on visualizing an astrophysical simulation that uses tracer
particles to calculate temperature, density, and chemical composition in a
supernova explosion. I thought I would use a Particle System, placing each
particle at the location of each of the simulation tracer particles.

I have demonstrated to myself that I can modify each particle with a custom
lifetime that I can access with a Point Density Texture and control color
with a ColorRamp.

However, I am running into trouble when I try to move the particles. I am
using:
bpy.data.objects['Object'].particle_systems[0].particles[i].location =
(x,y,z)

This appears to write the values into the Particle System data (I can see
the modified values in a print statement) and when I cycle into Edit Mode,
the particles are positioned in the 3D View.

However, the behavior is not consistent and sometimes cycling through Edit
Mode resets the particles to their original initial, pseudo-random
locations.

Am I trying to do something that isn't currently supported? (The API
documentation does not have a 'read-only' flag next to the location
attribute description.)

If I can move particles to custom locations, what is the correct method?
I'm relatively new to the Blender Python API, so I can't tell if I'm making
a rookie mistake or there is something deeper I've missed.

Thank you for any advice you can provide,
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160229/9ade18e2/attachment.html>


More information about the Bf-python mailing list