3
$\begingroup$

We have an animation where particles are emitted from a plane, using a PNG image texture as a density influence.

When rendering through the Blender GUI, if the PNG texture is changed and the animation replayed, the new texture is used as a density influence and the simulation renders correctly.

However, when rendering a single frame from the command line and using a Python script to change the PNG logo, the density influence does not get updated. As a consequence, the new PNG image will display, but the particles will emit as if the old PNG texture was still in place.

Looks as if we need to explicitly tell Blender to empty its cache(s) - from Python. Does anyone know how to do that?

Thanks!

$\endgroup$
  • $\begingroup$ Does blender.org/api/blender_python_api_2_76_2/… help? You might do bpy.context.scene.update() for instance. $\endgroup$ – Qutorial Nov 3 '15 at 19:05
  • $\begingroup$ Thanks Qutorial. I solved it, it had nothing to do with caching, as I assumed initially - see below. $\endgroup$ – sebastian Nov 5 '15 at 16:52
0
$\begingroup$

Found a solution, which has nothing to do with caching:

The animation displays a PNG image (texture) which will be replaced by particles that then disappear. The image seems to be dissolving.

To change the image dynamically, a Python script assigns a new PNG to the texture, with bpy.data.textures['Logo'].image = IMAGE.

What was missing was to also update the texture for the particle emitter. This can be done as follows in Python: bpy.data.particles['ParticleSettings'].active_texture.image = IMAGE

Without updating the particle emitter, the visible image would change, but the particles would still emit from where the old image was.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.