Update for removal of image.use_alpha

This commit is contained in:
Brecht Van Lommel 2019-05-18 19:38:17 +02:00
parent d4935729da
commit 58e5857aa7
4 changed files with 13 additions and 10 deletions

View File

@ -395,9 +395,8 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
Img = bpy.data.images.new(NameShort+'_A', 128, 128)
Img.source = 'FILE'
Img.alpha_mode = AlphaMode
Img.alpha_mode = 'IGNORE'
Img.filepath = '%s%s_A%s' % (PathSaveRaw, Name, ExtSave)
Img.use_alpha = False
Tex.image = Img

View File

@ -938,8 +938,10 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
return plane
def apply_image_options(self, image):
image.use_alpha = self.use_transparency
image.alpha_mode = self.alpha_mode
if self.use_transparency == False:
image.alpha_mode = 'IGNORE'
else:
image.alpha_mode = self.alpha_mode
if self.relative:
try: # can't always find the relative path (between drive letters on windows)

View File

@ -1336,7 +1336,7 @@ def fbx_data_texture_file_elements(root, blender_tex_key, scene_data):
elem_data_single_string_unicode(fbx_tex, b"RelativeFilename", fname_rel)
alpha_source = 0 # None
if img.use_alpha:
if img.alpha_mode != 'IGNORE':
# ~ if tex.texture.use_calculate_alpha:
# ~ alpha_source = 1 # RGBIntensity as alpha.
# ~ else:

View File

@ -2774,7 +2774,8 @@ def appearance_LoadImageTexture(imageTexture, ancestry, node):
# KNOWN BUG; PNGs with a transparent color are not perceived
# as transparent. Need alpha channel.
bpyima.use_alpha = bpyima.depth in {32, 128}
if bpyima.depth not in {32, 128}:
bpyima.alpha_mode = 'IGNORE'
return bpyima
@ -2822,7 +2823,7 @@ def appearance_LoadTexture(tex_node, ancestry, node):
def appearance_ExpandCachedMaterial(bpymat):
if 0 and bpymat.texture_slots[0] is not None:
bpyima = bpymat.texture_slots[0].texture.image
tex_has_alpha = bpyima.use_alpha
tex_has_alpha = bpyima.alpha_mode not in {'IGNORE', 'CHANNEL_PACKED'}
return (bpymat, bpyima, tex_has_alpha)
return (bpymat, None, False)
@ -2861,7 +2862,7 @@ def appearance_Create(vrmlname, material, tex_node, ancestry, node, is_vcol):
bpymat.use_vertex_color_paint = True
if 0 and bpyima:
tex_has_alpha = bpyima.use_alpha
tex_has_alpha = bpyima.alpha_mode not in {'IGNORE', 'CHANNEL_PACKED'}
texture = bpy.data.textures.new(bpyima.name, 'IMAGE')
texture.image = bpyima
@ -2873,7 +2874,7 @@ def appearance_Create(vrmlname, material, tex_node, ancestry, node, is_vcol):
mtex.use_map_diffuse = True
mtex.use = True
if bpyima.use_alpha:
if tex_has_alpha:
bpymat.use_transparency = True
mtex.use_map_alpha = True
mtex.alpha_factor = 0.0
@ -2971,7 +2972,8 @@ def appearance_LoadPixelTexture(pixelTexture, ancestry):
print("ImportX3D warning: pixel count in PixelTexture is off")
bpyima = bpy.data.images.new("PixelTexture", w, h, has_alpha, True)
bpyima.use_alpha = has_alpha
if not has_alpha:
bpyima.alpha_mode = 'IGNORE'
# Conditional above the loop, for performance
if plane_count == 3: # RGB