[Bf-extensions-cvs] [825c3c6e] master: io_coat3D:make sure that texture files exists

Kalle-Samuli Riihikoski noreply at git.blender.org
Mon Oct 12 21:26:42 CEST 2020


Commit: 825c3c6e51ca415c4f7d86c8a8415f008e0bd4d9
Author: Kalle-Samuli Riihikoski
Date:   Mon Oct 12 22:26:37 2020 +0300
Branches: master
https://developer.blender.org/rBA825c3c6e51ca415c4f7d86c8a8415f008e0bd4d9

io_coat3D:make sure that texture files exists

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

M	io_coat3D/__init__.py
M	io_coat3D/tex.py

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

diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py
index 9f6c8306..2dfbeaba 100644
--- a/io_coat3D/__init__.py
+++ b/io_coat3D/__init__.py
@@ -236,7 +236,7 @@ class SCENE_OT_getback(bpy.types.Operator):
         
         if (bpy.app.background == False):
             if os.path.isfile(Export_folder):
-
+                
                 print('BLENDER -> 3DC -> BLENDER WORKFLLOW')
                 DeleteExtra3DC() 
                 workflow1(ExportFolder)
@@ -1256,7 +1256,6 @@ def workflow1(ExportFolder):
 def workflow2(BlenderFolder):
 
     coat3D = bpy.context.scene.coat3D
-    coat = bpy.coat3D
 
     texturelist = make_texture_list(BlenderFolder)
 
diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py
index 060825fc..d2e79582 100644
--- a/io_coat3D/tex.py
+++ b/io_coat3D/tex.py
@@ -121,115 +121,116 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures, udi
 
                 
                 if(testi(objekti, texturelist[slot_index][0], index_mat.name, uv_MODE_mat, ind)) :
+                    if (os.path.isfile(texture_info[3])):
+                        if texture_info[2] == 'color' or texture_info[2] == 'diffuse':
+                            if(index_mat.material.coat3D_diffuse):
+                                
+                                texcoat['color'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'metalness' or texture_info[2] == 'specular' or texture_info[2] == 'reflection':
+                            if (index_mat.material.coat3D_metalness):
+                                texcoat['metalness'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'rough' or texture_info[2] == 'roughness':
+                            if (index_mat.material.coat3D_roughness):
+                                texcoat['rough'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'nmap' or texture_info[2] == 'normalmap' or texture_info[2] == 'normal_map'  or texture_info[2] == 'normal':
+                            if (index_mat.material.coat3D_normal):
+                                texcoat['nmap'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'emissive':
+                            if (index_mat.material.coat3D_emissive):
+                                texcoat['emissive'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'emissive_power':
+                            if (index_mat.material.coat3D_emissive):
+                                texcoat['emissive_power'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'ao':
+                            if (index_mat.material.coat3D_ao):
+                                texcoat['ao'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2].startswith('displacement'):
+                            if (index_mat.material.coat3D_displacement):
+                                texcoat['displacement'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        elif texture_info[2] == 'alpha' or texture_info[2] == 'opacity':
+                            if (index_mat.material.coat3D_alpha):
+                                texcoat['alpha'].append(texture_info[3])
+                                create_nodes = True
+                            else:
+                                os.remove(texture_info[3])
+
+                        create_group_node = True
+              
+
+        else:
+            for texture_info in texturelist:
+                if (os.path.isfile(texture_list[3])):
                     if texture_info[2] == 'color' or texture_info[2] == 'diffuse':
-                        if(index_mat.material.coat3D_diffuse):
-                            
+                        if texcoat['color'] == [] and texture_info[1] == '1001':
                             texcoat['color'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
-                    elif texture_info[2] == 'metalness' or texture_info[2] == 'specular' or texture_info[2] == 'reflection':
-                        if (index_mat.material.coat3D_metalness):
+                    elif texture_info[2] == 'metalness' or texture_info[2] == 'specular' or texture_info[
+                        2] == 'reflection':
+                        if texcoat['metalness'] == [] and texture_info[1] == '1001':
                             texcoat['metalness'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
                     elif texture_info[2] == 'rough' or texture_info[2] == 'roughness':
-                        if (index_mat.material.coat3D_roughness):
+                        if texcoat['rough'] == [] and texture_info[1] == '1001':
                             texcoat['rough'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
-                    elif texture_info[2] == 'nmap' or texture_info[2] == 'normalmap' or texture_info[2] == 'normal_map'  or texture_info[2] == 'normal':
-                        if (index_mat.material.coat3D_normal):
+                    elif texture_info[2] == 'nmap' or texture_info[2] == 'normalmap' or texture_info[
+                        2] == 'normal_map' or texture_info[2] == 'normal':
+                        if texcoat['nmap'] == [] and texture_info[1] == '1001':
                             texcoat['nmap'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
                     elif texture_info[2] == 'emissive':
-                        if (index_mat.material.coat3D_emissive):
+                        if texcoat['emissive'] == [] and texture_info[1] == '1001':
                             texcoat['emissive'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
                     elif texture_info[2] == 'emissive_power':
-                        if (index_mat.material.coat3D_emissive):
+                        if texcoat['emissive_power'] == [] and texture_info[1] == '1001':
                             texcoat['emissive_power'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
                     elif texture_info[2] == 'ao':
-                        if (index_mat.material.coat3D_ao):
+                        if texcoat['ao'] == [] and texture_info[1] == '1001':
                             texcoat['ao'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
                     elif texture_info[2].startswith('displacement'):
-                        if (index_mat.material.coat3D_displacement):
+                        if texcoat['displacement'] == [] and texture_info[1] == '1001':
                             texcoat['displacement'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
-                    elif texture_info[2] == 'alpha' or texture_info[2] == 'opacity':
-                        if (index_mat.material.coat3D_alpha):
+                    if texture_info[2] == 'alpha' or texture_info[2] == 'opacity':
+                        if texcoat['alpha'] == [] and texture_info[1] == '1001':
                             texcoat['alpha'].append(texture_info[3])
                             create_nodes = True
-                        else:
-                            os.remove(texture_info[3])
-
                     create_group_node = True
-              
-
-        else:
-            for texture_info in texturelist:
-
-                if texture_info[2] == 'color' or texture_info[2] == 'diffuse':
-                    if texcoat['color'] == [] and texture_info[1] == '1001':
-                        texcoat['color'].append(texture_info[3])
-                        create_nodes = True
-                elif texture_info[2] == 'metalness' or texture_info[2] == 'specular' or texture_info[
-                    2] == 'reflection':
-                    if texcoat['metalness'] == [] and texture_info[1] == '1001':
-                        texcoat['metalness'].append(texture_info[3])
-                        create_nodes = True
-                elif texture_info[2] == 'rough' or texture_info[2] == 'roughness':
-                    if texcoat['rough'] == [] and texture_info[1] == '1001':
-                        texcoat['rough'].append(texture_info[3])
-                        create_nodes = Tru

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list