Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color must be int or single-element tuple #91

Open
herrKomputer opened this issue Dec 12, 2023 · 1 comment
Open

color must be int or single-element tuple #91

herrKomputer opened this issue Dec 12, 2023 · 1 comment

Comments

@herrKomputer
Copy link

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

@orcinus
Copy link

orcinus commented Jan 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants