Export_3ds: Improved distance cue node search
[blender-addons.git] / io_coat3D / updateimage.py
blobf69393c0b9a70c6f96c6ea56a6dc25c26fee4a06
1 # SPDX-FileCopyrightText: 2020-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 import bpy
6 import os
8 def update(texcoat,tex_type,node, udim_textures, udim_len):
10 if (os.path.normpath(texcoat[tex_type][0]) != os.path.normpath(node.image.filepath)):
11 tex_found = False
13 for image in bpy.data.images:
14 if (os.path.normpath(image.filepath) == os.path.normpath(texcoat[tex_type][0])):
15 node.image.use_fake_user = True
16 node.image = image
18 node.image.reload()
19 tex_found = True
21 break
23 if (tex_found == False):
24 node.image = bpy.data.images.load(texcoat[tex_type][0])
25 if(udim_textures):
26 node.image.source = 'TILED'
28 for udim_index in udim_len:
29 if (udim_index != 1001):
30 node.image.tiles.new(udim_index)