Creating new texture slot of particle systems by python will corrupt texture's influence on particles. #77985

Closed
opened 2020-06-18 04:21:06 +02:00 by Borek Bures · 4 comments

System Information
Operating system: Win
Graphics card:

Blender Version
Broken: 2.83.0 LTS (2.90.0 Alpha Hash: b89898cbd3)
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
    TextureSlot_Bug.blend
**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 [TextureSlot_Bug.blend](https://archive.blender.org/developer/F8629360/TextureSlot_Bug.blend)
Author

Added subscriber: @BorekBures

Added subscriber: @BorekBures
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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:
TextureSlot_Bug_corrected.blend

This has been reported before, see #76951 (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...

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: [TextureSlot_Bug_corrected.blend](https://archive.blender.org/developer/F8636516/TextureSlot_Bug_corrected.blend) This has been reported before, see #76951 (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...
Member

Closed as duplicate of #76951

Closed as duplicate of #76951
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 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#77985
No description provided.