Maniphest T77985

Creating new texture slot of particle systems by python will corrupt texture's influence on particles.
Closed, Duplicate

Assigned To
None
Authored By
Borek Bures (spiv)
Jun 18 2020, 4:21 AM
Tags
  • BF Blender
Subscribers
Borek Bures (spiv)
Philipp Oeser (lichtwerk)

Description

System Information
Operating system: Win
Graphics card:

Blender Version
Broken: 2.83.0 LTS (2.90.0 Alpha Hash: b89898cbd381)
Worked: never

Short description of error
Creating new texture slot of particle systems by python will corrupt texture's influence on particles.

Exact steps for others to reproduce the error

  1. open TextureSlot_Bug.blend
  2. run script: SetTextureSlot_bug.py
  3. select Plane object and execute operator: setparticlestextureslot
    • script will create new particles texture slot
    • appends black/white texture to the created slot
    • sets influence of density
  4. then particles should be masked only on half of plane, but they are not - slot is corrupted

Workaround - bug proof

  1. reopen TextureSlot_Bug.blend
  2. select Plane object particles and create new empty texture on first Texture slot
  3. remove this texture - this step will create new empty slot
  4. run script: SetTextureSlot_bug.py and execute operator: setparticlestextureslot
  5. the particles are masked - everything works properly because script doesn't have to create a new texture slot

Event Timeline

Borek Bures (spiv) created this task.Jun 18 2020, 4:21 AM
Borek Bures (spiv) updated the task description.Jun 19 2020, 10:46 AM
Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).Jun 22 2020, 10:53 AM

This is due to the texture slot being created with 'MIX' blend_type from the API by default (whereas if you do the same from the interface, it is created with 'MULTIPLY')

So workaround is to set the
mtex.blend_type = 'MULTIPLY'
in your script, see:

This has been reported before, see T76951: Particle system texture added via API not working ['blend_type' when created using the interface is MULTIPLY, whereas when created through API, its value is MIX], will merge these reports...