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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuli Riihikoski <haikalle@gmail.com>2020-09-24 02:45:57 +0300
committerSamuli Riihikoski <haikalle@gmail.com>2020-09-24 02:45:57 +0300
commit44eec132b0d5e46147f22f53ae7ad764bcfa427a (patch)
treef347ccfe6685b6b8430cfbbd5476db7745d628a9 /io_coat3D
parentf5705487a24115289e790c0a69382d9a332e2015 (diff)
io_coat3D: make path slashes the same
Diffstat (limited to 'io_coat3D')
-rw-r--r--io_coat3D/tex.py24
-rw-r--r--io_coat3D/updateimage.py15
2 files changed, 25 insertions, 14 deletions
diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py
index d76cd637..ba28e069 100644
--- a/io_coat3D/tex.py
+++ b/io_coat3D/tex.py
@@ -287,28 +287,28 @@ def createnodes(active_mat,texcoat, create_group_node, objekti, ind, is_new, udi
if (node.type == 'TEX_IMAGE'):
if (node.name == '3DC_color'):
bring_color = False
- updateimage.update(texcoat, 'color', node)
+ #updateimage.update(texcoat, 'color', node)
elif (node.name == '3DC_metalness'):
bring_metalness = False
- updateimage.update(texcoat, 'metalness', node)
+ #updateimage.update(texcoat, 'metalness', node)
elif (node.name == '3DC_rough'):
bring_roughness = False
- updateimage.update(texcoat, 'rough', node)
+ #updateimage.update(texcoat, 'rough', node)
elif (node.name == '3DC_nmap'):
bring_normal = False
- updateimage.update(texcoat, 'nmap', node)
+ #updateimage.update(texcoat, 'nmap', node)
elif (node.name == '3DC_displacement'):
bring_displacement = False
- updateimage.update(texcoat, 'displacement', node)
+ #updateimage.update(texcoat, 'displacement', node)
elif (node.name == '3DC_emissive'):
bring_emissive = False
- updateimage.update(texcoat, 'emissive', node)
+ #updateimage.update(texcoat, 'emissive', node)
elif (node.name == '3DC_AO'):
bring_AO = False
- updateimage.update(texcoat, 'ao', node)
+ #updateimage.update(texcoat, 'ao', node)
elif (node.name == '3DC_alpha'):
bring_alpha = False
- updateimage.update(texcoat, 'alpha', node)
+ #updateimage.update(texcoat, 'alpha', node)
elif (node.type == 'GROUP' and node.name.startswith('3DC_')):
@@ -472,8 +472,8 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup,
for image in bpy.data.images:
- if(texcoat[type['name']][0] == image.filepath):
-
+ if(os.path.normpath(texcoat[type['name']][0]) == os.path.normpath(image.filepath)):
+
load_image = False
node.image = image
@@ -488,8 +488,8 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup,
break
if (load_image):
-
- node.image = bpy.data.images.load(texcoat[type['name']][0])
+
+ node.image = bpy.data.images.load(os.path.normpath(texcoat[type['name']][0]))
if(udim_textures):
node.image.source = 'TILED'
diff --git a/io_coat3D/updateimage.py b/io_coat3D/updateimage.py
index aa1a5027..d0caa9d6 100644
--- a/io_coat3D/updateimage.py
+++ b/io_coat3D/updateimage.py
@@ -1,5 +1,16 @@
import bpy
+import os
def update(texcoat,tex_type,node):
- if (texcoat[tex_type][0] != node.image.filepath):
- node.image = bpy.data.images.load(texcoat[tex_type][0])
+
+ 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
+ tex_found = True
+ break
+
+ if (tex_found == False):
+ node.image = bpy.data.images.load(texcoat[tex_type][0])