Grim-es/material-combiner-addon

color must be int or single-element tuple

herrKomputer opened this issue · 1 comments

Hello everyone.

I am using this addon to combine textures from several models used in unity for optimisation purposes.
And for some of them the process runs smoothly, but for some certain materials I keep getting this error message.

Python: Traceback (most recent call last):
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\material-combiner-addon-master\operators\combiner\combiner.py", line 36, in execute
atlas = get_atlas(scn, self.structure, atlas_size)
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\material-combiner-addon-master\operators\combiner\combiner_ops.py", line 260, in get_atlas
_paste_gfx(scn, item, mat, img, half_gaps)
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\material-combiner-addon-master\operators\combiner\combiner_ops.py", line 290, in _paste_gfx
_get_gfx(scn, mat, item, item['gfx']['img_or_color']),
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\material-combiner-addon-master\operators\combiner\combiner_ops.py", line 313, in _get_gfx
diffuse_img = Image.new(img.mode, size, get_diffuse(mat))
File "C:\Users\User\AppData\Roaming\Python\Python310\site-packages\PIL\Image.py", line 2939, in new
return im._new(core.fill(mode, size, color))
TypeError: color must be int or single-element tuple

I would be very thankful if anyone can tell me what I am doing wrong

It's caused by a change in the PIL library used by newer versions of the plugin.
New versions of PIL cannot handle grayscale TIFs used as a diffuse texture. Likely PNGs too. Anything grayscale really (L channel only).

Since this plugin, PIL and Blender are written by muppets, minor changes introduce breaking changes like this and nobody cares about the user-land breakage. I'd recommend manually examining all your textures and converting them to 8-bit RGB... or, ya know, not using this junk and just manually atlassing your textures in the future.