]> git.tdb.fi Git - libs/gl.git/blob - blender/io_mspgl/texture.py
Check the flat qualifier from the correct member
[libs/gl.git] / blender / io_mspgl / texture.py
1 class Texture:
2         def __init__(self, tex_node, channels):
3                 self.image = tex_node.image
4
5                 self.srgb = self.image.colorspace_settings.name=='sRGB'
6                 if len(channels)==1 and self.srgb:
7                         raise Exception("Unsupported configuration on texture {}: Grayscale with sRGB".format(self.image.name))
8
9                 if len(channels)==4:
10                         self.pixelformat = 'SRGB8_ALPHA8' if self.srgb else 'RGBA8'
11                 elif len(channels)==1:
12                         self.pixelformat = 'LUMINANCE8' if channels[0]=='Y' else 'R8'
13                 else:
14                         self.pixelformat = 'SRGB8' if self.srgb else 'RGB8'
15
16                 self.width = self.image.size[0]
17                 self.height = self.image.size[1]