From 0dfef2cf4b968c89d8b9f3edba96b75f805ea792 Mon Sep 17 00:00:00 2001 From: franMarz <58062362+franMarz@users.noreply.github.com> Date: Fri, 14 Aug 2020 10:16:04 +0200 Subject: [PATCH 1/3] Bounds fixes --- op_select_islands_outline.py | 58 +++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/op_select_islands_outline.py b/op_select_islands_outline.py index 750445c..96a18dd 100644 --- a/op_select_islands_outline.py +++ b/op_select_islands_outline.py @@ -10,7 +10,7 @@ from . import utilities_ui class op(bpy.types.Operator): bl_idname = "uv.textools_select_islands_outline" - bl_label = "Select Overlap" + bl_label = "Select Island outline" bl_description = "Select island edge bounds" bl_options = {'REGISTER', 'UNDO'} @@ -24,7 +24,11 @@ class op(bpy.types.Operator): #Requires UV map if not bpy.context.object.data.uv_layers: - return False + return False + + # #requires UV_sync + # if not bpy.context.scene.tool_settings.use_uv_select_sync: + # return False return True @@ -40,12 +44,23 @@ def select_outline(context): if bpy.context.active_object.mode != 'EDIT': bpy.ops.object.mode_set(mode='EDIT') - - bpy.context.scene.tool_settings.use_uv_select_sync = False - bm = bmesh.from_edit_mesh(bpy.context.active_object.data); uv_layers = bm.loops.layers.uv.verify(); + pre_sync = bpy.context.scene.tool_settings.use_uv_select_sync + if bpy.context.scene.tool_settings.use_uv_select_sync: + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE') + bpy.ops.uv.select_linked() + bpy.context.scene.tool_settings.use_uv_select_sync = False + bpy.ops.uv.select_all(action='SELECT') + else: + current_edit = tuple(bpy.context.tool_settings.mesh_select_mode) + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE') + current_select = [f for f in bm.faces if f.select] + + islands = utilities_uv.getSelectionIslands() + faces_islands = [face for island in islands for face in island] + edges_islands = [edge for island in islands for face in island for edge in face.edges] bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE') bpy.ops.mesh.select_all(action='DESELECT') @@ -60,19 +75,40 @@ def select_outline(context): # Create seams from islands bpy.ops.uv.seams_from_islands(contextViewUV) - edges_islands = [edge for edge in bm.edges if edge.seam] + edges_seams_from_islands = [edge for edge in bm.edges if edge.seam] # Clear seams - for edge in edges_islands: + for edge in edges_seams_from_islands: edge.seam = False - # Select island edges - bpy.ops.mesh.select_all(action='DESELECT') - for edge in edges_islands: - edge.select = True + if pre_sync: + # Select seams from islands edges and edge boundaries + for edge in edges_islands: + if edge.is_boundary or edge in edges_seams_from_islands: + edge.select = True + else: + for face in current_select: + face.select = True + bpy.context.tool_settings.mesh_select_mode = current_edit + bpy.ops.uv.select_all(action='DESELECT') + edges = [] + for edge in edges_islands: + if edge.is_boundary or edge in edges_seams_from_islands: + edges.extend([e for e in edge.verts[0].link_loops]) + edges.extend([e for e in edge.verts[1].link_loops]) + #edges.append(edge) + + bpy.context.scene.tool_settings.uv_select_mode = 'EDGE' + for face in faces_islands: + for loop in face.loops: + if loop in edges: + loop[uv_layers].select = True + # Restore seam selection for edge in edges_seam: edge.seam = True + bpy.context.scene.tool_settings.use_uv_select_sync = pre_sync + bpy.utils.register_class(op) \ No newline at end of file From 31b24ecb765fcbb7269399df75f66ccee76617df Mon Sep 17 00:00:00 2001 From: ShalokShalom Date: Thu, 3 Sep 2020 08:02:47 +0200 Subject: [PATCH 2/3] correct typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8a863d..f20a217 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TexTools for Blender # -TexTools is a Free addon for Blender 3D with a set of professional UV and Texture toolsBack in 2009 I released the [Original TexTools](http://renderhjs.net/textools/) for 3dsMax. Current features include: Easy Texture Baking, UV Align and Selection tools and Texel Density tools. +TexTools is a Free addon for Blender 3D with a set of professional UV and Texture tools. Back in 2009 I released the [Original TexTools](http://renderhjs.net/textools/) for 3dsMax. Current features include: Easy Texture Baking, UV Align and Selection tools and Texel Density tools. ## Download & Documentation ## Visit the [Official Website & Documentation](http://renderhjs.net/textools/blender/) for in depth overview of all the tools. Alternatively visit this [release log](http://renderhjs.net/textools/blender/log.html) From e1403bd7cac76b59f5bb8089e872711a4865f2d3 Mon Sep 17 00:00:00 2001 From: Antti Tikka Date: Sat, 5 Sep 2020 19:22:02 +0300 Subject: [PATCH 3/3] Fix Align Island by Edge only working in Blender 2.83 --- op_island_align_edge.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/op_island_align_edge.py b/op_island_align_edge.py index b15eee7..1e6c7ad 100644 --- a/op_island_align_edge.py +++ b/op_island_align_edge.py @@ -126,9 +126,14 @@ def align_island(uv_vert0, uv_vert1, faces): loop[uv_layers].select = True diff = uv_vert1 - uv_vert0 - current_angle = math.atan2(diff.y, diff.x) + current_angle = math.atan2(diff.x, diff.y) angle_to_rotate = round(current_angle / (math.pi/2)) * (math.pi/2) - current_angle + # For some reason bpy.ops.transform.rotate rotates in the opposite + # direction in Blender 2.83 than in other versions. + if float(bpy.app.version_string[0:4]) == 2.83: + angle_to_rotate = -angle_to_rotate + bpy.ops.uv.select_linked() bpy.context.tool_settings.transform_pivot_point = 'CURSOR'