directX_blender icon indicating copy to clipboard operation
directX_blender copied to clipboard

image.use_premultiply bug fix

Open Hogarth-MMD opened this issue 7 years ago • 2 comments

I got this error message in the Blender system console:

    img = bel.image.new(path+'/'+filename)
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_directx_bel\bel\image.py", line 44, in new
    img.use_premultiply = premul
AttributeError: 'Image' object has no attribute 'use_premultiply'

Apparently .use_premultiply is not a possible image attribute in Blender 2.78, but I found a quick and simple bug fix for this issue. I just commented out these 4 lines in image.py and then this .x importer worked fine for me:

Line 44:     # img.use_premultiply = premul
Line 163:    # if type(img) != type(None) :
Line 164:         # img.use_premultiply = True
Line 238:             # img.use_premultiply = True

Hogarth-MMD avatar Jul 16 '17 16:07 Hogarth-MMD

image.use_premultiply=True has been changed to

image.alpha_mode='PREMUL' # default is 'STRAIGHT'

Hogarth-MMD avatar Jul 18 '17 20:07 Hogarth-MMD

The mode is set correctly from the x file in limemidolin's fork (and my fork which allows using Blender's GUI for installing the zip from GitHub).

Poikilos avatar Apr 19 '19 22:04 Poikilos