Adding a new image texture slot to a particle system in Python I'm having problems with Blender 2.78 when creating a new texture slot to a particle system. It has no effect even though the settings are similar to the one created manually. Manually tweaking any controls has no effect to its functionality.

But – if I remove the programmatically created texture slot and create a new one manually with the imported texture selectable from the drop-down list adjusting the influence setting, it starts working!

Here is the complete creation code for reference. get_object is just a shorthand for retrieving an object from the context with the given name.

What am I missing?

def create_particle_system(property_id, object_type):
    def _add_texture(tex):
        mtex = bpy.data.particles['ParticleSettings'].texture_slots.add()
        mtex.texture = tex
        mtex.texture_coords = 'UV'
        mtex.uv_layer = 'demUVmap'
        mtex.use_map_time = False
        mtex.use_map_density = True
        mtex.density_factor = 1.0

    obj = get_object(object_type)
    bpy.ops.object.modifier_add(type='PARTICLE_SYSTEM')
    bpy.data.particles['ParticleSettings'].frame_start = 0.0
    bpy.data.particles['ParticleSettings'].frame_end = 0.0
    bpy.data.particles['ParticleSettings'].distribution = 'RAND'
    bpy.data.particles['ParticleSettings'].use_rotations = True
    bpy.data.particles['ParticleSettings'].use_rotation_dupli = True
    bpy.data.particles['ParticleSettings'].render_type = 'OBJECT'
    bpy.data.particles['ParticleSettings'].dupli_object = obj
    bpy.data.particles['ParticleSettings'].particle_size = 2
    bpy.data.particles['ParticleSettings'].rotation_mode = 'OB_Z'
    bpy.data.particles['ParticleSettings'].rotation_factor_random = 0.1
    bpy.data.particles['ParticleSettings'].phase_factor_random = 2.0
    bpy.data.particles['ParticleSettings'].physics_type = 'NO'
    bpy.data.particles['ParticleSettings'].size_random = 0.1

    tex = bpy.data.textures.new(property_id + '_tex', type='IMAGE')
    tex.image = bpy.data.images.load(filepath=os.path.join(basepath, property_id + '_' + object_type + '.png'))

    _add_texture(tex)
After carefully enumerating all properties of the texture slot, I found one difference.

After explicitly setting

mtex.blend_mode = 'MULTIPLY'


it finally started working. The blend mode is set to MIX by default.