Python Particle texture mapping object affectation is working but has no effect in simulation
Closed, InvalidPublic


I wrote a python script to "macro" this tuto

All is working fine when done manually with GUI.

But when i use the script, the following step halfly goes wrong :

#affect new texture
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots[0].texture = sTex
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots[0].texture_coords = 'OBJECT'
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots[0].object =['Plane'] #ActiveObjectPlane

In the blender, the "plane" is well affected in the combo box, but it has no effect when running the animation. If I scrolldown the combo a REselect manually the plane, then it works.

Another point, when copy/pasting each line from the script to python console, i have the same result in the animation as in automatic script way. But if make in the python console
another plane affectation
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots[0].texture_coords = 'OBJECT'
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots[0].object = ActiveObjectPlane

the plane effect works, and the animation is good.

I made severals tests (as you can see in the script), on 32 and 64 bits architecture, with 2.62 released, and svn compiled verion. The problem is always the same. Full reproductible.

You can find full script here :

See the attached to make you're own tests




can't upload files! Error message Parameter missing

Adding System info and blend file

Peharps there is a misunderstanding. Upload worked. I didn't understood that upload mus be joined with a comment !.

But my Blender problem still remains ;-)

Assigning to Janne,

but olease always try to find minimal case when blender does not work as expected, it helps a lot understanding what you expect to have and what in fact you've got, also saves lots of time trying to understand this things.

Ok, thanks a lot take into account my problem. Tomorrow, I will make a small video to help to understand the keypoint. and post the link here.

For now, here is 2 screenshots to show where is the problem. (animation at the same frame, without and with the plane reaffectation).

Hope this helps

Hi Yann,

In Blender code, after such actions Blender gets signals to refresh itself (update calls). These update calls are handled by the event system.
While you run a script, events are being halted until you end the script. That is why the API has update calls too add yourself.

I realize it is clumsy, but this is the inner working of Blender itself. People use the Python API as a full replacement for C code now, which is nice but not a specification we can guarantee to work.

Ton Roosendaal (ton) closed this task as "Invalid".Oct 23 2012, 11:52 AM

Hi Ton , thanks for this answer. Finally I gave up and did not use this plane feature.
I'm going to do some new test to see if it works now ;-)

This animation has been included in Openshot Video Editor program ;-)