From bcb546cafc341fbda07c33f071d29a73fc6fb150 Mon Sep 17 00:00:00 2001 From: Antti Tikka Date: Thu, 18 Jun 2020 16:42:29 +0300 Subject: [PATCH 1/5] Fix Align Island by Edge giving wrong result --- op_island_align_edge.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/op_island_align_edge.py b/op_island_align_edge.py index 13eeadc..b15eee7 100644 --- a/op_island_align_edge.py +++ b/op_island_align_edge.py @@ -126,17 +126,15 @@ def align_island(uv_vert0, uv_vert1, faces): loop[uv_layers].select = True diff = uv_vert1 - uv_vert0 - angle = math.atan2(diff.y, diff.x)%(math.pi/2) + current_angle = math.atan2(diff.y, diff.x) + angle_to_rotate = round(current_angle / (math.pi/2)) * (math.pi/2) - current_angle bpy.ops.uv.select_linked() bpy.context.tool_settings.transform_pivot_point = 'CURSOR' bpy.ops.uv.cursor_set(location=uv_vert0 + diff/2) - if angle >= (math.pi/4): - angle = angle - (math.pi/2) - - bpy.ops.transform.rotate(value=angle, orient_axis='Z', constraint_axis=(False, False, False), orient_type='GLOBAL', mirror=False, use_proportional_edit=False) + bpy.ops.transform.rotate(value=angle_to_rotate, orient_axis='Z', constraint_axis=(False, False, False), orient_type='GLOBAL', mirror=False, use_proportional_edit=False) bpy.utils.register_class(op) From 65a35c8e4b21fd9ffad63dbd9dd3d206edffc919 Mon Sep 17 00:00:00 2001 From: nagadomi Date: Wed, 1 Jul 2020 11:12:06 +0900 Subject: [PATCH 2/5] Fix time.clock() error in Python 3.8 --- op_rectify.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/op_rectify.py b/op_rectify.py index e5fc90a..d1b3348 100644 --- a/op_rectify.py +++ b/op_rectify.py @@ -4,6 +4,7 @@ import operator from mathutils import Vector from collections import defaultdict from math import pi +import sys import time from math import radians, hypot @@ -38,7 +39,11 @@ class op(bpy.types.Operator): rectify(self, context) return {'FINISHED'} - +def time_clock(): + if sys.version_info >= (3, 3): + return time.process_time() + else: + return time.clock() precision = 3 @@ -61,7 +66,7 @@ def rectify(self, context): def main(square = False, snapToClosest = False): - startTime = time.clock() + startTime = time_clock() obj = bpy.context.active_object me = obj.data bm = bmesh.from_edit_mesh(me) @@ -310,7 +315,7 @@ def SuccessFinished(me, startTime): #use for backtrack of steps #bpy.ops.ed.undo_push() bmesh.update_edit_mesh(me) - #elapsed = round(time.clock()-startTime, 2) + #elapsed = round(time_clock()-startTime, 2) #if (elapsed >= 0.05): operator.report({'INFO'}, "UvSquares finished, elapsed:", elapsed, "s.") return @@ -634,4 +639,4 @@ def hypotVert(v1, v2): hyp = hypot(v1.x - v2.x, v1.y - v2.y) return hyp -bpy.utils.register_class(op) \ No newline at end of file +bpy.utils.register_class(op) From 9ab565dc1a3ad48837ae69b3ba136de619019a44 Mon Sep 17 00:00:00 2001 From: franMarz <58062362+franMarz@users.noreply.github.com> Date: Sun, 9 Aug 2020 18:28:50 +0200 Subject: [PATCH 3/5] previews fix --- __init__.py | 15 +++++++-------- utilities_ui.py | 5 +++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index eddc933..9a4517b 100644 --- a/__init__.py +++ b/__init__.py @@ -1279,7 +1279,7 @@ def icon_get(name): -def menu_IMAGE_uvs(self, context): +'''def menu_IMAGE_uvs(self, context): layout = self.layout layout.separator() layout.operator(op_uv_resize.op.bl_idname, text="Resize", icon_value = icon_get("op_extend_canvas_open")) @@ -1295,7 +1295,7 @@ def menu_IMAGE_uvs(self, context): layout.operator(op_island_align_edge.op.bl_idname, text="Align Edge", icon_value = icon_get("op_island_align_edge")) layout.operator(op_island_align_world.op.bl_idname, text="Align World", icon_value = icon_get("op_island_align_world")) - layout.menu(VIEW3D_MT_submenu_align) + layout.menu(VIEW3D_MT_submenu_align)''' class VIEW3D_MT_submenu_align(bpy.types.Menu): bl_label="Align" @@ -1435,7 +1435,7 @@ def register(): for icon in icons: utilities_ui.icon_register(icon) - bpy.types.IMAGE_MT_uvs.append(menu_IMAGE_uvs) + #bpy.types.IMAGE_MT_uvs.append(menu_IMAGE_uvs) bpy.types.IMAGE_MT_select.append(menu_IMAGE_select) bpy.types.IMAGE_MT_image.append(menu_IMAGE_MT_image) bpy.types.VIEW3D_MT_object.append(menu_VIEW3D_MT_object) @@ -1447,14 +1447,10 @@ def register(): def unregister(): - #GUI Utilities - # utilities_ui.unregister() - from bpy.utils import unregister_class for cls in reversed(classes): unregister_class(cls) - #Unregister Settings del bpy.types.Scene.texToolsSettings @@ -1463,7 +1459,10 @@ def unregister(): km.keymap_items.remove(kmi) keymaps.clear() - bpy.types.IMAGE_MT_uvs.remove(menu_IMAGE_uvs) + #GUI Utilities + utilities_ui.unregister() + + #bpy.types.IMAGE_MT_uvs.remove(menu_IMAGE_uvs) bpy.types.IMAGE_MT_select.remove(menu_IMAGE_select) bpy.types.IMAGE_MT_image.remove(menu_IMAGE_MT_image) bpy.types.VIEW3D_MT_object.remove(menu_VIEW3D_MT_object) diff --git a/utilities_ui.py b/utilities_ui.py index 087abae..02e2f37 100644 --- a/utilities_ui.py +++ b/utilities_ui.py @@ -155,12 +155,13 @@ def unregister(): from bpy.types import WindowManager for preview_collection in preview_collections.values(): bpy.utils.previews.remove(preview_collection) - preview_collections.clear() + preview_collection.clear() # Unregister icons # global preview_icons - bpy.utils.previews.remove(preview_icons) + # bpy.utils.previews.remove(preview_icons) + preview_icons.clear() del bpy.types.Scene.TT_bake_mode From f614e3bea74319df8371974af27c7289d6491134 Mon Sep 17 00:00:00 2001 From: franMarz <58062362+franMarz@users.noreply.github.com> Date: Sun, 9 Aug 2020 18:32:37 +0200 Subject: [PATCH 4/5] Add files via upload --- __init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 9a4517b..80f88dc 100644 --- a/__init__.py +++ b/__init__.py @@ -1279,7 +1279,7 @@ def icon_get(name): -'''def menu_IMAGE_uvs(self, context): +def menu_IMAGE_uvs(self, context): layout = self.layout layout.separator() layout.operator(op_uv_resize.op.bl_idname, text="Resize", icon_value = icon_get("op_extend_canvas_open")) @@ -1295,7 +1295,7 @@ def icon_get(name): layout.operator(op_island_align_edge.op.bl_idname, text="Align Edge", icon_value = icon_get("op_island_align_edge")) layout.operator(op_island_align_world.op.bl_idname, text="Align World", icon_value = icon_get("op_island_align_world")) - layout.menu(VIEW3D_MT_submenu_align)''' + layout.menu(VIEW3D_MT_submenu_align) class VIEW3D_MT_submenu_align(bpy.types.Menu): bl_label="Align" @@ -1435,7 +1435,7 @@ def register(): for icon in icons: utilities_ui.icon_register(icon) - #bpy.types.IMAGE_MT_uvs.append(menu_IMAGE_uvs) + bpy.types.IMAGE_MT_uvs.append(menu_IMAGE_uvs) bpy.types.IMAGE_MT_select.append(menu_IMAGE_select) bpy.types.IMAGE_MT_image.append(menu_IMAGE_MT_image) bpy.types.VIEW3D_MT_object.append(menu_VIEW3D_MT_object) From fa7317b751c0b3c29b20312a22a435d54f7485ab Mon Sep 17 00:00:00 2001 From: franMarz <58062362+franMarz@users.noreply.github.com> Date: Sun, 9 Aug 2020 18:33:26 +0200 Subject: [PATCH 5/5] Add files via upload --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 80f88dc..92104a1 100644 --- a/__init__.py +++ b/__init__.py @@ -1462,7 +1462,7 @@ def unregister(): #GUI Utilities utilities_ui.unregister() - #bpy.types.IMAGE_MT_uvs.remove(menu_IMAGE_uvs) + bpy.types.IMAGE_MT_uvs.remove(menu_IMAGE_uvs) bpy.types.IMAGE_MT_select.remove(menu_IMAGE_select) bpy.types.IMAGE_MT_image.remove(menu_IMAGE_MT_image) bpy.types.VIEW3D_MT_object.remove(menu_VIEW3D_MT_object)