Welcome to mirror list, hosted at ThFree Co, Russian Federation.

updateimage.py « io_coat3D - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 509f2b2ea20df986b4950d0d7b83be631876420f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# SPDX-License-Identifier: GPL-2.0-or-later

import bpy
import os

def update(texcoat,tex_type,node, udim_textures, udim_len):

    if (os.path.normpath(texcoat[tex_type][0]) != os.path.normpath(node.image.filepath)):
        tex_found = False

        for image in bpy.data.images:
            if (os.path.normpath(image.filepath) == os.path.normpath(texcoat[tex_type][0])):
                node.image.use_fake_user = True
                node.image = image

                node.image.reload()
                tex_found = True

                break

        if (tex_found == False):
            node.image = bpy.data.images.load(texcoat[tex_type][0])
            if(udim_textures):
                node.image.source = 'TILED'

            for udim_index in udim_len:
                if (udim_index != 1001):
                    node.image.tiles.new(udim_index)