Finding vector location of a particle in keyed system

I hope someone can help me figure this out. I’m trying to find the Vector location of a particle, one within a particle system that’s using “Keyed” physics from one or more systems.

Here’s a blend with a simple keyed particle system to show an example: particle test.blend (545 KB)

The red cube has a particle system using a single particle (represented as the blue monkey). That particle system is “Keyed” between the particle systems of the two green objects. I’m trying to access the location of that particle(blue monkey in the sample file) from the red system for each frame. I want to figure out what the path of the keyed particle.


The following code is a sample that works as expected on a particle system that is NOT keyed. It checks the location of the particle at frame 1 and frame 50 and prints each, when ran on a system using Newtonian, the results change as expected.

But when used with a particle system using the Keyed physics type, the location stays the same and doesn’t respect the actual location of the particle which is keyed from the other particle systems.

On the sample file, running this script with a green object prints in the consol two different vector locations. But when the red object is selected, the location doesn’t change.

import bpy

obj = bpy.context.object
ps = obj.particle_systems.active

print("
Check Particle Location")

bpy.context.scene.frame_set(1)
print("
Frame "+str(bpy.context.scene.frame_current))
for x in ps.particles:
loc1 = x.location
print(loc1)

bpy.context.scene.frame_set(50)
print("
Frame "+str(bpy.context.scene.frame_current))
for x in ps.particles:
loc2 = x.location
print(loc2)

So how can I find that location? I’ve looked through the api documentation and found “particle_keys”. But that’s not helping me find to location.
http://www.blender.org/documentation/blender_python_api_2_60_0/bpy.types.Particle.html#bpy.types.Particle.particle_keys

I’ve been searching like crazy, but no luck. So if anyone has any hints, I’d be very grateful! :slight_smile:

Thanks Atom, just confirmed with Jahka that the KEYED system locations is not implemented in the API. The locations of a keyed particle are determined right before they’re displayed and are not readable from anywhere, even in the c code. Someone would need to implement a special case for the particle location in the rna. Bummer on that.

I was looking through your RE:ticular code, awesome script! Some clever work-arounds you’ve got in there! But no dice on working with a KEYED system on that either. According to Jahka, it’s just not possible at this point to access the location of a keyed particle.

I was trying to make a curve along the path of a particle work with the KEYED system (for the bTrace plugin). Guess that’ll have to wait until the particle system gets a little more love.

Hello,

does anybody knows if in the new releases the update of the keyed particles has been enabled? In version 2.76b it seems unfortunately not to be there either.
Thanks
Consuelo

Im very interested in this is as well. Cant understand why this is not reachable for python. There must be data or code to reach right. How would cycles or BI get this data otherwise?