Home

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

Description
I wrote a python script to "macro" this tuto http://blenderdiplom.com/index.php/en/tutorials/item/78-tutorial-dissolve-your-logo-in-blender-262.

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 = bpy.data.objects['Plane'] #ActiveObjectPlane
ActiveObjectText.data.update()

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
ActiveObjectText.data.update()
or
bpy.data.scenes['Scene'].update()
or
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 : http://yann.morere.free.fr/spip/spip.php?article160

See the attached to make you're own tests

Yann
ian57 (yann morère) set Type to Bug.Via Old WorldMar 29 2012, 11:40 AM
ian57 (yann morère) added a comment.Via Old WorldMar 29 2012, 11:59 AM
can't upload files! Error message Parameter missing
ian57 (yann morère) added a comment.Via Old WorldMar 29 2012, 12:01 PM
Adding System info and blend file
Ok it worked... need to understand!
ian57 (yann morère) added a comment.Via Old WorldMar 30 2012, 7:25 AM
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 ;-)
sergey (Sergey Sharybin) added a comment.Via Old WorldApr 2 2012, 4:36 PM
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
ton (Ton Roosendaal) added a comment.Via Old WorldOct 23 2012, 11:52 AM
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 (Ton Roosendaal) closed this task as "Invalid".Via Old WorldOct 23 2012, 11:52 AM
ian57 (yann morère) added a comment.Via Old WorldOct 23 2012, 4:22 PM
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 ;-)

Add Comment