- from .util import basename
- fn = basename(image.filepath)
- if not invert_mask and fn:
+ fn = bpy.path.basename(image.filepath)
+ native_channels = None
+ if fn:
+ abs_path = bpy.path.abspath(image.filepath)
+ if os.path.exists(abs_path):
+ import imbuf
+ native_bpp = imbuf.load(bpy.path.abspath(image.filepath)).planes
+ if native_bpp==32:
+ native_channels = ['R', 'G', 'B', 'A']
+ elif native_bpp==24:
+ native_channels = ['R', 'G', 'B']
+ elif native_bpp==8:
+ native_channels = ['Y']
+
+ if not invert_mask and channels==native_channels: