Python Particle texture mapping object affectation is working but has no effect in simulation #30713

Closed
opened 2012-03-29 11:40:03 +02:00 by yann morère · 10 comments

%%%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- [x].texture = sTex
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots- [x].texture_coords = 'OBJECT'
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots- [x].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- [x].texture_coords = 'OBJECT'
ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots- [x].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%%%

%%%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- [x].texture = sTex ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots- [x].texture_coords = 'OBJECT' ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots- [x].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- [x].texture_coords = 'OBJECT' ActiveObjectText.particle_systems['ParticleSystem'].settings.texture_slots- [x].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%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

%%%can't upload files! Error message Parameter missing%%%

%%%can't upload files! Error message Parameter missing%%%
Author

%%%Adding System info and blend file%%%

%%%Adding System info and blend file%%%
Author

%%%Ok it worked... need to understand!%%%

%%%Ok it worked... need to understand!%%%
Author

%%%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 ;-)%%%

%%%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.%%%

%%%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.%%%
Author

%%%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%%%

%%%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%%%
Member

%%%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.%%%

%%%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.%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Author

%%%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 ;-)%%%

%%%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 ;-)%%%
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#30713
No description provided.