[Bf-extensions-cvs] [3d207655] master: io_coat3D: fixed prefix update bug

Samuli Riihikoski noreply at git.blender.org
Thu Sep 24 02:45:46 CEST 2020


Commit: 3d2076556a73af15779fc06630a3254fd584af02
Author: Samuli Riihikoski
Date:   Thu Sep 24 03:45:40 2020 +0300
Branches: master
https://developer.blender.org/rBA3d2076556a73af15779fc06630a3254fd584af02

io_coat3D: fixed prefix update bug

===================================================================

M	io_coat3D/tex.py
M	io_coat3D/updateimage.py

===================================================================

diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py
index eaf9c69d..ed689e84 100644
--- a/io_coat3D/tex.py
+++ b/io_coat3D/tex.py
@@ -280,35 +280,36 @@ def createnodes(active_mat,texcoat, create_group_node, objekti, ind, is_new, udi
             act_material = node.node_tree
             applink_tree = node
             break
-
+    
+    
     for node in act_material.nodes:
         if (node.type != 'GROUP'):
             if (node.type != 'GROUP_OUTPUT'):
                 if (node.type == 'TEX_IMAGE'):
                     if (node.name == '3DC_color'):
                         bring_color = False
-                        updateimage.update(texcoat, 'color', node)
+                        updateimage.update(texcoat, 'color', node, udim_textures, udim_len)
                     elif (node.name == '3DC_metalness'):
                         bring_metalness = False
-                        updateimage.update(texcoat, 'metalness', node)
+                        updateimage.update(texcoat, 'metalness', node, udim_textures, udim_len)
                     elif (node.name == '3DC_rough'):
                         bring_roughness = False
-                        updateimage.update(texcoat, 'rough', node)
+                        updateimage.update(texcoat, 'rough', node, udim_textures, udim_len)
                     elif (node.name == '3DC_nmap'):
                         bring_normal = False
-                        updateimage.update(texcoat, 'nmap', node)
+                        updateimage.update(texcoat, 'nmap', node, udim_textures, udim_len)
                     elif (node.name == '3DC_displacement'):
                         bring_displacement = False
-                        updateimage.update(texcoat, 'displacement', node)
+                        updateimage.update(texcoat, 'displacement', node, udim_textures, udim_len)
                     elif (node.name == '3DC_emissive'):
                         bring_emissive = False
-                        updateimage.update(texcoat, 'emissive', node)
+                        updateimage.update(texcoat, 'emissive', node, udim_textures, udim_len)
                     elif (node.name == '3DC_AO'):
                         bring_AO = False
-                        updateimage.update(texcoat, 'ao', node)
+                        updateimage.update(texcoat, 'ao', node, udim_textures, udim_len)
                     elif (node.name == '3DC_alpha'):
                         bring_alpha = False
-                        updateimage.update(texcoat, 'alpha', node)
+                        updateimage.update(texcoat, 'alpha', node, udim_textures, udim_len)
 
                     
         elif (node.type == 'GROUP' and node.name.startswith('3DC_')):
diff --git a/io_coat3D/updateimage.py b/io_coat3D/updateimage.py
index d0caa9d6..72d4d826 100644
--- a/io_coat3D/updateimage.py
+++ b/io_coat3D/updateimage.py
@@ -1,16 +1,26 @@
 import bpy
 import os
 
-def update(texcoat,tex_type,node):
+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 = 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)



More information about the Bf-extensions-cvs mailing list