diff options
author | Samuli Riihikoski <haikalle@gmail.com> | 2020-09-23 23:17:52 +0300 |
---|---|---|
committer | Samuli Riihikoski <haikalle@gmail.com> | 2020-09-23 23:18:16 +0300 |
commit | f5705487a24115289e790c0a69382d9a332e2015 (patch) | |
tree | c523d6fd8576e5f79cc11d3549087c0da8e6b3fb /io_coat3D | |
parent | feca8c5289794a70bdd375be76fc4bc59d83c96b (diff) |
io_coat3D: you can now change prefix and it still update textures
Diffstat (limited to 'io_coat3D')
-rw-r--r-- | io_coat3D/__init__.py | 4 | ||||
-rw-r--r-- | io_coat3D/tex.py | 24 | ||||
-rw-r--r-- | io_coat3D/updateimage.py | 5 |
3 files changed, 27 insertions, 6 deletions
diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index 9e4715a5..5eb64008 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -675,6 +675,8 @@ class SCENE_OT_export(bpy.types.Operator): else: os.makedirs(bake_location) + # BAKING # + temp_string = '' for objekti in bpy.context.selected_objects: if objekti.type == 'MESH': @@ -778,6 +780,8 @@ class SCENE_OT_export(bpy.types.Operator): bpy.data.images.remove(image) index_bake_tex += 1 + + #BAKING ENDS #bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY') if(len(bpy.context.selected_objects) > 1 and coat3D.type != 'vox'): diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 9a6e9e8b..d76cd637 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -21,6 +21,7 @@ import bpy import os import re import json +from io_coat3D import updateimage def find_index(objekti): @@ -286,20 +287,30 @@ 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) elif (node.name == '3DC_metalness'): bring_metalness = False + updateimage.update(texcoat, 'metalness', node) elif (node.name == '3DC_rough'): bring_roughness = False + updateimage.update(texcoat, 'rough', node) elif (node.name == '3DC_nmap'): bring_normal = False + updateimage.update(texcoat, 'nmap', node) elif (node.name == '3DC_displacement'): bring_displacement = False + updateimage.update(texcoat, 'displacement', node) elif (node.name == '3DC_emissive'): bring_emissive = False + updateimage.update(texcoat, 'emissive', node) elif (node.name == '3DC_AO'): bring_AO = False + updateimage.update(texcoat, 'ao', node) elif (node.name == '3DC_alpha'): bring_alpha = False + updateimage.update(texcoat, 'alpha', node) + + elif (node.type == 'GROUP' and node.name.startswith('3DC_')): if (node.name == '3DC_color'): bring_color = False @@ -634,15 +645,14 @@ def createExtraNodes(act_material, node, type): def matlab(objekti,mat_list,texturelist,is_new): - ''' FBX Materials: remove all nodes and create princibles node''' + # FBX Materials: remove all nodes and create princibles node + if(is_new): RemoveFbxNodes(objekti) - '''Main Loop for Texture Update''' + updatetextures(objekti) - updatetextures(objekti) - - ''' Check if bind textures with UVs or Materials ''' + # Count udim tiles if(texturelist != []): @@ -659,8 +669,10 @@ def matlab(objekti,mat_list,texturelist,is_new): if texture[2] == udim_target: udim_indexs.append(int(texture[0])) - udim_indexs.sort() + udim_indexs.sort() # sort tiles list -> 1001, 1002, 1003... + # Main loop for creating nodes + readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures, udim_indexs) diff --git a/io_coat3D/updateimage.py b/io_coat3D/updateimage.py new file mode 100644 index 00000000..aa1a5027 --- /dev/null +++ b/io_coat3D/updateimage.py @@ -0,0 +1,5 @@ +import bpy + +def update(texcoat,tex_type,node): + if (texcoat[tex_type][0] != node.image.filepath): + node.image = bpy.data.images.load(texcoat[tex_type][0]) |