Boid Particles

Hi guys !!!
I am a Python newbie with a problem with a script;
I’ve done this: http://www.pasteall.org/22982/python
this is script (incomplete) create 4 plane (1 Emitter and 3 Killers) and a Particle System with boid physic emitted from the Emitter :cool:
Let me explain my problem:
If i write print( em.particle_system[‘ParticleSystem’].setting.boids ) in the python console the answer is BoidSettings that is correct but if i write the same thing in my script the answer is None!!:frowning:
http://www.pasteall.org/pic/14656 here is the error message
Now i think is it a bug or am i doing something wrong???
Thanks !!!

http://www.pasteall.org/23078/python

You might want to do subtle commenting, while in debug stages of writing this thing. If you want to debug this yourself, then write the shortest amount of code that reproduces this problem (Narrow it down to the stuff you don’t understand) , and see if you can make it work.

Hi zeffii!!
Thank you for your reply but the problem is still alive; indeed if in your script you write print(PSet.boids) the answer is None!!!
Some ideas?
Thanks again !!

The code I pasted at pasteall already breaks at line 83 or something, the rest of the code isn’t interesting for your problem. (yet)

but i agree with your finding… if you comment out from line 84 onwards like
http://www.pasteall.org/23082/python

and then to check, do:


>>> em = bpy.context.object
>>> PSet = em.particle_systems['ParticleSystem'].settings
>>> PSet.boids
bpy.data.particles["ParticleSettings"].boids

while the very last print statement in the Script when run from Text Editor says None and not
bpy.data.particles[“ParticleSettings”].boids

sorry can’t help :frowning:

Hi again zeffii !
yeah you find the problem !!!

you might try setting up a particle_system first, then assigning it to the emitter object…
like:


bpy.data.particles.new("TestSystem")
test_particles = bpy.data.particles["TestSystem"]
test_particles.count=1
test_particles.lifetime=250
test_particles.frame_end=1
test_particles.lifetime_random=1
test_particles.emit_from='FACE'
test_particles.use_emit_random=True
test_particles.use_even_distribution=True
test_particles.distribution='JIT'
test_particles.physics_type='BOIDS'
test_particles.particle_size=0.5
test_particles.size_random=1
test_particles.use_multiply_size_mass=True
test_particles.use_render_emitter=False
test_particles.show_velocity=True
em.particle_systems.active.settings = test_particles

i’ll have a look at this later [noparse]:)[/noparse]

even this doesn’t show it…
http://www.pasteall.org/23083/python

maybe there’s a update switch somewhere…

Done!!!
simply adding scn.update()!!!
thanks !!!

But how can i add a Goal rule???
i don’t konw how to do that in python??
thanks