diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index 5b6006e84dc1934063ceee86f431111486105890..9e4715a5ddf79e042b43553502d6321218c16e8a 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -303,8 +303,6 @@ def updatemesh(objekti, proxy, texturelist): if(proxy.name.startswith('RetopoGroup')): objekti.data = proxy.data else: - print('objekti: ' + str(len(objekti.data.vertices))) - print('proxy: ' + str(len(proxy.data.vertices))) for ind, v in enumerate(objekti.data.vertices): v.co = proxy.data.vertices[ind].co @@ -642,6 +640,9 @@ class SCENE_OT_export(bpy.types.Operator): checkname = folder_objects + os.sep checkname = ("%sretopo.fbx" % (checkname)) + elif(coat3D.type == 'update'): + checkname = bpy.context.selected_objects[0].coat3D.applink_address + else: while(looking == True): checkname = folder_objects + os.sep + "3DC" @@ -939,7 +940,7 @@ def new_ref_function(new_applink_address, nimi): copymesh.rotation_euler = (0,0,0) -def blender_3DC_blender(texturelist): +def blender_3DC_blender(texturelist, file_applink_address): coat3D = bpy.context.scene.coat3D @@ -952,18 +953,18 @@ def blender_3DC_blender(texturelist): import_type = [] for objekti in bpy.data.objects: - if objekti.type == 'MESH': + if objekti.type == 'MESH' and objekti.coat3D.applink_address == file_applink_address: obj_coat = objekti.coat3D - if(obj_coat.applink_mesh == True): - object_list.append(objekti.name) - if(os.path.isfile(obj_coat.applink_address)): - if (obj_coat.objecttime != str(os.path.getmtime(obj_coat.applink_address))): - obj_coat.dime = objekti.dimensions - obj_coat.import_mesh = True - obj_coat.objecttime = str(os.path.getmtime(obj_coat.applink_address)) - if(obj_coat.applink_address not in import_list): - import_list.append(obj_coat.applink_address) - import_type.append(coat3D.type) + + object_list.append(objekti.name) + if(os.path.isfile(obj_coat.applink_address)): + if (obj_coat.objecttime != str(os.path.getmtime(obj_coat.applink_address))): + obj_coat.dime = objekti.dimensions + obj_coat.import_mesh = True + obj_coat.objecttime = str(os.path.getmtime(obj_coat.applink_address)) + if(obj_coat.applink_address not in import_list): + import_list.append(obj_coat.applink_address) + import_type.append(coat3D.type) if(import_list or coat3D.importmesh): for idx, list in enumerate(import_list): @@ -1355,7 +1356,7 @@ def workflow1(ExportFolder): new_ref_function(new_applink_address, nimi) else: - blender_3DC_blender(texturelist) + blender_3DC_blender(texturelist, new_applink_address) def workflow2(BlenderFolder): @@ -1862,6 +1863,7 @@ class SceneCoat3D(PropertyGroup): ("prim", "Mesh As Voxel Primitive", ""), ("curv", "Mesh As a Curve Profile", ""), ("autopo", "Mesh For Auto-retopology", ""), + ("update", "Update mesh/uvs", ""), ), default="ppp" ) diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 4ae14913aef6dd5abacbfe6c1e2e78e47c01224c..9a6e9e8b380d9b3549d30d48520227c69fbcd0d9 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -46,62 +46,6 @@ def RemoveFbxNodes(objekti): Node_Tree.links.new(Prin_mat.outputs[0], output.inputs[0]) -def UVTiling(objekti, index, texturelist): - """ Checks what Tiles are linked with Material """ - - objekti.coat3D.applink_scale = objekti.scale - tiles_index = [] - tile_number ='' - for poly in objekti.data.polygons: - if (poly.material_index == (index)): - loop_index = poly.loop_indices[0] - uv_x = objekti.data.uv_layers.active.data[loop_index].uv[0] - if(uv_x >= 0 and uv_x <=1): - tile_number_x = '1' - elif (uv_x >= 1 and uv_x <= 2): - tile_number_x = '2' - elif (uv_x >= 2 and uv_x <= 3): - tile_number_x = '3' - elif (uv_x >= 3 and uv_x <= 4): - tile_number_x = '4' - elif (uv_x >= 4 and uv_x <= 5): - tile_number_x = '5' - elif (uv_x >= 5 and uv_x <= 6): - tile_number_x = '6' - elif (uv_x >= 6 and uv_x <= 7): - tile_number_x = '7' - elif (uv_x >= 7 and uv_x <= 8): - tile_number_x = '8' - elif (uv_x >= 8 and uv_x <= 9): - tile_number_x = '9' - - uv_y = objekti.data.uv_layers.active.data[loop_index].uv[1] - if (uv_y >= 0 and uv_y <= 1): - tile_number_y = '0' - elif (uv_y >= 1 and uv_y <= 2): - tile_number_y = '1' - elif (uv_x >= 2 and uv_y <= 3): - tile_number_y = '2' - elif (uv_x >= 3 and uv_y <= 4): - tile_number_y = '3' - elif (uv_x >= 4 and uv_y <= 5): - tile_number_y = '4' - elif (uv_x >= 5 and uv_y <= 6): - tile_number_y = '5' - elif (uv_x >= 6 and uv_y <= 7): - tile_number_y = '6' - elif (uv_x >= 7 and uv_y <= 8): - tile_number_y = '7' - elif (uv_x >= 8 and uv_y <= 9): - tile_number_y = '8' - - tile_number = '10' + tile_number_y + tile_number_x - - if tile_number not in tiles_index: - tiles_index.append(tile_number) - - return tiles_index - def updatetextures(objekti): # Update 3DC textures for index_mat in objekti.material_slots: @@ -716,14 +660,8 @@ def matlab(objekti,mat_list,texturelist,is_new): udim_indexs.append(int(texture[0])) udim_indexs.sort() - - if(udim_textures == False): - readtexturefolder(objekti,mat_list,texturelist,is_new, udim_textures, udim_indexs) - else: - path = texturelist[0][3] - only_name = os.path.basename(path) - if(only_name.startswith(objekti.coat3D.applink_index)): - readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures, udim_indexs) + + readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures, udim_indexs) return('FINISHED')