Page MenuHome

Cannot access particles through Python API
Closed, DuplicatePublic

Description

System Information
Operating system: Windows 10
Graphics card: GTX 1060

Blender Version
Broken: 2.80 - 1ae6aaad43ad - March 22, 01:55:04
Worked: 2.79

Short description of error
When accessing the particles of a particle system through the Python API (reference) the collection is always empty.

Exact steps for others to reproduce the error

  1. Open Blender
  2. Add a particle system to the default cube
  3. Optionally bake particles
  4. Open Python Console
  5. Run C.object.particle_systems.active.particles[0]
  6. Get an error.

Event Timeline

In 2.8 you need to do this on the evaluated object

ob = bpy.context.active_object
eval_ob = bpy.context.depsgraph.objects.get(ob.name, None)
ps = eval_ob.particle_systems[0]

Oh, and this has been reported before, so it is a duplicate of T58792